[BioRuby-cvs] bioruby/lib/bio/db nbrf.rb,1.4,1.5

Naohisa Goto ngoto at pub.open-bio.org
Mon Oct 31 18:58:22 EST 2005


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

Modified Files:
	nbrf.rb 
Log Message:
changed document from RD to RDoc.


Index: nbrf.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/nbrf.rb,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** nbrf.rb	26 Sep 2005 13:00:06 -0000	1.4
--- nbrf.rb	31 Oct 2005 23:58:19 -0000	1.5
***************
*** 1,8 ****
  #
! # bio/db/nbrf.rb - NBRF/PIR format sequence data class
  #
! #   Copyright (C) 2001-2003 GOTO Naohisa <ngoto at gen-info.osaka-u.ac.jp>
! #   Copyright (C) 2001-2002 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
--- 1,10 ----
  #
! # = bio/db/nbrf.rb - NBRF/PIR format sequence data class
  #
! # Copyright:: Copyright (C) 2001-2003 GOTO Naohisa <ngoto at gen-info.osaka-u.ac.jp>
! #             Copyright (C) 2001-2002 KATAYAMA Toshiaki <k at bioruby.org>
! # Licence::   LGPL
  #
+ #--
  #  This library is free software; you can redistribute it and/or
  #  modify it under the terms of the GNU Lesser General Public
***************
*** 18,34 ****
  #  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$
  #
  
  require 'bio/db'
  require 'bio/sequence'
  
! module Bio
    class NBRF < DB
      # based on Bio::FastaFormat class
  
      DELIMITER	= RS = "*\n"
  
      def initialize(str)
        str = str.sub(/\A[\r\n]+/, '') # remove first void lines
--- 20,53 ----
  #  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$
  #
+ # Sequence data class for NBRF/PIR flatfile format.
+ #
+ # = References
+ #
+ # * http://pir.georgetown.edu/pirwww/otherinfo/doc/techbulletin.html
+ # * http://www.sander.embl-ebi.ac.uk/Services/webin/help/webin-align/align_format_help.html#pir
+ # * http://www.cmbi.kun.nl/bioinf/tools/crab_pir.html
+ #
  
  require 'bio/db'
  require 'bio/sequence'
  
! #  Sequence data class for NBRF/PIR flatfile format.
! module Bio #:nodoc:
    class NBRF < DB
+     #--
      # based on Bio::FastaFormat class
+     #++
  
+     # Delimiter of each entry. Bio::FlatFile uses it.
      DELIMITER	= RS = "*\n"
  
+     # Creates a new NBRF object. It stores the comment and sequence
+     # information from one entry of the NBRF/PIR format string.
+     # If the argument contains more than one
+     # entry, only the first entry is used.
      def initialize(str)
        str = str.sub(/\A[\r\n]+/, '') # remove first void lines
***************
*** 47,55 ****
        end
      end
-     attr_accessor :seq_type, :entry_id, :definition, :data
-     attr_reader :entry_overrun
  
      alias accession entry_id
  
      def entry
        @entry = ">#{@seq_type or 'XX'};#{@entry_id}\n#{definition}\n#{@data}*\n"
--- 66,92 ----
        end
      end
  
+     # Returns sequence type described in the entry.
+     #  P1 (protein), F1 (protein fragment)
+     #  DL (DNA linear), DC (DNA circular)
+     #  RL (DNA linear), RC (DNA circular)
+     #  N3 (tRNA), N1 (other functional RNA)
+     attr_accessor :seq_type
+ 
+     # Returns ID described in the entry.
+     attr_accessor :entry_id
      alias accession entry_id
  
+     # Returns the description line of the NBRF/PIR formatted data.
+     attr_accessor :definition
+ 
+     # sequence data of the entry (???)
+     attr_accessor :data
+ 
+     # piece of next entry. Bio::FlatFile uses it.
+     attr_reader :entry_overrun
+ 
+ 
+     # Returns the stored one entry as a NBRF/PIR format. (same as to_s)
      def entry
        @entry = ">#{@seq_type or 'XX'};#{@entry_id}\n#{definition}\n#{@data}*\n"
***************
*** 57,60 ****
--- 94,99 ----
      alias to_s entry
  
+     # Returns Bio::Sequence::AA, Bio::Sequence::NA, or Bio::Sequence,
+     # depending on sequence type.
      def seq_class
        case @seq_type
***************
*** 70,73 ****
--- 109,115 ----
      end
  
+     # Returns sequence data.
+     # Returns Bio::Sequence::NA, Bio::Sequence::AA or Bio::Sequence,
+     # according to the sequence type.
      def seq
        unless defined?(@seq)
