From: pschloss Date: Fri, 11 Feb 2011 12:32:21 +0000 (+0000) Subject: shhh.seqs and trim.flows modifications. X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=2a99ff8ba22dda9d0c1b125e5c9ff91e23ed6879 shhh.seqs and trim.flows modifications. --- diff --git a/shhhercommand.cpp b/shhhercommand.cpp index 7768fa7..14eee60 100644 --- a/shhhercommand.cpp +++ b/shhhercommand.cpp @@ -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 otuCounts){ void ShhherCommand::writeSequences(vector otuCounts){ try { - string bases = "TACG"; string fastaFileName = flowFileName.substr(0,flowFileName.find_last_of('.')) + ".pn.fasta"; @@ -2018,6 +2023,10 @@ void ShhherCommand::writeSequences(vector otuCounts){ } } fastaFile.close(); + + if(compositeFASTAFileName != ""){ + m->appendFiles(fastaFileName, compositeFASTAFileName); + } } catch(exception& e) { m->errorOut(e, "ShhherCommand", "writeSequences"); diff --git a/shhhercommand.h b/shhhercommand.h index 650bf8c..9e50824 100644 --- a/shhhercommand.h +++ b/shhhercommand.h @@ -33,7 +33,8 @@ private: int abort; map > outputTypes; - string outputDir, flowFileName, flowFilesFileName, lookupFileName; + string outputDir, flowFileName, flowFilesFileName, lookupFileName, compositeFASTAFileName; + int processors, maxIters; float cutoff, sigma, minDelta; diff --git a/trimflowscommand.cpp b/trimflowscommand.cpp index 960a59d..8184327 100644 --- a/trimflowscommand.cpp +++ b/trimflowscommand.cpp @@ -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);