From: martinahansen Date: Mon, 2 May 2011 13:59:01 +0000 (+0000) Subject: code update X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c5afda176fb53471e07831dc79dda50cc803acce;p=biopieces.git code update git-svn-id: http://biopieces.googlecode.com/svn/trunk@1354 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/bp_bin/plot_scores b/bp_bin/plot_scores index af37cc2..9557095 100755 --- a/bp_bin/plot_scores +++ b/bp_bin/plot_scores @@ -20,14 +20,6 @@ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -# This program is part of the Biopieces framework (www.biopieces.org). - -use warnings; -use strict; -use Maasha::Biopieces; -use Maasha::Fastq; -use Maasha::Plot; - # Plot a histogram of mean sequence quality scores. # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< diff --git a/code_ruby/Maasha/lib/patternmatcher.rb b/code_ruby/Maasha/lib/patternmatcher.rb index 6d9db38..19a0250 100644 --- a/code_ruby/Maasha/lib/patternmatcher.rb +++ b/code_ruby/Maasha/lib/patternmatcher.rb @@ -139,28 +139,31 @@ module PatternMatcher # Method to update the score vector. def vector_update - new_vector = @vector.dup + new_vector = [] + new_vector[0] = Score.new (0 ... @pattern.length).each do |i| + score_diag = @vector[i] + score_up = new_vector[i] # insertion + score_left = @vector[i + 1] # deletion + if match?(@seq[@pos], @pattern[i]) - new_vector[i + 1] = @vector[i].dup - new_vector[i + 1].matches += 1 + new_score = score_diag.dup + new_score.matches += 1 else - mismatch = @vector[i].dup - insertion = new_vector[i].dup - deletion = @vector[i + 1].dup - - if deletion?(mismatch, insertion, deletion) - deletion.deletions += 1 - new_vector[i + 1] = deletion - elsif mismatch?(mismatch, insertion, deletion) - mismatch.mismatches += 1 - new_vector[i + 1] = mismatch - elsif insertion?(mismatch, insertion, deletion) - insertion.insertions += 1 - new_vector[i + 1] = insertion + if deletion?(score_diag, score_up, score_left) + new_score = score_left.dup + new_score.deletions += 1 + elsif mismatch?(score_diag, score_up, score_left) + new_score = score_diag.dup + new_score.mismatches += 1 + elsif insertion?(score_diag, score_up, score_left) + new_score = score_up.dup + new_score.insertions += 1 end end + + new_vector[i + 1] = new_score end @vector = new_vector