class Bio::GFF::GFF2
DESCRIPTION¶ ↑
Represents version 2 of GFF
specification. Its behavior is somehow different from Bio::GFF
, especially for attributes.
Constants
- VERSION
Attributes
gff_version[R]
GFF2
version string (String or nil). nil means “2”.
metadata[RW]
Metadata (except “##gff-version”). Must be an array of Bio::GFF::GFF2::MetaData
objects.
Public Class Methods
new(str = nil)
click to toggle source
Creates a Bio::GFF::GFF2
object by building a collection of Bio::GFF::GFF2::Record
(and metadata) objects.
Arguments:
-
str: string in
GFF
format
- Returns
-
Bio::GFF::GFF2
object
# File lib/bio/db/gff.rb 825 def initialize(str = nil) 826 @gff_version = nil 827 @records = [] 828 @metadata = [] 829 parse(str) if str 830 end
Public Instance Methods
parse(str)
click to toggle source
Parses a GFF2
entries, and concatenated the parsed data.
Arguments:
-
str: string in
GFF
format
- Returns
-
self
# File lib/bio/db/gff.rb 845 def parse(str) 846 # parses GFF lines 847 str.each_line do |line| 848 if /^\#\#([^\s]+)/ =~ line then 849 parse_metadata($1, line) 850 else 851 @records << GFF2::Record.new(line) 852 end 853 end 854 self 855 end
to_s()
click to toggle source
string representation of the whole entry.
# File lib/bio/db/gff.rb 194 def to_s 195 ver = @gff_version || VERSION.to_s 196 ver = ver.gsub(/[\r\n]+/, ' ') 197 ([ "##gff-version #{ver}\n" ] + 198 @metadata.collect { |m| m.to_s } + 199 @records.collect{ |r| r.to_s }).join('') 200 end