From: martinahansen Date: Thu, 16 Aug 2012 11:19:00 +0000 (+0000) Subject: did something to findsim.rb X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c58e66381a1cff15aec561fb65f61b3d796230d7;p=biopieces.git did something to findsim.rb git-svn-id: http://biopieces.googlecode.com/svn/trunk@1898 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/code_ruby/lib/maasha/findsim.rb b/code_ruby/lib/maasha/findsim.rb index 7e5d100..360bd9c 100644 --- a/code_ruby/lib/maasha/findsim.rb +++ b/code_ruby/lib/maasha/findsim.rb @@ -149,6 +149,8 @@ class FindSim max = hit_ary_size end + best_score = 0 + (0 ... max).each do |i| q_index, s_index, score = hit_ary[BYTES_IN_HIT * i ... BYTES_IN_HIT * i + BYTES_IN_HIT].unpack("IIF") @@ -160,11 +162,10 @@ class FindSim score = new_score if new_score > score end - best_score = 0 - if @opt_hash[:max_diversity] best_score = score if i == 0 - break if best_score - score > @opt_hash[:max_diversity] + + break if best_score - score > (@opt_hash[:max_diversity] / 100) end yield Hit.new(q_id, s_id, score)