From 75cff1a83a64cd46e9dd603e02597a2bb6a76119 Mon Sep 17 00:00:00 2001
From: Pat Schloss <pschloss@umich.edu>
Date: Wed, 13 Mar 2013 08:00:33 -0400
Subject: [PATCH] Fixed a bug in the count output of seq.error when using
 multiple processors

---
 seqerrorcommand.cpp | 2 +-
 sequence.cpp        | 2 ++
 trimseqscommand.cpp | 6 ++++++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/seqerrorcommand.cpp b/seqerrorcommand.cpp
index ecd6f0c..99e7893 100644
--- a/seqerrorcommand.cpp
+++ b/seqerrorcommand.cpp
@@ -643,7 +643,7 @@ int SeqErrorCommand::createProcesses(string filename, string qFileName, string r
 			int misMatchSize;
 			in >> misMatchSize; m->gobble(in);
 			if (misMatchSize > misMatchCounts.size()) {	misMatchCounts.resize(misMatchSize, 0);	}
-			for (int j = 0; j < misMatchCounts.size(); j++) {
+			for (int j = 0; j < misMatchSize; j++) {
 				in >> tempNum; misMatchCounts[j] += tempNum;
 			}
 			m->gobble(in);
diff --git a/sequence.cpp b/sequence.cpp
index 224ecb1..4c631a2 100644
--- a/sequence.cpp
+++ b/sequence.cpp
@@ -772,6 +772,8 @@ void Sequence::trim(int length){
 	if(numBases > length){
 		unaligned = unaligned.substr(0,length);
 		numBases = length;
+        aligned = "";
+        isAligned = 0;
 	}
 	
 }
diff --git a/trimseqscommand.cpp b/trimseqscommand.cpp
index 935b9a9..ec136db 100644
--- a/trimseqscommand.cpp
+++ b/trimseqscommand.cpp
@@ -1854,7 +1854,13 @@ bool TrimSeqsCommand::keepFirstTrim(Sequence& sequence, QualityScores& qscores){
 		if(qscores.getName() != ""){
 			qscores.trimQScores(-1, keepFirst);
 		}
+
+//        sequence.printSequence(cout);cout << endl;
+        
 		sequence.trim(keepFirst);
+        
+//        sequence.printSequence(cout);cout << endl << endl;;
+
 		return success;
 	}
 	catch(exception& e) {
-- 
2.39.5