[BioRuby-cvs] bioruby/lib/bio/db gff.rb,1.5,1.6

Jan Aerts aerts at dev.open-bio.org
Tue Mar 28 13:42:34 UTC 2006


Update of /home/repository/bioruby/bioruby/lib/bio/db
In directory dev.open-bio.org:/tmp/cvs-serv24707

Modified Files:
	gff.rb 
Log Message:
Added documentation.


Index: gff.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/gff.rb,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** gff.rb	18 Dec 2005 15:58:41 -0000	1.5
--- gff.rb	28 Mar 2006 13:42:32 -0000	1.6
***************
*** 4,21 ****
  # Copyright::  Copyright (C) 2003, 2005
  #              Toshiaki Katayama <k at bioruby.org>
  # License::    LGPL
  #
  # $Id$
  #
- # == Description
- #
- #
- # == Example
- #
- #
- # == References
- #
- # * http://www.sanger.ac.uk/Software/formats/GFF/
- #
  #--
  #
--- 4,12 ----
  # Copyright::  Copyright (C) 2003, 2005
  #              Toshiaki Katayama <k at bioruby.org>
+ #              2006  Jan Aerts <jan.aerts at bbsrc.ac.uk>
  # License::    LGPL
  #
  # $Id$
  #
  #--
  #
***************
*** 38,46 ****
  
  module Bio
! 
  class GFF
! 
!   attr_accessor :records
! 
    def initialize(str = '')
      @records = Array.new
--- 29,78 ----
  
  module Bio
! # == DESCRIPTION
! # The Bio::GFF and Bio::GFF::Record classes describe data contained in a 
! # GFF-formatted file. For information on the GFF format, see 
! # http://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.
  class 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
    def initialize(str = '')
      @records = Array.new
***************
*** 50,66 ****
--- 82,127 ----
    end
  
+   # An array of Bio::GFF::Record objects.
+   attr_accessor :records
+ 
+   # Represents a single line of a GFF-formatted file. See Bio::GFF for more
+   # information.
    class Record
  
+     # Name of the reference sequence
      attr_accessor :seqname
+     
+     # Name of the source of the feature (e.g. program that did prediction)
      attr_accessor :source
+     
+     # Name of the feature
      attr_accessor :feature
+     
+     # Start position of feature on reference sequence
      attr_accessor :start
+     
+     # End position of feature on reference sequence
      attr_accessor :end
+     
+     # Score of annotation (e.g. e-value for BLAST search)
      attr_accessor :score
+     
+     # Strand that feature is located on
      attr_accessor :strand
+     
+     # For features of type 'exon': indicates where feature begins in the reading frame
      attr_accessor :frame
+     
+     # List of tag=value pairs (e.g. to store name of the feature: ID=my_id)
      attr_accessor :attributes
+     
+     # Comments for the GFF record
      attr_accessor :comments
  
+     # Creates a Bio::GFF::Record object. Is typically not called directly, but
+     # is called automatically when creating a Bio::GFF object.
+     # ---
+     # *Arguments*:
+     # * _str_: a tab-delimited line in GFF format
      def initialize(str)
        @comments = str.chomp[/#.*/]
***************
*** 83,90 ****
--- 144,158 ----
    end
  
+   # = DESCRIPTION
+   # Represents version 2 of GFF specification. Is completely implemented by the
+   # Bio::GFF class.
    class GFF2 < GFF
      VERSION = 2
    end
  
+   # = DESCRIPTION
+   # Represents version 3 of GFF specification. Is completely implemented by the
+   # Bio::GFF class. For more information on version GFF3, see
+   # http://flybase.bio.indiana.edu/annot/gff3.html
    class GFF3 < GFF
      VERSION = 3
***************
*** 103,106 ****
    end
  
!   p Bio::GFF.new(ARGF.read)
  end
--- 171,181 ----
    end
  
!   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)
  end




More information about the bioruby-cvs mailing list