]> git.donarmstrong.com Git - mothur.git/blobdiff - trimflowscommand.cpp
fixed get.lienage and remove.lineage bug with confidence scores that are floats....
[mothur.git] / trimflowscommand.cpp
index 8184327e5bbfe33afa534cfc6515627d05403324..bf80ee8cb3ea18ed3d363816eda22d0a501e141f 100644 (file)
@@ -16,7 +16,7 @@ vector<string> TrimFlowsCommand::getValidParameters(){
        try {
                string Array[] =  {"flow", "maxflows", "minflows",
                        "fasta", "minlength", "maxlength", "maxhomop", "signal", "noise"
-                       "oligos", "pdiffs", "bdiffs", "tdiffs", 
+                       "oligos", "pdiffs", "bdiffs", "tdiffs",  "order",
                        "allfiles", "processors",
                        "outputdir","inputdir"
                
@@ -106,7 +106,7 @@ TrimFlowsCommand::TrimFlowsCommand(string option)  {
                        //valid paramters for this command
                        string AlignArray[] =  {"flow", "maxflows", "minflows",
                                "fasta", "minlength", "maxlength", "maxhomop", "signal", "noise",
-                               "oligos", "pdiffs", "bdiffs", "tdiffs", 
+                               "oligos", "pdiffs", "bdiffs", "tdiffs", "order",
                                "allfiles", "processors",
                
                                //                      "group",
@@ -226,7 +226,13 @@ TrimFlowsCommand::TrimFlowsCommand(string option)  {
                        
                        temp = validParameter.validFile(parameters, "processors", false);       if (temp == "not found"){ temp = "1";           }
                        convert(temp, processors); 
-                       
+       
+                       flowOrder = validParameter.validFile(parameters, "order", false);
+                       if (flowOrder == "not found"){ flowOrder = "TACG";              }
+                       else if(flowOrder.length() != 4){
+                               m->mothurOut("The value of the order option must be four bases long\n");
+                       }
+
                        if(oligoFileName == ""){        allFiles = 0;           }
 
                        numFPrimers = 0;
@@ -324,6 +330,13 @@ int TrimFlowsCommand::execute(){
                outputTypes["flow.files"].push_back(flowFilesFileName);
                outputNames.push_back(flowFileName);
                
+               //set fasta file as new current fastafile
+               string current = "";
+               itTypes = outputTypes.find("fasta");
+               if (itTypes != outputTypes.end()) {
+                       if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+               }
+               
                m->mothurOutEndLine();
                m->mothurOut("Output File Names: "); m->mothurOutEndLine();
                for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
@@ -367,7 +380,7 @@ int TrimFlowsCommand::driverCreateTrim(string flowFileName, string trimFlowFileN
                        }
                }
                
-               FlowData flowData(numFlows, signal, noise, maxHomoP);
+               FlowData flowData(numFlows, signal, noise, maxHomoP, flowOrder);
                
                ofstream fastaFile;
                if(fasta){      m->openOutputFile(fastaFileName, fastaFile);    }
@@ -732,7 +745,7 @@ int TrimFlowsCommand::stripForward(Sequence& seq, int& group){
                
                string rawSequence = seq.getUnaligned();
                int success = pdiffs + 1;       //guilty until proven innocent
-               
+
                //can you find the primer
                for(map<string,int>::iterator it=primers.begin();it!=primers.end();it++){
                        string oligo = it->first;