[BioRuby-cvs] bioruby/lib/bio/db/genbank genbank.rb,0.38,0.39

Katayama Toshiaki k at dev.open-bio.org
Tue Sep 19 05:59:09 UTC 2006


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

Modified Files:
	genbank.rb 
Log Message:
* license is changed from LGPL to Ruby's
* document is changed to RDoc


Index: genbank.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/genbank/genbank.rb,v
retrieving revision 0.38
retrieving revision 0.39
diff -C2 -d -r0.38 -r0.39
*** genbank.rb	7 Dec 2005 11:23:51 -0000	0.38
--- genbank.rb	19 Sep 2006 05:59:07 -0000	0.39
***************
*** 1,22 ****
  #
! # bio/db/genbank/genbank.rb - GenBank database class
! #
! #   Copyright (C) 2000-2005 KATAYAMA Toshiaki <k at bioruby.org>
! #
! #  This library is free software; you can redistribute it and/or
! #  modify it under the terms of the GNU Lesser General Public
! #  License as published by the Free Software Foundation; either
! #  version 2 of the License, or (at your option) any later version.
! #
! #  This library is distributed in the hope that it will be useful,
! #  but WITHOUT ANY WARRANTY; without even the implied warranty of
! #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
! #  Lesser General Public License for more details.
  #
! #  You should have received a copy of the GNU Lesser General Public
! #  License along with this library; if not, write to the Free Software
! #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  #
! #  $Id$
  #
  
--- 1,9 ----
  #
! # = bio/db/genbank/genbank.rb - GenBank database class
  #
! # Copyright::  Copyright (C) 2000-2005 Toshiaki Katayama <k at bioruby.org>
! # License::    Ruby's
  #
! # $Id$
  #
  
***************
*** 25,33 ****
  
  module Bio
  class GenBank < NCBIDB
  
    include Bio::NCBIDB::Common
  
!   # LOCUS
    class Locus
      def initialize(locus_line)
--- 12,32 ----
  
  module Bio
+ 
+ # == Description
+ #
+ # Parses a GenBank formatted database entry
+ #
+ # == Example
+ #
+ #   # entry is a string containing only one entry contents
+ #   gb = Bio::GenBank.new(entry)
+ #
  class GenBank < NCBIDB
  
    include Bio::NCBIDB::Common
  
!   # Parses the LOCUS line and returns contents of the LOCUS record
!   # as a Bio::GenBank::Locus object.  Locus object is created automatically
!   # when Bio::GenBank#locus, entry_id etc. methods are called.
    class Locus
      def initialize(locus_line)
***************
*** 56,88 ****
    end
  
    def locus
      @data['LOCUS'] ||= Locus.new(get('LOCUS'))
    end
-   def entry_id;		locus.entry_id;		end
-   def length;		locus.length;		end
-   def circular;		locus.circular;		end
-   def division;		locus.division;		end
-   def date;		locus.date;		end
- 
-   def strand;		locus.strand;		end
-   def natype;		locus.natype;		end
  
  
!   # ORIGIN
!   def seq
!     unless @data['SEQUENCE']
!       origin
!     end
!     Bio::Sequence::NA.new(@data['SEQUENCE'])
!   end
!   alias naseq seq
!   alias nalen length
! 
!   def seq_len
!     seq.length
!   end
  
  
!   # FEATURES
    def each_cds
      features.each do |feature|
--- 55,75 ----
    end
  
+   # Accessor methods for the contents of the LOCUS record.
+ 
    def locus
      @data['LOCUS'] ||= Locus.new(get('LOCUS'))
    end
  
+   def entry_id;  locus.entry_id;  end
+   def length;    locus.length;    end
+   def circular;  locus.circular;  end
+   def division;  locus.division;  end
+   def date;      locus.date;      end
  
!   def strand;    locus.strand;    end
!   def natype;    locus.natype;    end
  
  
!   # FEATURES -- Iterate only for the 'CDS' portion of the Bio::Features.
    def each_cds
      features.each do |feature|
***************
*** 93,96 ****
--- 80,84 ----
    end
  
+   # FEATURES -- Iterate only for the 'gene' portion of the Bio::Features.
    def each_gene
      features.each do |feature|
***************
*** 102,106 ****
  
  
!   # BASE COUNT : obsoleted after GenBank release 138.0
    def basecount(base = nil)
      unless @data['BASE COUNT']
--- 90,97 ----
  
  
!   # BASE COUNT (this field is obsoleted after GenBank release 138.0) --
!   # Returns the BASE COUNT as a Hash.  When the base is specified, returns
!   # count of the base as a Fixnum.  The base can be one of 'a', 't', 'g',
!   # 'c', and 'o' (others).
    def basecount(base = nil)
      unless @data['BASE COUNT']
***************
*** 120,123 ****
--- 111,129 ----
    end
  
