[BioRuby-cvs] bioruby/lib/bio/db/genbank common.rb,1.9,1.10

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


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

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


Index: common.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/genbank/common.rb,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** common.rb	7 Dec 2005 11:23:51 -0000	1.9
--- common.rb	19 Sep 2006 05:57:20 -0000	1.10
***************
*** 1,22 ****
  #
! # bio/db/genbank/common.rb - Common methods for GenBank style database classes
! #
! #   Copyright (C) 2004 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/common.rb - Common methods for GenBank style database classes
  #
! # Copyright::  Copyright (C) 2004 Toshiaki Katayama <k at bioruby.org>
! # License::    Ruby's
  #
! # $Id$
  #
  
***************
*** 25,28 ****
--- 12,26 ----
  module Bio
  class NCBIDB
+ 
+ # == Description
+ # 
+ # This module defines a common framework among GenBank, GenPept, RefSeq, and
+ # DDBJ.  For more details, see the documentations in each genbank/*.rb files.
+ # 
+ # == References
+ # 
+ # * ftp://ftp.ncbi.nih.gov/genbank/gbrel.txt
+ # * http://www.ncbi.nlm.nih.gov/collab/FT/index.html
+ #
  module Common
  
***************
*** 34,40 ****
    end
  
!   # LOCUS  -- Locus class must be defined in child classes
  
!   # DEFINITION
    def definition
      field_fetch('DEFINITION')
--- 32,41 ----
    end
  
!   # LOCUS -- Locus class must be defined in child classes.
!   def locus
!     # must be overrided in each subclass
!   end
  
!   # DEFINITION -- Returns contents of the DEFINITION record as a String.
    def definition
      field_fetch('DEFINITION')
***************
*** 42,46 ****
  
  
!   # ACCESSION
    def accessions
      accession.split(/\s+/)
--- 43,47 ----
  
  
!   # ACCESSION -- Returns contents of the ACCESSION record as an Array.
    def accessions
      accession.split(/\s+/)
***************
*** 48,68 ****
  
  
!   # VERSION
    def versions
      @data['VERSION'] ||= fetch('VERSION').split(/\s+/)
    end
  
    def acc_version
      versions.first.to_s
    end
  
    def accession
      acc_version.split(/\./).first.to_s
    end
  
    def version
      acc_version.split(/\./).last.to_i
    end
  
    def gi
      versions.last
--- 49,73 ----
  
  
!   # VERSION -- Returns contents of the VERSION record as an Array of Strings.
    def versions
      @data['VERSION'] ||= fetch('VERSION').split(/\s+/)
    end
  
+   # Returns the first part of the VERSION record as "ACCESSION.VERSION" String.
    def acc_version
      versions.first.to_s
    end
  
+   # Returns the ACCESSION part of the acc_version.
    def accession
      acc_version.split(/\./).first.to_s
    end
  
+   # Returns the VERSION part of the acc_version as a Fixnum
    def version
      acc_version.split(/\./).last.to_i
    end
  
+   # Returns the second part of the VERSION record as a "GI:#######" String.
    def gi
      versions.last
***************
*** 70,74 ****
  
  
!   # NID
    def nid
      field_fetch('NID')
--- 75,79 ----
  
  
!   # NID -- Returns contents of the NID record as a String.
    def nid
      field_fetch('NID')
***************
*** 76,80 ****
  
  
!   # KEYWORDS
    def keywords
      @data['KEYWORDS'] ||= fetch('KEYWORDS').chomp('.').split(/; /)
--- 81,85 ----
  
  
!   # KEYWORDS -- Returns contents of the KEYWORDS record as an Array of Strings.
    def keywords
      @data['KEYWORDS'] ||= fetch('KEYWORDS').chomp('.').split(/; /)
***************
*** 82,86 ****
  
  
!   # SEGMENT
    def segment
      @data['SEGMENT'] ||= fetch('SEGMENT').scan(/\d+/).join("/")
--- 87,91 ----
  
  
!   # SEGMENT -- Returns contents of the SEGMENT record as a "m/n" form String.
    def segment
      @data['SEGMENT'] ||= fetch('SEGMENT').scan(/\d+/).join("/")
***************
*** 88,92 ****
  
  
!   # SOURCE
    def source
      unless @data['SOURCE']
--- 93,97 ----
  
  
!   # SOURCE -- Returns contents of the SOURCE record as a Hash.
    def source
      unless @data['SOURCE']
***************
*** 127,131 ****
  
  
!   # REFERENCE
    def references
      unless @data['REFERENCE']
--- 132,137 ----
  
  
!   # REFERENCE -- Returns contents of the REFERENCE records as an Array of
!   # Bio::Reference objects.
    def references
      unless @data['REFERENCE']
***************
*** 174,178 ****
  
  
!   # COMMENT
    def comment
      field_fetch('COMMENT')
--- 180,184 ----
  
  
!   # COMMENT -- Returns contents of the COMMENT record as a String.
    def comment
      field_fetch('COMMENT')
***************
*** 180,184 ****
  
  
!   # FEATURES
    def features
      unless @data['FEATURES']
--- 186,191 ----
  
  
!   # FEATURES -- Returns contents of the FEATURES record as a Bio::Features
!   # object.
    def features
      unless @data['FEATURES']
***************
*** 234,238 ****
  
  
!   # ORIGIN
    def origin
      unless @data['ORIGIN']
--- 241,245 ----
  
  
!   # ORIGIN -- Returns contents of the ORIGIN record as a String.
    def origin
      unless @data['ORIGIN']
***************
*** 277,299 ****
  
  end # Common 
  end # GenBank
  end # Bio
  
  
- =begin
- 
- = Bio::GenBank::Common
- 
- This module defines a common framework among GenBank, GenPept, RefSeq, and
- DDBJ.  For more details, see the documentations in each genbank/*.rb files.
- 
- 
- == SEE ALSO
- 
- * ((<URL:ftp://ftp.ncbi.nih.gov/genbank/gbrel.txt>))
- * ((<URL:http://www.ncbi.nlm.nih.gov/collab/FT/index.html>))
- 
- =end
- 
- 
- 
--- 284,290 ----
  
  end # Common 
+ 
  end # GenBank
  end # Bio
  
  




More information about the bioruby-cvs mailing list