module GenomerPluginView::GffRecordHelper

Constants

DEFAULT_GFF_MAPPING
GFF_TO_TABLE

Public Instance Methods

coordinates() click to toggle source
# File lib/genomer-plugin-view/gff_record_helper.rb, line 27
def coordinates
  if negative_strand?
    [self.end,self.start,self.feature]
  else
    [self.start,self.end,self.feature]
  end
end
negative_strand?() click to toggle source
# File lib/genomer-plugin-view/gff_record_helper.rb, line 23
def negative_strand?
  self.strand == '-'
end
table_attributes() click to toggle source
# File lib/genomer-plugin-view/gff_record_helper.rb, line 50
def table_attributes
  raise Genomer::Error, "Unknown feature type '#{feature}'" unless valid?
  attributes.map do |(k,v)|
    k = GFF_TO_TABLE[feature][k]
    k.nil? ? nil : [k,v]
  end.compact
end
to_genbank_table_entry() click to toggle source
# File lib/genomer-plugin-view/gff_record_helper.rb, line 35
def to_genbank_table_entry

  delimiter = "\t"
  indent    = delimiter * 2

  entries = table_attributes.inject([coordinates]) do |array,atr|
    array << atr.unshift(indent)
  end
  return entries.map{|line| line * delimiter} * "\n" + "\n"
end
valid?() click to toggle source
# File lib/genomer-plugin-view/gff_record_helper.rb, line 46
def valid?
  GFF_TO_TABLE.include?(feature)
end