Class: Bio::GFF

Inherits:
Object show all
Defined in:
lib/bio/db/gff.rb

Overview

representing a single line in the GFF file.

Direct Known Subclasses

GFF2, GFF3

Defined Under Namespace

Classes: GFF2, GFF3, Record

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str = '') ⇒ GFF

Creates a Bio::GFF object by building a collection of Bio::GFF::Record objects.

Create a Bio::GFF object the hard way

this_gff =  "SEQ1\tEMBL\tatg\t103\t105\t.\t+\t0\n"
this_gff << "SEQ1\tEMBL\texon\t103\t172\t.\t+\t0\n"
this_gff << "SEQ1\tEMBL\tsplice5\t172\t173\t.\t+\t.\n"
this_gff << "SEQ1\tnetgene\tsplice5\t172\t173\t0.94\t+\t.\n"
this_gff << "SEQ1\tgenie\tsp5-20\t163\t182\t2.3\t+\t.\n"
this_gff << "SEQ1\tgenie\tsp5-10\t168\t177\t2.1\t+\t.\n"
this_gff << "SEQ1\tgrail\tATG\t17\t19\t2.1\t-\t0\n"
p Bio::GFF.new(this_gff)

or create one based on a GFF-formatted file:

p Bio::GFF.new(File.open('my_data.gff')

Arguments:

  • str: string in GFF format

Returns

Bio::GFF object



59
60
61
62
63
64
# File 'lib/bio/db/gff.rb', line 59

def initialize(str = '')
  @records = Array.new
  str.each_line do |line|
    @records << Record.new(line)
  end
end

Instance Attribute Details

#recordsObject

An array of Bio::GFF::Record objects.



67
68
69
# File 'lib/bio/db/gff.rb', line 67

def records
  @records
end