From 94ba64671398f3c9e591df90536833123de0fd34 Mon Sep 17 00:00:00 2001 From: pschloss Date: Fri, 20 Aug 2010 19:25:59 +0000 Subject: [PATCH] fixed filterseqscommand bug where trump wasn't being used --- filters.h | 8 ++++++++ filterseqscommand.cpp | 16 +++++++++++----- preclustercommand.cpp | 8 +++----- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/filters.h b/filters.h index 94f8d33..13607e7 100644 --- a/filters.h +++ b/filters.h @@ -46,6 +46,14 @@ public: if(a[i] < threshold && t[i] < threshold && g[i] < threshold && c[i] < threshold){ filter[i] = 0; } } } + + void mergeFilter(string newFilter){ + for(int i=0;imothurOut("Sequences are not all the same length, please correct."); m->mothurOutEndLine(); m->control_pressed = true; } - if(trump != '*'){ F.doTrump(seq); } - if(isTrue(vertical) || soft != 0){ F.getFreqs(seq); } + if(trump != '*') { F.doTrump(seq); } + if(isTrue(vertical) || soft != 0) { F.getFreqs(seq); } cout.flush(); count++; } @@ -876,12 +874,14 @@ int FilterSeqsCommand::createProcessesCreateFilter(Filters& F, string filename) openOutputFile(filename, out); out << num << endl; + out << F.getFilter() << endl; for (int k = 0; k < alignmentLength; k++) { out << F.a[k] << '\t'; } out << endl; for (int k = 0; k < alignmentLength; k++) { out << F.t[k] << '\t'; } out << endl; for (int k = 0; k < alignmentLength; k++) { out << F.g[k] << '\t'; } out << endl; for (int k = 0; k < alignmentLength; k++) { out << F.c[k] << '\t'; } out << endl; for (int k = 0; k < alignmentLength; k++) { out << F.gap[k] << '\t'; } out << endl; - + + cout << F.getFilter() << endl; out.close(); exit(0); @@ -901,7 +901,13 @@ int FilterSeqsCommand::createProcessesCreateFilter(Filters& F, string filename) openInputFile(tempFilename, in); int temp, tempNum; + string tempFilterString; + in >> tempNum; gobble(in); num += tempNum; + + in >> tempFilterString; + F.mergeFilter(tempFilterString); + for (int k = 0; k < alignmentLength; k++) { in >> temp; F.a[k] += temp; } gobble(in); for (int k = 0; k < alignmentLength; k++) { in >> temp; F.t[k] += temp; } gobble(in); for (int k = 0; k < alignmentLength; k++) { in >> temp; F.g[k] += temp; } gobble(in); diff --git a/preclustercommand.cpp b/preclustercommand.cpp index 2156477..cab2963 100644 --- a/preclustercommand.cpp +++ b/preclustercommand.cpp @@ -134,10 +134,9 @@ int PreClusterCommand::execute(){ //sort seqs by number of identical seqs alignSeqs.sort(comparePriority); - + int count = 0; int i = 0; - //think about running through twice... list::iterator itList; list::iterator itList2; @@ -153,14 +152,13 @@ int PreClusterCommand::execute(){ //are you within "diff" bases int mismatch = calcMisMatches((*itList).seq.getAligned(), (*itList2).seq.getAligned()); - + if (mismatch <= diffs) { //merge (*itList).names += ',' + (*itList2).names; (*itList).numIdentical += (*itList2).numIdentical; - alignSeqs.erase(itList2++); - + itList2 = alignSeqs.erase(itList2); //itList2--; count++; }else{ itList2++; } }else{ itList2++; } -- 2.39.2