[BioRuby-cvs] bioruby/lib/bio/appl/blast rexml.rb, 1.12, 1.13 xmlparser.rb, 1.17, 1.18

Naohisa Goto ngoto at dev.open-bio.org
Mon May 12 13:11:47 UTC 2008


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

Modified Files:
	rexml.rb xmlparser.rb 
Log Message:
 * lib/bio/appl/blast/xmlparser.rb, lib/bio/appl/blast/rexml.rb
   Bug fix: unit test sometime fails due to improper treatment of some
   Blast parameters and difference between rexml and xmlparser.
   To fix the bug, types of some parameters may be changed, e.g.
   Bio::Blast::Report#expect is changed to return Float or nil.
 * ChangeLog
   ChangeLog for today's changes to lib/bio/appl/blast/* and related files.  


Index: xmlparser.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/xmlparser.rb,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** xmlparser.rb	5 Apr 2007 23:35:39 -0000	1.17
--- xmlparser.rb	12 May 2008 13:11:45 -0000	1.18
***************
*** 116,139 ****
      end
  
!     def xmlparser_parse_parameters(hash)
!       labels = { 
!         'matrix'       => 'Parameters_matrix',
!         'expect'       => 'Parameters_expect',
!         'include'      => 'Parameters_include',
!         'sc-match'     => 'Parameters_sc-match',
!         'sc-mismatch'  => 'Parameters_sc-mismatch',
!         'gap-open'     => 'Parameters_gap-open',
!         'gap-extend'   => 'Parameters_gap-extend',
!         'filter'       => 'Parameters_filter',
!         'pattern'      => 'Parameters_pattern',
!         'entrez-query' => 'Parameters_entrez-query',
!       }
!       labels.each do |k,v|
          case k
!         when 'filter', 'matrix'
!           @parameters[k] = hash[v].to_s
          else
!           @parameters[k] = hash[v].to_i
          end
        end
      end
--- 116,148 ----
      end
  
!     # set parameter of the key as val
!     def xml_set_parameter(key, val)
!       #labels = { 
!       #  'matrix'       => 'Parameters_matrix',
!       #  'expect'       => 'Parameters_expect',
!       #  'include'      => 'Parameters_include',
!       #  'sc-match'     => 'Parameters_sc-match',
!       #  'sc-mismatch'  => 'Parameters_sc-mismatch',
!       #  'gap-open'     => 'Parameters_gap-open',
!       #  'gap-extend'   => 'Parameters_gap-extend',
!       #  'filter'       => 'Parameters_filter',
!       #  'pattern'      => 'Parameters_pattern',
!       #  'entrez-query' => 'Parameters_entrez-query',
!       #}
!       k = key.sub(/\AParameters\_/, '')
!       @parameters[k] =
          case k
!         when 'expect', 'include'
!           val.to_f
!         when /\Agap\-/, /\Asc\-/
!           val.to_i
          else
!           val
          end
+     end
+ 
+     def xmlparser_parse_parameters(hash)
+       hash.each do |k, v|
+         xml_set_parameter(k, v)
        end
      end

Index: rexml.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/rexml.rb,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** rexml.rb	5 Apr 2007 23:35:39 -0000	1.12
--- rexml.rb	12 May 2008 13:11:45 -0000	1.13
***************
*** 38,44 ****
            when 'BlastOutput_param'
              e.elements["Parameters"].each_element_with_text do |p|
!               k = p.name.sub(/Parameters_/, '')
!               v = p.text =~ /\D/ ? p.text : p.text.to_i
!               @parameters[k] = v
              end
            else
--- 38,42 ----
            when 'BlastOutput_param'
              e.elements["Parameters"].each_element_with_text do |p|
!               xml_set_parameter(p.name, p.text)
              end
            else




More information about the bioruby-cvs mailing list