***************
*** 77,84 ****
--- 119,130 ----
      end
  
+     # Returns sequence length.
      def length
        seq.length
      end
  
+     # Returens the nucleic acid sequence.
+     # If you call naseq for protein sequence, RuntimeError will be occurred.
+     # Use the method if you know whether the sequence is NA or AA.
      def naseq
        if seq.is_a?(Bio::Sequence::AA) then
***************
*** 91,98 ****
--- 137,151 ----
      end
        
+     # Returens the length of sequence.
+     # If you call nalen for protein sequence, RuntimeError will be occurred.
+     # Use the method if you know whether the sequence is NA or AA.
      def nalen
        naseq.length
      end
  
+     # Returens the protein (amino acids) sequence.
+     # If you call aaseq for nucleic acids sequence,
+     # RuntimeError will be occurred.
+     # Use the method if you know whether the sequence is NA or AA.
      def aaseq
        if seq.is_a?(Bio::Sequence::NA) then
***************
*** 105,113 ****
--- 158,175 ----
      end
  
+     # Returens the length of protein (amino acids) sequence.
+     # If you call aaseq for nucleic acids sequence,
+     # RuntimeError will be occurred.
+     # Use the method if you know whether the sequence is NA or AA.
      def aalen
        aaseq.length
      end
  
+     #--
      #class method
+     #++
+ 
+     # Creates a NBRF/PIR formatted text.
+     # Parameters can be omitted.
      def self.to_nbrf(hash)
        seq_type = hash[:seq_type]
***************
*** 134,218 ****
    end #class NBRF
  end #module Bio
- 
- =begin
- 
- = Bio::NBRF
- 
-  This is a sequence data class for NBRF/PIR flatfile format.
- 
-  http://pir.georgetown.edu/pirwww/otherinfo/doc/techbulletin.html
-  http://www.sander.embl-ebi.ac.uk/Services/webin/help/webin-align/align_format_help.html#pir
-  http://www.cmbi.kun.nl/bioinf/tools/crab_pir.html
- 
- The precedent '>' can be omitted and the trailing '>' will be removed
- automatically.
- 
- --- Bio::NBRF.new(entry)
- 
-       Stores the comment and sequence information from one entry of the
-       NBRF/PIR format string.  If the argument contains more than one
-       entry, only the first entry is used.
- 
- --- Bio::NBRF#entry
- 
-       Returns the stored one entry as a NBRF/PIR format. (same as to_s)
- 
- 
- --- Bio::NBRF#seq_type
- 
-       Returns sequence type described in the entry.
- 
-       * P1 (protein), F1 (protein fragment)
-       * DL (DNA linear), DC (DNA circular)
-       * RL (DNA linear), RC (DNA circular)
-       * N3 (tRNA), N1 (other functional RNA)
- 
- --- Bio::NBRF#seq_class
- 
-       Returns Bio::Sequence::AA, Bio::Sequence::NA, or Bio::Sequence,
-       depending on sequence type.
- 
- --- Bio::NBRF#entry_id
- 
-       Returns ID described in the entry.
- 
- --- Bio::NBRF#accession
- 
-       Same as Bio::NBRF#entry_id.
- 
- --- Bio::NBRF#definition
- 
-       Returns the description line of the NBRF/PIR formatted data.
- 
- --- Bio::NBRF#seq
- 
-       Returns a joined sequence line as a String.
-       Returns Bio::Sequence::NA, Bio::Sequence::AA or Bio::Sequence,
-       according to the sequence type.
- 
- --- Bio::NBRF#length
- 
-       Returns sequence length.
- 
- --- Bio::NBRF#naseq
- --- Bio::NBRF#nalen
- --- Bio::NBRF#aaseq
- --- Bio::NBRF#aalen
- 
-       If you know whether the sequence is NA or AA, use these methods.
-       'naseq' and 'aaseq' methods returen the Bio::Sequence::NA or
-       Bio::Sequence::AA object respectively. 'nalen' and 'aalen' methods
-       return the length of them.
- 
-       If you call naseq for protein sequence, or aaseq for nucleic sequence,
-       a RuntimeError will be occurred.
- 
- --- Bio::NBRF.to_nbrf(:seq_type=>'P1', :entry_id=>'XXX00000',
-                       :definition=>'xxx protein',
-                       :seq=>seq, :width=>70)
- 
-       Creates a NBRF/PIR formatted text.
-       Parameters can be omitted.
- 
- =end
  
--- 196,198 ----



More information about the bioruby-cvs mailing list