[BioRuby-cvs] bioruby/lib/bio/appl mafft.rb,1.6,1.7

Naohisa Goto ngoto at pub.open-bio.org
Mon Oct 31 08:17:20 EST 2005


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

Modified Files:
	mafft.rb 
Log Message:
changed document format form RD to RDoc.
added references to the document.
added MAFFT version 5 information.


Index: mafft.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/mafft.rb,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** mafft.rb	9 Sep 2005 15:56:20 -0000	1.6
--- mafft.rb	31 Oct 2005 13:17:18 -0000	1.7
***************
*** 1,7 ****
  #
! # bio/appl/mafft.rb - MAFFT wrapper class
  #
! #   Copyright (C) 2003 GOTO Naohisa <ngoto at gen-info.osaka-u.ac.jp>
  #
  #  This library is free software; you can redistribute it and/or
  #  modify it under the terms of the GNU Lesser General Public
--- 1,9 ----
  #
! # = bio/appl/mafft.rb - MAFFT wrapper class
  #
! # Copyright:: Copyright (C) 2003 GOTO Naohisa <ngoto at gen-info.osaka-u.ac.jp>
! # Licence::   LGPL
  #
+ #--
  #  This library is free software; you can redistribute it and/or
  #  modify it under the terms of the GNU Lesser General Public
***************
*** 17,35 ****
  #  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/fasta'
  require 'bio/io/flatfile'
  
  # We use Open3.popen3, because MAFFT on win32 requires Cygwin.
  require 'open3'
  
! module Bio
    class MAFFT
  
      autoload :Report,       'bio/appl/mafft/report'
  
      def self.fftns(n = nil)
        opt = []
--- 19,65 ----
  #  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$
  #
+ # Bio::MAFFT is a wrapper class to execute MAFFT.
+ # MAFFT is a very fast multiple sequence alignment software.
+ #
+ # = Important Notes
+ #
+ # Though Bio::MAFFT class currently supports only MAFFT version 3,
+ # you can use MAFFT version 5 because the class is a wrapper class.
+ #
+ # == References
+ #
+ # * K. Katoh, K. Misawa, K. Kuma and T. Miyata.
+ #   MAFFT: a novel method for rapid multiple sequence alignment based
+ #   on fast Fourier transform. Nucleic Acids Res. 30: 3059-3066, 2002.
+ #   http://nar.oupjournals.org/cgi/content/abstract/30/14/3059
+ # * http://www.biophys.kyoto-u.ac.jp/~katoh/programs/align/mafft/
+ #
  
  require 'bio/db/fasta'
  require 'bio/io/flatfile'
  
+ #--
  # We use Open3.popen3, because MAFFT on win32 requires Cygwin.
+ #++
  require 'open3'
  
! module Bio #:nodoc:
! 
!   # Bio::MAFFT is a wrapper class to execute MAFFT.
!   # MAFFT is a very fast multiple sequence alignment software.
!   #
!   # Though Bio::MAFFT class currently supports only MAFFT version 3,
!   # you can use MAFFT version 5 because the class is a wrapper class.
    class MAFFT
  
      autoload :Report,       'bio/appl/mafft/report'
  
+     # Creates a new alignment factory.
+     # When +n+ is a number (1,2,3, ...), performs 'fftns n'.
+     # When +n+ is :i or 'i', performs 'fftnsi'.
      def self.fftns(n = nil)
        opt = []
***************
*** 42,49 ****
--- 72,85 ----
      end
  
+     # Creates a new alignment factory.
+     # Performs 'fftnsi'.
      def self.fftnsi
        self.new2(nil, 'fftnsi')
      end
  
+     # Creates a new alignment factory.
+     # When +n+ is a number (1,2,3, ...), performs 'nwns n'.
+     # When +n+ is :i or 'i', performs 'nwnsi'.
+     # In both case, if all_positive is true, add option '--all-positive'.
      def self.nwns(n = nil, ap = nil)
        opt = []
***************
*** 57,70 ****
      end
  
!     def self.nwnsi(ap = nil)
        opt = []
!       opt << '--all-positive' if ap
        self.new2(nil, 'nwnsi', *opt)
      end
  
      def self.nwap(n = nil)
        self.nwns(n, true)
      end
  
      def self.new2(dir, prog, *opt)
        if dir then
--- 93,116 ----
      end
  
!     # Creates a new alignment factory.
!     # Performs 'nwnsi'.
!     # If +all_positive+ is true, add option '--all-positive'.
!     def self.nwnsi(all_positive = nil)
        opt = []
!       opt << '--all-positive' if all_positive
        self.new2(nil, 'nwnsi', *opt)
      end
  
+     # Creates a new alignment factory.
+     # Performs 'nwns --all-positive n' or 'nwnsi --all-positive'.
+     # Same as Bio::MAFFT.nwap(n, true).
      def self.nwap(n = nil)
        self.nwns(n, true)
      end
  
+     # Creates a new alignment factory.
+     # +dir+ is the path of the MAFFT program.
+     # +prog+ is the name of the program.
+     # +opt+ is options of the program.
      def self.new2(dir, prog, *opt)
        if dir then
***************
*** 74,77 ****
--- 120,126 ----
      end
  
+     # Creates a new alignment factory.
+     # +program+ is the name of the program.
+     # +opt+ is options of the program.
      def initialize(program, option)
        @program = program
