[BioRuby-cvs] bioruby/lib/bio/appl blast.rb,1.23,1.24

Naohisa Goto ngoto at pub.open-bio.org
Fri Sep 9 11:15:53 EDT 2005


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

Modified Files:
	blast.rb 
Log Message:
* moved Bio::Blast.reports method from blast/report.rb to blast.rb for autoload.
* added "require 'bio/appl/blast'" in blast/report.rb.


Index: blast.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast.rb,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** blast.rb	9 Sep 2005 14:59:53 -0000	1.23
--- blast.rb	9 Sep 2005 15:15:51 -0000	1.24
***************
*** 27,32 ****
  require 'shellwords'
  
- require 'bio/appl/blast/report' # for Bio::Blast.reports method
- 
  module Bio
  
--- 27,30 ----
***************
*** 34,39 ****
  
      autoload :Fastacmd,     'bio/io/fastacmd'
!     #autoload :Report,       'bio/appl/blast/report'
!     ## cannot autoload report.rb because of Bio::Blast.reports method
      autoload :Default,      'bio/appl/blast/format0'
      autoload :WU,           'bio/appl/blast/wublast'
--- 32,36 ----
  
      autoload :Fastacmd,     'bio/io/fastacmd'
!     autoload :Report,       'bio/appl/blast/report'
      autoload :Default,      'bio/appl/blast/format0'
      autoload :WU,           'bio/appl/blast/wublast'
***************
*** 92,95 ****
--- 89,108 ----
        # backward compatibility
        @options = Shellwords.shellwords(str)
+     end
+ 
+     # the method Bio::Blast.report is moved from bio/appl/blast/report.rb.
+     # only for xml format
+     def self.reports(input, parser = nil)
+       ary = []
+       input.each("</BlastOutput>\n") do |xml|
+         xml.sub!(/[^<]*(<?)/, '\1')		# skip before <?xml> tag
+         next if xml.empty?			# skip trailing no hits
+         if block_given?
+           yield Report.new(xml, parser)
+         else
+           ary << Report.new(xml, parser)
+         end
+       end
+       return ary
      end
  



More information about the bioruby-cvs mailing list