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
GFF2
version string (String or nil). nil means “2”.
Metadata (except “##gff-version”). Must be an array of Bio::GFF::GFF2::MetaData
objects.
Public Class Methods
Source
# File lib/bio/db/gff.rb 826 def initialize(str = nil) 827 @gff_version = nil 828 @records = [] 829 @metadata = [] 830 parse(str) if str 831 end
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
Public Instance Methods
Source
# File lib/bio/db/gff.rb 846 def parse(str) 847 # parses GFF lines 848 str.each_line do |line| 849 if /^\#\#([^\s]+)/ =~ line then 850 parse_metadata($1, line) 851 else 852 @records << GFF2::Record.new(line) 853 end 854 end 855 self 856 end
Parses a GFF2
entries, and concatenated the parsed data.
Arguments:
-
str: string in
GFF
format
- Returns
-
self
Source
# File lib/bio/db/gff.rb 195 def to_s 196 ver = @gff_version || VERSION.to_s 197 ver = ver.gsub(/[\r\n]+/, ' ') 198 ([ "##gff-version #{ver}\n" ] + 199 @metadata.collect { |m| m.to_s } + 200 @records.collect{ |r| r.to_s }).join('') 201 end
string representation of the whole entry.