Class Bio::GFF::GFF2
In: lib/bio/db/gff.rb
Parent: GFF

DESCRIPTION

Represents version 2 of GFF specification. Its behavior is somehow different from Bio::GFF, especially for attributes.

Methods

new   parse   to_s  

Classes and Modules

Module Bio::GFF::GFF2::Escape
Class Bio::GFF::GFF2::MetaData
Class Bio::GFF::GFF2::Record

Constants

VERSION = 2

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

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

[Source]

     # File lib/bio/db/gff.rb, line 822
822:       def initialize(str = nil)
823:         @gff_version = nil
824:         @records = []
825:         @metadata = []
826:         parse(str) if str
827:       end

Public Instance methods

Parses a GFF2 entries, and concatenated the parsed data.


Arguments:

  • str: string in GFF format
Returns:self

[Source]

     # File lib/bio/db/gff.rb, line 842
842:       def parse(str)
843:         # parses GFF lines
844:         str.each_line do |line|
845:           if /^\#\#([^\s]+)/ =~ line then
846:             parse_metadata($1, line)
847:           else
848:             @records << GFF2::Record.new(line)
849:           end
850:         end
851:         self
852:       end

string representation of the whole entry.

[Source]

     # File lib/bio/db/gff.rb, line 194
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

[Validate]