]> git.donarmstrong.com Git - mothur.git/commitdiff
modified trim.seqs command
authorpschloss <pschloss>
Sun, 7 Jun 2009 02:23:44 +0000 (02:23 +0000)
committerpschloss <pschloss>
Sun, 7 Jun 2009 02:23:44 +0000 (02:23 +0000)
alignment.cpp
alignment.hpp
globaldata.cpp
globaldata.hpp
needlemanoverlap.hpp
trimseqscommand.cpp
trimseqscommand.h
validparameter.cpp

index 55ba1a111640588e8426b6337a9600406ccc77cf..95e9dc2b115888a9cd38353aeb67353c1fb71806 100644 (file)
@@ -41,7 +41,7 @@ void Alignment::traceBack(){                  //      This traceback routine is used by the dynamic
        
        AlignmentCell currentCell = alignment[row][column];     //      Start the traceback from the bottom-right corner of the
                                                                                                                //      matrix
-       
+
        if(currentCell.prevCell == 'x'){        seqAaln = seqBaln = "NOALIGNMENT";              }//If there's an 'x' in the bottom-
        else{                                                                                           //      right corner bail out because it means nothing got aligned
                while(currentCell.prevCell != 'x'){                             //      while the previous cell isn't an 'x', keep going...
index b3175560af7f16aa7a4e6fe4d8e87a2a081ae7cf..c033d62cbd8aa94d8ce6b7bc0b429015fd5c3d50 100644 (file)
@@ -25,7 +25,7 @@ public:
        Alignment();
        virtual void align(string, string) = 0;
        
-       float getAlignmentScore();
+//     float getAlignmentScore();
        string getSeqAAln();
        string getSeqBAln();
        int getCandidateStartPos();
index bf28cc62ac9e7c232a03670f2a17654776459140..c42969e5ff5b8450a5ae63e9876e0f5bde8d29ad 100644 (file)
@@ -102,9 +102,6 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                                if(key == "maxlength")          {       maxLength = value;              }
                                if(key == "flip"        )               {       flip = value;                   }
                                if(key == "oligos"      )               {       oligoFile = value;              }
-                               if(key == "forward"     )               {       forMismatch = value;    }
-                               if(key == "reverse"     )               {       revMismatch = value;    }
-                               if(key == "barcode"     )               {       barMismatch = value;    }
                                        
                                if(key == "line") {//stores lines to be used in a vector
                                        lines.clear();
@@ -183,9 +180,6 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                        if(key == "maxlength")  {       maxLength = value;              }
                        if(key == "flip"        )       {       flip = value;                   }
                        if(key == "oligos"      )       {       oligoFile = value;              }
-                       if(key == "forward"     )       {       forMismatch = value;    }
-                       if(key == "reverse"     )       {       revMismatch = value;    }
-                       if(key == "barcode"     )       {       barMismatch = value;    }
                        
 
                        if(key == "line") {//stores lines to be used in a vector
@@ -347,9 +341,6 @@ string GlobalData::getMinLength()           {       return minLength;               }
 string GlobalData::getMaxLength()              {       return maxLength;               }
 string GlobalData::getFlip()                   {       return flip;                    }
 string GlobalData::getOligosFile()             {       return oligoFile;               }
-string GlobalData::getForwardMismatch()        {       return forMismatch;             }
-string GlobalData::getReverseMismatch()        {       return revMismatch;             }
-string GlobalData::getBarcodeMismatch()        {       return barMismatch;             }
 
 
 void GlobalData::setListFile(string file)              {       listfile = file;        inputFileName = file;                                   }
@@ -433,9 +424,6 @@ void GlobalData::clear() {
        minLength               =       "-1";
        maxLength               =       "-1";
        flip                    =       "0";
-       forMismatch             =       "0";
-       revMismatch             =       "0";
-       barMismatch             =       "0";
        oligoFile               =       "";
 }
 
@@ -479,9 +467,6 @@ void GlobalData::reset() {
        minLength               =       "-1";
        maxLength               =       "-1";
        flip                    =       "0";
-       forMismatch             =       "0";
-       revMismatch             =       "0";
-       barMismatch             =       "0";
        oligoFile               =       "";
        
 }
index 2a57310ccc301f490f007680a93e64ee1b0157cf..89089ad8686a20a5ee855a1405d4800729ee325a 100644 (file)
@@ -92,9 +92,6 @@ public:
        string getMinLength();
        string getMaxLength();
        string getFlip();
-       string getForwardMismatch();
-       string getReverseMismatch();
-       string getBarcodeMismatch();
        string getOligosFile();
        
        void setListFile(string);
@@ -126,7 +123,7 @@ public:
                
 private:
 
-       string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, fastafile, treefile, sharedfile, line, label, randomtree, groups, cutoff, format, precision, method, fileroot, iters, jumble, freq, calc, abund, step, form, sorted, trump, soft, hard, scale, countends, processors, candidatefile, search, ksize, align, match, size, mismatch, gapopen, gapextend, minLength, maxLength, startPos, endPos, maxAmbig, maxHomoPolymer, flip, forMismatch, revMismatch, barMismatch, oligoFile;
+       string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, fastafile, treefile, sharedfile, line, label, randomtree, groups, cutoff, format, precision, method, fileroot, iters, jumble, freq, calc, abund, step, form, sorted, trump, soft, hard, scale, countends, processors, candidatefile, search, ksize, align, match, size, mismatch, gapopen, gapextend, minLength, maxLength, startPos, endPos, maxAmbig, maxHomoPolymer, flip, oligoFile;
 
 
        static GlobalData* _uniqueInstance;
index 57d3284e80644fbde69f6b5c1e984eebd7384c11..a5e21406be2743d8709c9ef5cb81aaa95b49824d 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include "mothur.h"
+#include "alignment.hpp"
 
 /**************************************************************************************************/
 
index 40b3b4fbd11c711965ddddf531ee07d95e246c67..95a85ac23b3a347e25cbc11c03350ef49ae7cb58 100644 (file)
@@ -7,7 +7,6 @@
  *
  */
 
-#include "sequence.hpp"
 #include "trimseqscommand.h"
 
 //***************************************************************************************************************
 TrimSeqsCommand::TrimSeqsCommand(){
        try {
                
-               oligos = 0;
-               forwardPrimerMismatch = 0;
-               reversePrimerMismatch = 0;
-               barcodeMismatch = 0;
-               
+               oligos = 0;             
                totalBarcodeCount = 0;
                matchBarcodeCount = 0;
                
@@ -28,18 +23,10 @@ TrimSeqsCommand::TrimSeqsCommand(){
                        cout << "you need to at least enter a fasta file name" << endl;
                }
                
-               if(isTrue(globaldata->getFlip()))       {       flip = 1;       }
-               
-               if(globaldata->getOligosFile() != ""){
-                       oligos = 1;
-                       forwardPrimerMismatch = atoi(globaldata->getForwardMismatch().c_str());
-                       reversePrimerMismatch = atoi(globaldata->getReverseMismatch().c_str());
-                       barcodeMismatch = atoi(globaldata->getBarcodeMismatch().c_str());
-               }
-               
-               if(!flip && !oligos)    {       cout << "what was the point?" << endl;                                                  }
+               if(isTrue(globaldata->getFlip()))               {       flip = 1;                               }
+               if(globaldata->getOligosFile() != "")   {       oligos = 1;                             }
+               if(!flip && !oligos)                                    {       cout << "huh?" << endl; }
 
-               
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the TrimSeqsCommand class Function TrimSeqsCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
@@ -80,6 +67,7 @@ int TrimSeqsCommand::execute(){
                
                while(!inFASTA.eof()){
                        Sequence currSeq(inFASTA);
+                       string origSeq = currSeq.getUnaligned();
                        string group;
                        string trashCode = "";
 
@@ -103,6 +91,7 @@ int TrimSeqsCommand::execute(){
                        }
                        else{
                                currSeq.setName(currSeq.getName() + '|' + trashCode);
+                               currSeq.setUnaligned(origSeq);
                                currSeq.printSequence(scrapFASTA);
                        }
                        
@@ -210,8 +199,8 @@ bool TrimSeqsCommand::stripForward(Sequence& seq){
                        success = 1;
                        break;
                }
-               
        }
+       
        totalFPrimerCount++;
        return success;
        
@@ -238,8 +227,8 @@ bool TrimSeqsCommand::stripReverse(Sequence& seq){
                        success = 1;
                        break;
                }
-               
-       }
+       }       
+       
        totalRPrimerCount++;
        return success;
        
index 0a34ff303e618839e3fd80583e91f9ab10305ff8..565d5283329124a65aca975d51a9588cb791670d 100644 (file)
@@ -13,6 +13,7 @@
 #include "mothur.h"
 #include "command.hpp"
 #include "globaldata.hpp"
+#include "sequence.hpp"
 
 class TrimSeqsCommand : public Command {
 public:
@@ -27,18 +28,15 @@ private:
        bool stripReverse(Sequence&);
        
        GlobalData* globaldata;
-       
-       int totalBarcodeCount, matchBarcodeCount;
-       int totalFPrimerCount, matchFPrimerCount;
-       int totalRPrimerCount, matchRPrimerCount;
-       
+
+       int totalBarcodeCount, matchBarcodeCount; // to be removed
+       int totalFPrimerCount, matchFPrimerCount; // to be removed
+       int totalRPrimerCount, matchRPrimerCount; // to be removed
        
        bool oligos, flip;
-       int forwardPrimerMismatch, reversePrimerMismatch, barcodeMismatch;
        int numFPrimers, numRPrimers;
        vector<string> forPrimer, revPrimer;
        map<string, string> barcodes;
-
 };
 
 #endif
index bd1698468116f39ec112e075e8001c47a7ef3199..4335c0d661aa99e9d8afea3de1b844015751106c 100644 (file)
@@ -285,7 +285,7 @@ void ValidParameters::initCommandParameters() {
                string reverseseqsArray[] =  {"fasta"};
                commandParameters["reverse.seqs"] = addParameters(reverseseqsArray, sizeof(reverseseqsArray)/sizeof(string));
 
-               string trimseqsArray[] =  {"fasta", "flip", "oligos", "forward", "reverse", "barcode"};
+               string trimseqsArray[] =  {"fasta", "flip", "oligos"};
                commandParameters["trim.seqs"] = addParameters(trimseqsArray, sizeof(trimseqsArray)/sizeof(string));
 
                string vennArray[] =  {"groups","line","label","calc"};