class Bio::GFF::GFF3::Record
Represents a single line of a GFF3-formatted file. See Bio::GFF::GFF3 for more information.
Public Class Methods
Creates a Bio::GFF::GFF3::Record object. Is typically not called directly, but is called automatically when creating a Bio::GFF::GFF3 object.
Arguments:
-
str: a tab-delimited line in GFF3 format
Arguments:
-
seqid: sequence ID (String or nil)
-
source: source (String or nil)
-
feature_type: type of feature (String)
-
start_position: start (Integer)
-
end_position: end (Integer)
-
score: score (Float or nil)
-
strand: strand (String or nil)
-
phase: phase (Integer or nil)
-
attributes: attributes (Array or nil)
# File lib/bio/db/gff.rb, line 1156 def initialize(*arg) super(*arg) end
Parses a GFF3-formatted line and returns a new Bio::GFF::GFF3::Record object.
# File lib/bio/db/gff.rb, line 1135 def self.parse(str) self.new.parse(str) end
Public Instance Methods
shortcut to the ID attribute
# File lib/bio/db/gff.rb, line 1109 def id get_attribute('ID') end
set ID attribute
# File lib/bio/db/gff.rb, line 1114 def id=(str) set_attribute('ID', str) end
Parses a GFF3-formatted line and stores data from the string. Note that all existing data is wiped out.
# File lib/bio/db/gff.rb, line 1162 def parse(string) super end
Return the record as a GFF3 compatible string
# File lib/bio/db/gff.rb, line 1167 def to_s cmnt = if defined?(@comment) and @comment and !@comment.to_s.strip.empty? then @comment.gsub(/[\r\n]+/, ' ') else false end return "\##{cmnt}\n" if self.comment_only? and cmnt [ escape_seqid(column_to_s(@seqname)), escape(column_to_s(@source)), escape(column_to_s(@feature)), escape(column_to_s(@start)), escape(column_to_s(@end)), escape(column_to_s(@score)), escape(column_to_s(@strand)), escape(column_to_s(@frame)), attributes_to_s(@attributes) ].join("\t") + (cmnt ? "\t\##{cmnt}\n" : "\n") end