***************
*** 82,89 ****
        @log = nil
      end
!     attr_accessor :program, :option
!     attr_reader :command, :log
!     attr_reader :output, :report
!     
      def query(seqs)
        if seqs then
--- 131,162 ----
        @log = nil
      end
! 
!     # program name
!     attr_accessor :program
! 
!     # options
!     attr_accessor :option
! 
!     # Shows last command-line string. Returns nil or an array of String.
!     # Note that filenames described in the command-line may already
!     # be removed because they are temporary files.
!     attr_reader :command
! 
!     # last message to STDERR when executing the program.
!     attr_reader :log
! 
!     # Shows latest raw alignment result.
!     # Since a result of MAFFT is simply a multiple-fasta format,
!     # it returns an array of Bio::FastaFormat instances
!     # instead of raw string.
!     attr_reader :output
! 
!     # Shows last alignment result (instance of Bio::MAFFT::Report class)
!     # performed by the factory.
!     attr_reader :report
! 
!     # Executes the program.
!     # If +seqs+ is not nil, perform alignment for seqs.
!     # If +seqs+ is nil, simply executes the program.
      def query(seqs)
        if seqs then
***************
*** 94,99 ****
      end
  
      def query_align(seqs, *arg)
-       # seqs should be Bio::Alignment or Array of sequences or nil
        unless seqs.is_a?(Bio::Alignment)
          seqs = Bio::Alignment.new(seqs, *arg)
--- 167,173 ----
      end
  
+     # Performs alignment for seqs.
+     # +seqs+ should be Bio::Alignment or Array of sequences or nil.
      def query_align(seqs, *arg)
        unless seqs.is_a?(Bio::Alignment)
          seqs = Bio::Alignment.new(seqs, *arg)
***************
*** 102,105 ****
--- 176,181 ----
      end
  
+     # Performs alignment for +str+.
+     # Str should be a string that can be recognized by the program.
      def query_string(str, *arg)
        begin
***************
*** 114,117 ****
--- 190,194 ----
      end
  
+     # Performs alignment of sequences in the file named +fn+.
      def query_by_filename(fn, seqtype = nil)
        opt = @option + [ fn ]
***************
*** 122,125 ****
--- 199,203 ----
  
      private
+     # Executes a program in the local machine.
      def exec_local(opt)
        @command = [ @program, *opt ]
***************
*** 143,234 ****
  end #module Bio
  
- 
- =begin
- 
- = Bio::MAFFT
- 
-  Bio::MAFFT is a wrapper class of MAFFT, multiple sequence alignment software.
-  ((<URL:http://www.biophys.kyoto-u.ac.jp/~katoh/programs/align/mafft/>))
- 
- --- Bio::MAFFT.fftns(n = nil)
- 
-       Create new alignment factory.
-       When n is a number (1,2,3, ...), performs 'fftns n'.
-       When n is :i or 'i', performs 'fftnsi'.
- 
- --- Bio::MAFFT.fftnsi
- 
-       Create new alignment factory.
-       Performs 'fftnsi'.
- 
- --- Bio::MAFFT.nwns(n = nil, all_positive = nil)
- 
-       Create new alignment factory.
-       When n is a number (1,2,3, ...), performs 'nwns n'.
-       When n is :i or 'i', performs 'nwnsi'.
-       In both case, if all_positive is true, add option '--all-positive'.
- 
- --- Bio::MAFFT.nwnsi(all_positive = true)
- 
-       Create new alignment factory.
-       Performs 'nwnsi'.
-       If all_positive is true, add option '--all-positive'.
- 
- --- Bio::MAFFT.nwap(n = nil)
- 
-       Create new alignment factory.
-       Performs 'nwns --all-positive n' or 'nwnsi --all-positive'.
-       Same as Bio::MAFFT.nwap(n, true).
- 
- --- Bio::MAFFT.new(program, option)
- 
-       Creates new alignment factory.
- 
- --- Bio::MAFFT#program
- --- Bio::MAFFT#option
- 
-       Access to the variables specified in initialize.
- 
- --- Bio::MAFFT#query(seqs)
- 
-       Executes the program(clustalw).
-       If 'seqs' is not nil, perform alignment for seqs.
-       If 'seqs' is nil, simply executes the program.
- 
- --- Bio::MAFFT#query_align(seqs)
- 
-       Performs alignment for seqs.
- 
- --- Bio::MAFFT#query_string(str)
- 
-       Performs alignment for str.
-       Str should be a string that can be recognized by the program.
- 
- --- Bio::MAFFT#query_by_filename(filename)
- 
-       Performs alignment of sequences in the file named filename.
- 
- --- Bio::MAFFT#command
- 
-       Shows latest command-line executed by this factory.
-       Note that filenames described in the command-line may already
-       be removed because they are temporary files.
-       Returns an array of string.
- 
- --- Bio::MAFFT#log
- 
-       Shows latest messages of execution.
- 
- --- Bio::MAFFT#report
- 
-       Shows latest alignment result (instance of Bio::MAFFT::Report class)
-       performed by this factory.
- 
- --- Bio::MAFFT#output
- 
-       Shows latest raw alignment result.
-       Since a result of MAFFT is simply a multiple-fasta format,
-       it returns an array of Bio::FastaFormat instances
-       instead of raw string.
- 
- =end
--- 221,222 ----



More information about the bioruby-cvs mailing list