+   # ORIGIN -- Returns DNA sequence in the ORIGIN record as a
+   # Bio::Sequence::NA object.
+   def seq
+     unless @data['SEQUENCE']
+       origin
+     end
+     Bio::Sequence::NA.new(@data['SEQUENCE'])
+   end
+   alias naseq seq
+   alias nalen length
+ 
+   def seq_len
+     seq.length
+   end
+ 
  end # GenBank
  end # Bio
***************
*** 207,354 ****
  
  
- =begin
- 
- = Bio::GenBank
- 
- === Initialize
- 
- --- Bio::GenBank.new(entry)
- 
- === LOCUS
- 
- --- Bio::GenBank#locus -> Bio::Locus
- 
- Returns contents of the LOCUS record as a Bio::GenBank::Locus object.
- 
- --- Bio::GenBank#entry_id -> String
- --- Bio::GenBank#nalen -> Fixnum
- --- Bio::GenBank#strand -> String
- --- Bio::GenBank#natype -> String
- --- Bio::GenBank#circular -> String
- --- Bio::GenBank#division -> String
- --- Bio::GenBank#date -> String
- 
- Access methods for the contents of the LOCUS record.
- 
- === DEFINITION
- 
- --- Bio::GenBank#definition -> String
- 
- Returns contents of the DEFINITION record as a String.
- 
- === ACCESSION
- 
- --- Bio::GenBank#accessions -> Array
- 
- Returns contents of the ACCESSION record as an Array.
- 
- === VERSION
- 
- --- Bio::GenBank#versions -> Array
- 
- Returns contents of the VERSION record as an Array of Strings.
- 
- --- Bio::GenBank#acc_version -> String
- --- Bio::GenBank#accession -> String
- --- Bio::GenBank#version -> Fixnum
- --- Bio::GenBank#gi -> String
- 
- Access methods for the contents of the VERSION record.
- 
- The 'acc_version' method returns the first part of the VERSION record
- as a "ACCESSION.VERSION" String, 'accession' method returns the ACCESSION
- part of the acc_version, 'version' method returns the VERSION part of the
- acc_version as a Fixnum, and the 'gi' method returns the second part of
- the VERSION record as a "GI:#######" String.
- 
- === NID
- 
- --- Bio::GenBank#nid -> String
- 
- Returns contents of the NID record as a String.
- 
- === KEYWORDS
- 
- --- Bio::GenBank#keywords -> Array
- 
- Returns contents of the KEYWORDS record as an Array of Strings.
- 
- === SEGMENT
- 
- --- Bio::GenBank#segment -> String
- 
- Returns contents of the SEGMENT record as a "m/n" form String.
- 
- === SOURCE
- 
- --- Bio::GenBank#source -> Hash
- 
- Returns contents of the SOURCE record as a Hash.
- 
- --- Bio::GenBank#common_name -> String
- --- Bio::GenBank#vernacular_name -> String
- --- Bio::GenBank#organism -> String
- --- Bio::GenBank#taxonomy -> String
- 
- Access methods for the contents of the SOURCE record.
- 
- The 'common_name' method is same as source['common_name'].
- The 'vernacular_name' method is an alias for the 'common_name'.
- The 'organism' method is same as source['organism'].
- The 'taxonomy' method is same as source['taxonomy'].
- 
- === REFERENCE
- 
- --- Bio::GenBank#references -> Array
- 
- Returns contents of the REFERENCE records as an Array of Bio::Reference
- objects.
- 
- === COMMENT
- 
- --- Bio::GenBank#comment -> String
- 
- Returns contents of the COMMENT record as a String.
- 
- === FEATURES
- 
- --- Bio::GenBank#features -> Bio::Features
- 
- Returns contents of the FEATURES record as a Bio::Features object.
- 
- --- Bio::GenBank#each_cds -> Array
- 
- Iterate only for the 'CDS' portion of the Bio::Features.
- 
- --- Bio::GenBank#each_gene -> Array
- 
- Iterate only for the 'gene' portion of the Bio::Features.
- 
- === BASE COUNT
- 
- --- Bio::GenBank#basecount(base = nil) -> Hash or Fixnum
- 
- Returns the BASE COUNT as a Hash.  When the base is specified, returns
- count of the base as a Fixnum.  The base can be one of 'a', 't', 'g',
- 'c', and 'o' (others).
- 
- === ORIGIN
- 
- --- Bio::GenBank#origin -> String
- 
- Returns contents of the ORIGIN record as a String.
- 
- --- Bio::GenBank#naseq -> Bio::Sequence::NA
- --- Bio::GenBank#seq -> Bio::Sequence::NA
- 
- Returns DNA sequence in the ORIGIN record as a Bio::Sequence::NA object.
- 
- == SEE ALSO
- 
- * ((<URL:ftp://ftp.ncbi.nih.gov/genbank/gbrel.txt>))
- * ((<URL:http://www.ncbi.nlm.nih.gov/collab/FT/index.html>))
- 
- =end
- 
- 
  
--- 213,215 ----




More information about the bioruby-cvs mailing list