Skip to content

Commit

Permalink
Nokogiri XPath bug fix.
Browse files Browse the repository at this point in the history
* Added .to_s to xpath method calls in #Bio::Blast::XPath.field to prevent
  gaps undefined method error when parsing Hsps.
  • Loading branch information
Ken Seal committed Aug 8, 2012
1 parent 2642e84 commit a3bfbe9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/bio/db/blast/parser/nokogiri.rb
Expand Up @@ -8,9 +8,9 @@ module Blast
module XPath
def field name
res = if @prefix
@xml.xpath(@prefix+name+'/text()')
@xml.xpath(@prefix+name+'/text()').to_s
else
@xml.xpath(name+'/text()')
@xml.xpath(name+'/text()').to_s
end
if res == nil
logger = Bio::Log::LoggerPlus['bio-blastxmlparser']
Expand Down
1 change: 1 addition & 0 deletions spec/bio-blastxmlparser_spec.rb
Expand Up @@ -43,6 +43,7 @@
hsp.identity.should == 73
hsp.positive.should == 73
hsp.align_len.should == 73
hsp.gaps.should == 0
hsp.qseq.should == "AGTGAAGCTTCTAGATATTTGGCGGGTACCTCTAATTTTGCCTGCCTGCCAACCTATATGCTCCTGTGTTTAG"
hsp.hseq.should == "AGTGAAGCTTCTAGATATTTGGCGGGTACCTCTAATTTTGCCTGCCTGCCAACCTATATGCTCCTGTGTTTAG"
hsp.midline.should == "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
Expand Down
1 change: 1 addition & 0 deletions test/data/nt_example_blastn.m7
Expand Up @@ -46,6 +46,7 @@
<Hsp_identity>73</Hsp_identity>
<Hsp_positive>73</Hsp_positive>
<Hsp_align-len>73</Hsp_align-len>
<Hsp_gaps>0</Hsp_gaps>
<Hsp_qseq>AGTGAAGCTTCTAGATATTTGGCGGGTACCTCTAATTTTGCCTGCCTGCCAACCTATATGCTCCTGTGTTTAG</Hsp_qseq>
<Hsp_hseq>AGTGAAGCTTCTAGATATTTGGCGGGTACCTCTAATTTTGCCTGCCTGCCAACCTATATGCTCCTGTGTTTAG</Hsp_hseq>
<Hsp_midline>|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||</Hsp_midline>
Expand Down

0 comments on commit a3bfbe9

Please sign in to comment.