]> git.donarmstrong.com Git - mothur.git/commitdiff
shhh.seqs and trim.flows modifications.
authorpschloss <pschloss>
Fri, 11 Feb 2011 12:32:21 +0000 (12:32 +0000)
committerpschloss <pschloss>
Fri, 11 Feb 2011 12:32:21 +0000 (12:32 +0000)
shhhercommand.cpp
shhhercommand.h
trimflowscommand.cpp

index 7768fa74f1d58fa4f5e15f1031c6046a5bccb58f..14eee605880e3dfa61333cc8eb437f23f7c3d6c5 100644 (file)
@@ -171,7 +171,15 @@ ShhherCommand::ShhherCommand(string option) {
                                m->mothurOutEndLine();
                                abort = true; 
                        }
-                       else if (flowFileName == "not open" || flowFilesFileName == "not open") { abort = true; }       
+                       else if (flowFileName == "not open" || flowFilesFileName == "not open") { abort = true; }
+                       
+                       if(flowFileName != "not found"){        compositeFASTAFileName = "";    }
+                       else{
+                               compositeFASTAFileName = flowFilesFileName.substr(0, flowFilesFileName.length()-10) + "pn.fasta";
+                               ofstream temp;
+                               m->openOutputFile(compositeFASTAFileName, temp);
+                               temp.close();
+                       }
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
                        outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  
@@ -326,9 +334,7 @@ int ShhherCommand::execute(){
                                
                                cout << "\nClustering flowgrams..." << endl;
                                string listFileName = cluster(distFileName, namesFileName);
-       //                      string listFileName = "PriestPot_C7.pn.list";
-       //                      string listFileName = "test.mock_rep3.v69.pn.list";
-                       
+
                                getOTUData(listFileName);
                                initPyroCluster();
 
@@ -1992,7 +1998,6 @@ void ShhherCommand::writeQualities(vector<int> otuCounts){
 
 void ShhherCommand::writeSequences(vector<int> otuCounts){
        try {
-               
                string bases = "TACG";
                
                string fastaFileName = flowFileName.substr(0,flowFileName.find_last_of('.')) + ".pn.fasta";
@@ -2018,6 +2023,10 @@ void ShhherCommand::writeSequences(vector<int> otuCounts){
                        }
                }
                fastaFile.close();
+               
+               if(compositeFASTAFileName != ""){
+                       m->appendFiles(fastaFileName, compositeFASTAFileName);
+               }
        }
        catch(exception& e) {
                m->errorOut(e, "ShhherCommand", "writeSequences");
index 650bf8cbe41e30c1307e9b7b180186d7a87c823f..9e50824b05f9c70a151a903b8119ba09c447b963 100644 (file)
@@ -33,7 +33,8 @@ private:
        int abort;
        map<string, vector<string> > outputTypes;
        
-       string outputDir, flowFileName, flowFilesFileName, lookupFileName;
+       string outputDir, flowFileName, flowFilesFileName, lookupFileName, compositeFASTAFileName;
+
        int processors, maxIters;
        float cutoff, sigma, minDelta;
        
index 960a59d3950e92590063f348f890c267a3123e12..8184327e5bbfe33afa534cfc6515627d05403324 100644 (file)
@@ -221,10 +221,10 @@ TrimFlowsCommand::TrimFlowsCommand(string option)  {
                        convert(temp, tdiffs);
                        if(tdiffs == 0){        tdiffs = bdiffs + pdiffs;       }
                        
-                       temp = validParameter.validFile(parameters, "allfiles", false);         if (temp == "not found") { temp = "T";          }
+                       temp = validParameter.validFile(parameters, "allfiles", false);         if (temp == "not found"){ temp = "T";           }
                        allFiles = m->isTrue(temp);
                        
-                       temp = validParameter.validFile(parameters, "processors", false);       if (temp == "not found") { temp = "1"; }
+                       temp = validParameter.validFile(parameters, "processors", false);       if (temp == "not found"){ temp = "1";           }
                        convert(temp, processors); 
                        
                        if(oligoFileName == ""){        allFiles = 0;           }
@@ -322,6 +322,7 @@ int TrimFlowsCommand::execute(){
                        output.close();
                }
                outputTypes["flow.files"].push_back(flowFilesFileName);
+               outputNames.push_back(flowFileName);
                
                m->mothurOutEndLine();
                m->mothurOut("Output File Names: "); m->mothurOutEndLine();
@@ -431,15 +432,13 @@ int TrimFlowsCommand::driverCreateTrim(string flowFileName, string trimFlowFileN
                                if(fasta)       {       currSeq.printSequence(fastaFile);       }
                                
                                if(allFiles){
-//                                     string fileName = outputDir + m->getRootName(m->getSimpleName(flowFileName)) + barcodePrimerCombos[barcodeIndex][primerIndex] + ".flow";
                                        ofstream output;
                                        m->openOutputFileAppend(barcodePrimerComboFileNames[barcodeIndex][primerIndex], output);
                                        output.setf(ios::fixed, ios::floatfield); trimFlowFile.setf(ios::showpoint);
                                        
                                        flowData.printFlows(output);
                                        output.close();
-                               }
-                               
+                               }                               
                        }
                        else{
                                flowData.printFlows(scrapFlowFile, trashCode);