[BioRuby-cvs] bioruby/lib/bio/appl hmmer.rb,1.4,1.5

Mitsuteru C. Nakao nakao at pub.open-bio.org
Thu Feb 2 17:08:38 UTC 2006


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

Modified Files:
	hmmer.rb 
Log Message:
* Updated RDoc.


Index: hmmer.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/hmmer.rb,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** hmmer.rb	26 Sep 2005 13:00:04 -0000	1.4
--- hmmer.rb	2 Feb 2006 17:08:36 -0000	1.5
***************
*** 1,6 ****
  #
! # bio/appl/hmmer.rb - HMMER wrapper
  # 
! #   Copyright (C) 2002 KATAYAMA Toshiaki <k at bioruby.org>
  #
  #  This library is free software; you can redistribute it and/or
--- 1,31 ----
  #
! # = bio/appl/hmmer.rb - HMMER wrapper
  # 
! # Copyright::   Copyright (C) 2002 
! #               KATAYAMA Toshiaki <k at bioruby.org>
! # Lisence::     LGPL
! #
! # $Id$
! #
! # == Description
! #
! # A wrapper for the HMMER programs (hmmsearch or hmmpfam).
! #
! # == Examples
! #
! #   require 'bio'
! #   program = 'hmmsearch' # or 'hmmpfam'
! #   hmmfile = 'test.hmm'
! #   seqfile = 'test.faa'
! #   
! #   factory = Bio::HMMER.new(program, hmmfile, seqfile)
! #   p factory.query
! #
! # == References
! #
! # * HMMER
! #   http://hmmer.wustl.edu/
! #
! #--
  #
  #  This library is free software; you can redistribute it and/or
***************
*** 18,22 ****
  #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  #
! #  $Id$
  #
  
--- 43,47 ----
  #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  #
! #++
  #
  
***************
*** 26,82 ****
  module Bio
  
!   class HMMER
! 
!     autoload :Report, 'bio/appl/hmmer/report'
  
!     include Bio::Command::Tools
  
!     def initialize(program, hmmfile, seqfile, opt = [])
!       @program	= program
!       @hmmfile	= hmmfile
!       @seqfile	= seqfile
!       @output	= ''
  
!       begin
!         @options = opt.to_ary
!       rescue NameError #NoMethodError
!         # backward compatibility
!         @options = Shellwords.shellwords(opt)
!       end
!     end
!     attr_accessor :program, :hmmfile, :seqfile, :options
!     attr_reader :output
  
!     def option
        # backward compatibility
!       make_command_line(@options)
      end
  
-     def option=(str)
-       # backward compatibility
-       @options = Shellwords.shellwords(str)
-     end
  
!     def query
!       cmd = [ @program, *@options ]
!       cmd.concat([ @hmmfile, @seqfile ])
!       
!       report = nil
  
-       @output = call_command_local(cmd, nil)
-       report = parse_result(@output)
-       
-       return report
-     end
  
  
-     private
  
!     def parse_result(data)
!       Report.new(data)
!     end
  
    end
! end
  
  
--- 51,150 ----
  module Bio
  
! # A wapper for HMMER programs (hmmsearch or hmmpfam).
! #
! # === Examples
! #
! #   require 'bio'
! #   program = 'hmmsearch' # or 'hmmpfam'
! #   hmmfile = 'test.hmm'
! #   seqfile = 'test.faa'
! #   
! #   factory = Bio::HMMER.new(program, hmmfile, seqfile)
! #   report = factory.query
! #   report.class #=> Bio::HMMER::Report
! #
! # === References
! #
! # * HMMER
! #   http://hmmer.wustl.edu/
! #
! class HMMER
  
!   autoload :Report, 'bio/appl/hmmer/report'
  
!   include Bio::Command::Tools
  
!   # Prgrams name. (hmmsearch or hmmpfam).
!   attr_accessor :program
!   
!   # Name of hmmfile.
!   attr_accessor :hmmfile
!   
!   # Name of seqfile.
!   attr_accessor :seqfile
!   
!   #  Command line options.
!   attr_accessor :options
!   
!   # Shows the raw output from the hmmer search.
!   attr_reader :output
  
!   # Sets a program name, a profile hmm file name, a query sequence file name 
!   # and options in string.
!   # 
!   # Program names: hmmsearch, hmmpfam
!   #
!   def initialize(program, hmmfile, seqfile, options = [])
!     @program = program
!     @hmmfile = hmmfile
!     @seqfile = seqfile
!     @output  = ''
!     
!     begin
!       @options = opt.to_ary
!     rescue NameError #NoMethodError
        # backward compatibility
!       @options = Shellwords.shellwords(options)
      end
+   end
  
  
!   # Gets options by String.
!   # backward compatibility.
!   def option
!     make_command_line(@options)
!   end
  
  
+   # Sets options by String.
+   # backward compatibility.
+   def option=(str)
+     @options = Shellwords.shellwords(str)
+   end
  
  
!   # Executes the hmmer search and returns the report 
!   # (Bio::HMMER::Report object).
!   def query
!     cmd = [ @program, *@options ]
!     cmd.concat([ @hmmfile, @seqfile ])
!       
!     report = nil
!     
!     @output = call_command_local(cmd, nil)
!     report = parse_result(@output)
!       
!     return report
!   end
  
+   private
+   
+   def parse_result(data)
+     Report.new(data)
    end
! 
! end # class HMMER
! 
! end # module Bio
  
  
***************
*** 84,129 ****
  if __FILE__ == $0
  
!   begin
!     require 'pp'
!     alias p pp
!   rescue
!   end
  
!   program = ARGV.shift	# hmmsearch, hmmpfam
    hmmfile = ARGV.shift
    seqfile = ARGV.shift
  
    factory = Bio::HMMER.new(program, hmmfile, seqfile)
!   p factory.query
  
  end
- 
- 
- =begin
- 
- = Bio::HMMER
- 
- --- Bio::HMMER.new(program, hmmfile, seqfile, option = '')
- --- Bio::HMMER#program
- --- Bio::HMMER#hmmfile
- --- Bio::HMMER#seqfile
- --- Bio::HMMER#options
- 
-       Accessors for the factory.
- 
- --- Bio::HMMER#option
- --- Bio::HMMER#option=(str)
- 
-       Get/set options by string.
- 
- --- Bio::HMMER#query
- 
-       Executes the hmmer search and returns Report object (Bio::HMMER::Report).
- 
- --- Bio::HMMER#output
- 
-       Shows the raw output from hmmer search.
- 
- =end
- 
- 
--- 152,163 ----
  if __FILE__ == $0
  
!   require 'pp'
  
!   program = ARGV.shift # hmmsearch, hmmpfam
    hmmfile = ARGV.shift
    seqfile = ARGV.shift
  
    factory = Bio::HMMER.new(program, hmmfile, seqfile)
!   pp factory.query
  
  end




More information about the bioruby-cvs mailing list