Class: Bio::GFF

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

Overview

DESCRIPTION

The Bio::GFF and Bio::GFF::Record classes describe data contained in a GFF-formatted file. For information on the GFF format, see www.sanger.ac.uk/Software/formats/GFF/. Data are represented in tab- delimited format, including

  • seqname

  • source

  • feature

  • start

  • end

  • score

  • strand

  • frame

  • attributes (optional)

For example:

SEQ1     EMBL        atg       103   105     .       +       0
SEQ1     EMBL        exon      103   172     .       +       0
SEQ1     EMBL        splice5   172   173     .       +       .
SEQ1     netgene     splice5   172   173     0.94    +       .
SEQ1     genie       sp5-20    163   182     2.3     +       .
SEQ1     genie       sp5-10    168   177     2.1     +       .
SEQ1     grail       ATG       17    19      2.1     -       0

The Bio::GFF object is a container for Bio::GFF::Record objects, each 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



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

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.



73
74
75
# File 'lib/bio/db/gff.rb', line 73

def records
  @records
end