]> git.donarmstrong.com Git - mothur.git/commitdiff
fixed filterseqscommand bug where trump wasn't being used
authorpschloss <pschloss>
Fri, 20 Aug 2010 19:25:59 +0000 (19:25 +0000)
committerpschloss <pschloss>
Fri, 20 Aug 2010 19:25:59 +0000 (19:25 +0000)
filters.h
filterseqscommand.cpp
preclustercommand.cpp

index 94f8d33c0329793f3e1c39c0ea0c467f53493357..13607e78045a35a9a3ac00c675ba6c0b46995f42 100644 (file)
--- 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;i<alignmentLength;i++){
+                       if(newFilter[i] == '0'){
+                               filter[i] = 0;
+                       }
+               }
+       }
        
        void doVertical() {
 
index 1ebac0eba5a7e7fc54d85b24dc705c0f8a8314b5..f3b543c7636af24e333dcf301d897fa86beb9746 100644 (file)
@@ -728,10 +728,8 @@ string FilterSeqsCommand::createFilter() {
                if (pid == 0) { //only one process should output the filter
 #endif
                F.setNumSeqs(numSeqs);
-                               
                if(isTrue(vertical) == 1)       {       F.doVertical(); }
                if(soft != 0)                           {       F.doSoft();             }
-                       
                filterString = F.getFilter();
                
 #ifdef USE_MPI
@@ -781,8 +779,8 @@ int FilterSeqsCommand::driverCreateFilter(Filters& F, string filename, linePair*
                        if (seq.getName() != "") {
                                        if (seq.getAligned().length() != alignmentLength) { m->mothurOut("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);
index 21564775c69f5af6f335582aaf2caebe53e1c627..cab29633c8528c30fe0ba032cc6d76bfea44eccb 100644 (file)
@@ -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<seqPNode>::iterator itList;
                list<seqPNode>::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++; }