class Bio::GFF::Record
Represents a single line of a GFF-formatted file. See Bio::GFF for more information.
Attributes
List of tag=value pairs (e.g. to store name of the feature: ID=my_id)
Comments for the GFF record
End position of feature on reference sequence
Name of the feature
For features of type 'exon': indicates where feature begins in the reading frame
Score of annotation (e.g. e-value for BLAST search)
Name of the reference sequence
Name of the source of the feature (e.g. program that did prediction)
Start position of feature on reference sequence
Strand that feature is located on
Public Class Methods
Creates a Bio::GFF::Record object. Is typically not called directly, but is called automatically when creating a Bio::GFF object.
Arguments:
-
str: a tab-delimited line in GFF format
# File lib/bio/db/gff.rb, line 125 def initialize(str) @comment = str.chomp[/#.*/] return if /^#/.match(str) @seqname, @source, @feature, @start, @end, @score, @strand, @frame, attributes, = str.chomp.split("\t") @attributes = parse_attributes(attributes) if attributes end
Public Instance Methods
“comments” is deprecated. Instead, use “comment”.
# File lib/bio/db/gff.rb, line 109 def comments #warn "#{self.class.to_s}#comments is deprecated. Instead, use \"comment\"." if $VERBOSE self.comment end
“comments=” is deprecated. Instead, use “comment=”.
# File lib/bio/db/gff.rb, line 115 def comments=(str) #warn "#{self.class.to_s}#comments= is deprecated. Instead, use \"comment=\"." if $VERBOSE self.comment = str end
Private Instance Methods
# File lib/bio/db/gff.rb, line 135 def parse_attributes(attributes) hash = Hash.new sc = StringScanner.new(attributes) attrs = [] token = '' while !sc.eos? if sc.scan(/[^\\;\"]+/) then token.concat sc.matched elsif sc.scan(/\;/) then attrs.push token unless token.empty? token = '' elsif sc.scan(/\"/) then origtext = sc.matched while !sc.eos? if sc.scan(/[^\\"]+/) then origtext.concat sc.matched elsif sc.scan(/\"/) then origtext.concat sc.matched break elsif sc.scan(/\([\"\])/) then origtext.concat sc.matched elsif sc.scan(/\/) then origtext.concat sc.matched else raise 'Bug: should not reach here' end end token.concat origtext elsif sc.scan(/\\;/) then token.concat sc.matched elsif sc.scan(/\/) then token.concat sc.matched else raise 'Bug: should not reach here' end #if end #while attrs.push token unless token.empty? attrs.each do |x| key, value = x.split(' ', 2) key.strip! value.strip! if value hash[key] = value end hash end