[BioRuby-cvs] bioruby/lib/bio/appl blast.rb,1.33,1.34

Mitsuteru C. Nakao nakao at dev.open-bio.org
Wed Jan 30 17:43:36 UTC 2008


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

Modified Files:
	blast.rb 
Log Message:
* Fixed the bug at building the blastall command line options ('-m 0').


Index: blast.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast.rb,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** blast.rb	5 Apr 2007 23:35:39 -0000	1.33
--- blast.rb	30 Jan 2008 17:43:34 -0000	1.34
***************
*** 2,6 ****
  # = bio/appl/blast.rb - BLAST wrapper
  # 
! # Copyright::  Copyright (C) 2001       Mitsuteru C. Nakao <n at bioruby.org>
  # Copyright::  Copyright (C) 2002,2003  Toshiaki Katayama <k at bioruby.org>
  # Copyright::  Copyright (C) 2006       Jan Aerts <jan.aerts at bbsrc.ac.uk>
--- 2,6 ----
  # = bio/appl/blast.rb - BLAST wrapper
  # 
! # Copyright::  Copyright (C) 2001,2008  Mitsuteru C. Nakao <n at bioruby.org>
  # Copyright::  Copyright (C) 2002,2003  Toshiaki Katayama <k at bioruby.org>
  # Copyright::  Copyright (C) 2006       Jan Aerts <jan.aerts at bbsrc.ac.uk>
***************
*** 182,201 ****
        @output   = ''
        @parser   = nil
  
-       begin
-         a = opt.to_ary
-       rescue NameError #NoMethodError
-         # backward compatibility
-         a = Shellwords.shellwords(opt)
-       end
-       unless a.find { |x| /\A\-m/ =~ x.to_s } then
-         if defined?(XMLParser) or defined?(REXML)
-           @format = 7
-         else
-           @format = 8
-         end
-       end
-       @options = [ *a ]
-     end
  
      # This method submits a sequence to a BLAST factory, which performs the
--- 182,190 ----
        @output   = ''
        @parser   = nil
+       @format   = 0
+ 
+       set_options(opt)
+     end      
  
  
      # This method submits a sequence to a BLAST factory, which performs the
***************
*** 225,231 ****
      end
  
- 
      private
  
  
      def parse_result(data)
--- 214,239 ----
      end
  
      private
  
+     def set_options(opt = nil)
+       opt = @options unless opt
+       begin
+         a = opt.to_ary
+       rescue NameError #NoMethodError
+         # backward compatibility
+         a = Shellwords.shellwords(opt)
+       end
+       unless a.find { |x| /\A\-m/ =~ x.to_s } then
+         if defined?(XMLParser) or defined?(REXML)
+           @format = 7
+         else
+           @format = 8
+         end
+       else
+         @format = a[a.index('-m') + 1].to_i
+       end
+       @options = [ *a ]
+     end
+ 
  
      def parse_result(data)
***************
*** 234,244 ****
  
  
!     def exec_local(query)
        cmd = [ @blastall, '-p', @program, '-d', @db ]
!       cmd.concat([ '-M', @matrix ]) if @matrix
!       cmd.concat([ '-F', @filter ]) if @filter
!       cmd.concat([ '-m', @format.to_s ]) if @format
        cmd.concat(@options) if @options
  
        report = nil
  
--- 242,272 ----
  
  
!     def make_command_line
!       set_options
        cmd = [ @blastall, '-p', @program, '-d', @db ]
!       if @matrix
!         cmd.concat([ '-M', @matrix ]) 
!         i = @options.index('-M')
!         @options.delete_at(i)
!         @options.delete_at(i)
!       end
!       if @filter
!         cmd.concat([ '-F', @filter ]) 
!         i = @options.index('-F')
!         @options.delete_at(i)
!         @options.delete_at(i)
!       end
!       if @format
!         cmd.concat([ '-m', @format.to_s ])
!         i = @options.index('-m')
!         @options.delete_at(i)
!         @options.delete_at(i)
!       end
        cmd.concat(@options) if @options
+     end
+ 
  
+     def exec_local(query)
+       cmd = make_command_line
        report = nil
  
***************
*** 249,252 ****
--- 277,281 ----
      end
  
+ 
      def exec_genomenet_tab(query)
        @format = 8
***************
*** 254,257 ****
--- 283,287 ----
      end
  
+ 
      def exec_genomenet(query)
        host = "blast.genome.jp"




More information about the bioruby-cvs mailing list