X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=pipelinepdscommand.cpp;h=958201d0f5590118e26897613f3d0b0ed384abe9;hp=26969d81c7b6d95a0f7c603489be1da984ea7d99;hb=615301e57c25e241356a9c2380648d117709458d;hpb=672cc1adbb2f8dac82757653cd579c093fe886c2 diff --git a/pipelinepdscommand.cpp b/pipelinepdscommand.cpp index 26969d8..958201d 100644 --- a/pipelinepdscommand.cpp +++ b/pipelinepdscommand.cpp @@ -12,53 +12,92 @@ #include "commandoptionparser.hpp" //********************************************************************************************************************** -vector PipelineCommand::getValidParameters(){ - try { - string Array[] = {"sff","oligos","align","chimera","classify","taxonomy","pipeline","processors","outputdir","inputdir"}; - vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); - return myArray; - } - catch(exception& e) { - m->errorOut(e, "PipelineCommand", "getValidParameters"); - exit(1); - } -} -//********************************************************************************************************************** -vector PipelineCommand::getRequiredParameters(){ +vector PipelineCommand::setParameters(){ try { + CommandParameter psff("sff", "InputTypes", "", "", "none", "oneRequired", "pipe","",false,false,true); parameters.push_back(psff); + CommandParameter poligos("oligos", "InputTypes", "", "", "none", "oneRequired", "pipe","",false,false,true); parameters.push_back(poligos); + CommandParameter palign("align", "InputTypes", "", "", "none", "oneRequired", "pipe","",false,false,true); parameters.push_back(palign); + CommandParameter pchimera("chimera", "InputTypes", "", "", "none", "oneRequired", "pipe","",false,false,true); parameters.push_back(pchimera); + CommandParameter pclassify("classify", "InputTypes", "", "", "none", "oneRequired", "pipe","",false,false,true); parameters.push_back(pclassify); + CommandParameter ptaxonomy("taxonomy", "InputTypes", "", "", "none", "oneRequired", "pipe","",false,false,true); parameters.push_back(ptaxonomy); + CommandParameter ppipeline("pipeline", "InputTypes", "", "", "none", "oneRequired", "none","",false,false,true); parameters.push_back(ppipeline); + CommandParameter pprocessors("processors", "Number", "", "1", "", "", "","",false,false,true); parameters.push_back(pprocessors); + CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir); + CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir); + vector myArray; + for (int i = 0; i < parameters.size(); i++) { myArray.push_back(parameters[i].name); } return myArray; } catch(exception& e) { - m->errorOut(e, "PipelineCommand", "getRequiredParameters"); + m->errorOut(e, "PipelineCommand", "setParameters"); exit(1); } } //********************************************************************************************************************** -vector PipelineCommand::getRequiredFiles(){ +string PipelineCommand::getHelpString(){ try { - vector myArray; - return myArray; + string helpString = ""; + helpString += "The pipeline.pds command is designed to guide you through your analysis using mothur.\n"; + helpString += "The pipeline.pds command parameters are pipeline, sff, oligos, align, chimera, classify, taxonomy and processors.\n"; + helpString += "The sff parameter allows you to enter your sff file. It is required, if not using pipeline parameter.\n"; + helpString += "The oligos parameter allows you to enter your oligos file. It is required, if not using pipeline parameter.\n"; + helpString += "The align parameter allows you to enter a template to use with the aligner. It is required, if not using pipeline parameter.\n"; + helpString += "The chimera parameter allows you to enter a template to use for chimera detection. It is required, if not using pipeline parameter.\n"; + helpString += "The classify parameter allows you to enter a template to use for classification. It is required, if not using pipeline parameter.\n"; + helpString += "The taxonomy parameter allows you to enter a taxonomy file for the classify template to use for classification. It is required, if not using pipeline parameter.\n"; + helpString += "The processors parameter allows you to specify the number of processors to use. The default is 1.\n"; + helpString += "The pipeline parameter allows you to enter your own pipeline file. This file should look like a mothur batchfile, but where you would be using a mothur generated file, you can use current instead.\n"; + helpString += "Example: trim.seqs(processors=8, allfiles=T, maxambig=0, maxhomop=8, flip=T, bdiffs=1, pdiffs=2, qwindowaverage=35, qwindowsize=50, fasta=may1.v13.fasta, oligos=may1.v13.oligos, qfile=may1.v13.qual)\n"; + helpString += "then, you could enter unique.seqs(fasta=current), and mothur would use the .trim.fasta file from the trim.seqs command. \n"; + helpString += "then you could enter align.seqs(candidate=current, template=silva.v13.align, processors=8). , and mothur would use the .trim.unique.fasta file from the unique.seqs command. \n"; + helpString += "If no pipeline file is given then mothur will use Pat's pipeline. \n"; + helpString += "Here is a list of the commands used in Pat's pipeline.\n"; + helpString += "All paralellized commands will use the processors you entered.\n"; + helpString += "The sffinfo command takes your sff file and extracts the fasta and quality files.\n"; + helpString += "The trim.seqs command uses your oligos file and the quality and fasta files generated by sffinfo.\n"; + helpString += "The trim.seqs command sets the following parameters: allfiles=T, maxambig=0, maxhomop=8, flip=T, bdiffs=1, pdiffs=2, qwindowaverage=35, qwindowsize=50.\n"; + helpString += "The unique.seqs command uses the trimmed fasta file and removes redundant sequences, don't worry the names file generated by unique.seqs will be used in the pipeline to make sure they are included.\n"; + helpString += "The align.seqs command aligns the unique sequences using the aligners default options. \n"; + helpString += "The screen.seqs command screens the sequences using optimize=end-minlength. \n"; + helpString += "The pipeline uses chimera.slayer to detect chimeras using the default options. \n"; + helpString += "The pipeline removes all sequences determined to be chimeric by chimera.slayer. \n"; + helpString += "The filter.seqs command filters the sequences using vertical=T, trump=. \n"; + helpString += "The unique.seqs command uses the filtered fasta file and name file to remove sequences that have become redundant after filtering.\n"; + helpString += "The pre.cluster command clusters sequences that have no more than 2 differences.\n"; + helpString += "The dist.seqs command is used to generate a column and phylip formatted distance matrix using cutoff=0.20 for column.\n"; + helpString += "The pipeline uses cluster with method=average, hard=T. \n"; + helpString += "The classify.seqs command is used to classify the sequences using the bayesian method with a cutoff of 80.\n"; + helpString += "The phylotype command is used to cluster the sequences based on their classification.\n"; + helpString += "The clearcut command is used to generate a tree using neighbor=T. \n"; + helpString += "The summary.single and summary.shared commands are run on the otu files from cluster and phylotype commands. \n"; + helpString += "The summary.shared command uses calc=sharednseqs-sharedsobs-sharedchao-sharedace-anderberg-jclass-jest-kulczynski-kulczynskicody-lennon-ochiai-sorclass-sorest-whittaker-braycurtis-jabund-morisitahorn-sorabund-thetan-thetayc. \n"; + helpString += "The summary.single command uses calc=nseqs-sobs-coverage-bergerparker-chao-ace-jack-bootstrap-boneh-efron-shen-solow-shannon-npshannon-invsimpson-qstat-simpsoneven-shannoneven-heip-smithwilson. \n"; + helpString += "The classify.otu command is used to get the concensus taxonomy for otu files from cluster and phylotype commands. \n"; + helpString += "The phylo.diversity command run on the tree generated by clearcut with rarefy=T, iters=100. \n"; + helpString += "The unifrac commands are also run on the tree generated by clearcut with random=F, distance=T. \n"; + helpString += "\n"; + return helpString; } catch(exception& e) { - m->errorOut(e, "PipelineCommand", "getRequiredFiles"); + m->errorOut(e, "PipelineCommand", "getHelpString"); exit(1); } } + + //********************************************************************************************************************** PipelineCommand::PipelineCommand(string option) { try { cFactory = CommandFactory::getInstance(); - abort = false; + abort = false; calledHelp = false; //allow user to run help - if(option == "help") { help(); abort = true; } + if(option == "help") { help(); abort = true; calledHelp = true; } + else if(option == "citation") { citation(); abort = true; calledHelp = true;} else { - - //valid paramters for this command - string AlignArray[] = {"sff","oligos","align","chimera","classify","taxonomy","pipeline","processors","outputdir","inputdir"}; - vector myArray (AlignArray, AlignArray+(sizeof(AlignArray)/sizeof(string))); + vector myArray = setParameters(); OptionParser parser(option); map parameters = parser.getParameters(); @@ -139,8 +178,9 @@ PipelineCommand::PipelineCommand(string option) { if (pipeFilename == "not found") { pipeFilename = ""; } else if (pipeFilename == "not open") { pipeFilename = ""; abort = true; } - string temp = validParameter.validFile(parameters, "processors", false); if (temp == "not found"){ temp = "1"; } - convert(temp, processors); + string temp = validParameter.validFile(parameters, "processors", false); if (temp == "not found"){ temp = m->getProcessors(); } + m->setProcessors(temp); + m->mothurConvert(temp, processors); if (pipeFilename != "") { abort = readUsersPipeline(); @@ -148,6 +188,7 @@ PipelineCommand::PipelineCommand(string option) { sffFile = validParameter.validFile(parameters, "sff", true); if (sffFile == "not found") { m->mothurOut("sff is a required parameter for the pipeline command."); m->mothurOutEndLine(); abort = true; } else if (sffFile == "not open") { sffFile = ""; abort = true; } + else { m->setSFFFile(sffFile); } oligosFile = validParameter.validFile(parameters, "oligos", true); if (oligosFile == "not found") { m->mothurOut("oligos is a required parameter for the pipeline command."); m->mothurOutEndLine(); abort = true; } @@ -179,64 +220,11 @@ PipelineCommand::PipelineCommand(string option) { } //********************************************************************************************************************** -void PipelineCommand::help(){ - try { - m->mothurOut("The pipeline command is designed to guide you through your analysis using mothur.\n"); - m->mothurOut("The pipeline command parameters are pipeline, sff, oligos, align, chimera, classify, taxonomy and processors.\n"); - m->mothurOut("The sff parameter allows you to enter your sff file. It is required.\n"); - m->mothurOut("The oligos parameter allows you to enter your oligos file. It is required.\n"); - m->mothurOut("The align parameter allows you to enter a template to use with the aligner. It is required.\n"); - m->mothurOut("The chimera parameter allows you to enter a template to use for chimera detection. It is required.\n"); - m->mothurOut("The classify parameter allows you to enter a template to use for classification. It is required.\n"); - m->mothurOut("The taxonomy parameter allows you to enter a taxonomy file for the classify template to use for classification. It is required.\n"); - m->mothurOut("The processors parameter allows you to specify the number of processors to use. The default is 1.\n"); - m->mothurOut("The pipeline parameter allows you to enter your own pipeline file. This file should look like a mothur batchfile, but where you would be using a mothur generated file, you can use mothurmade instead.\n"); - m->mothurOut("First column contains the command name, and the second column contains the parameter options or 'defaults', meaning use defaults. You may leave out file options.\n"); - m->mothurOut("Example: trim.seqs(processors=8, allfiles=T, maxambig=0, maxhomop=8, flip=T, bdiffs=1, pdiffs=2, qwindowaverage=35, qwindowsize=50, fasta=may1.v13.fasta, oligos=may1.v13.oligos, qfile=may1.v13.qual)\n"); - m->mothurOut("then, you could enter unique.seqs(fasta=mothurmade), and mothur would use the .trim.fasta file from the trim.seqs command. \n"); - m->mothurOut("then you could enter align.seqs(candidate=mothurmade, template=silva.v13.align, processors=8). , and mothur would use the .trim.unique.fasta file from the unique.seqs command. \n"); - m->mothurOut("If no pipeline file is given then mothur will use Pat's pipeline. \n\n"); - m->mothurOut("Here is a list of the commands used in Pat's pipeline.\n"); - m->mothurOut("All paralellized commands will use the processors you entered.\n"); - m->mothurOut("The sffinfo command takes your sff file and extracts the fasta and quality files.\n"); - m->mothurOut("The trim.seqs command uses your oligos file and the quality and fasta files generated by sffinfo.\n"); - m->mothurOut("The trim.seqs command sets the following parameters: allfiles=T, maxambig=0, maxhomop=8, flip=T, bdiffs=1, pdiffs=2, qwindowaverage=35, qwindowsize=50.\n"); - m->mothurOut("The unique.seqs command uses the trimmed fasta file and removes redundant sequences, don't worry the names file generated by unique.seqs will be used in the pipeline to make sure they are included.\n"); - m->mothurOut("The align.seqs command aligns the unique sequences using the aligners default options. \n"); - m->mothurOut("The screen.seqs command screens the sequences using optimize=end-minlength. \n"); - m->mothurOut("The pipeline uses chimera.slayer to detect chimeras using the default options. \n"); - m->mothurOut("The pipeline removes all sequences determined to be chimeric by chimera.slayer. \n"); - m->mothurOut("The filter.seqs command filters the sequences using vertical=T, trump=. \n"); - m->mothurOut("The unique.seqs command uses the filtered fasta file and name file to remove sequences that have become redundant after filtering.\n"); - m->mothurOut("The pre.cluster command clusters sequences that have no more than 2 differences.\n"); - m->mothurOut("The dist.seqs command is used to generate a column and phylip formatted distance matrix using cutoff=0.20 for column.\n"); - m->mothurOut("The pipeline uses cluster with method=average, hard=T. \n"); - m->mothurOut("The classify.seqs command is used to classify the sequences using the bayesian method with a cutoff of 80.\n"); - m->mothurOut("The phylotype command is used to cluster the sequences based on their classification.\n"); - m->mothurOut("The clearcut command is used to generate a tree using neighbor=T. \n"); - m->mothurOut("The summary.single and summary.shared commands are run on the otu files from cluster and phylotype commands. \n"); - m->mothurOut("The summary.shared command uses calc=sharednseqs-sharedsobs-sharedchao-sharedace-anderberg-jclass-jest-kulczynski-kulczynskicody-lennon-ochiai-sorclass-sorest-whittaker-braycurtis-jabund-morisitahorn-sorabund-thetan-thetayc. \n"); - m->mothurOut("The summary.single command uses calc=nseqs-sobs-coverage-bergerparker-chao-ace-jack-bootstrap-boneh-efron-shen-solow-shannon-npshannon-invsimpson-qstat-simpsoneven-shannoneven-heip-smithwilson. \n"); - m->mothurOut("The classify.otu command is used to get the concensus taxonomy for otu files from cluster and phylotype commands. \n"); - m->mothurOut("The phylo.diversity command run on the tree generated by clearcut with rarefy=T, iters=100. \n"); - m->mothurOut("The unifrac commands are also run on the tree generated by clearcut with random=F, distance=T. \n"); - m->mothurOut("\n\n"); - } - catch(exception& e) { - m->errorOut(e, "PipelineCommand", "help"); - exit(1); - } -} - -//********************************************************************************************************************** - -PipelineCommand::~PipelineCommand(){} - -//********************************************************************************************************************** - int PipelineCommand::execute(){ try { - if (abort == true) { return 0; } + if (abort == true) { if (calledHelp) { return 0; } return 2; } + + int start = time(NULL); if (pipeFilename == "") { createPatsPipeline(); @@ -279,6 +267,8 @@ int PipelineCommand::execute(){ if (m->control_pressed) { return 0; } + m->mothurOut("It took " + toString(time(NULL) - start) + " secs to run the pipeline analysis."); m->mothurOutEndLine(); m->mothurOutEndLine(); + m->mothurOutEndLine(); m->mothurOut("Output File Names: "); m->mothurOutEndLine(); for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); } @@ -351,12 +341,14 @@ bool PipelineCommand::parseCommand(string nextCommand, string& name, string& opt bool PipelineCommand::checkForValidAndRequiredParameters(string name, string options, map >& mothurMadeFiles){ try { + + if (name == "system") { return false; } //get shell of the command so we can check to make sure its valid without running it Command* command = cFactory->getCommand(name); - + //check to make sure all parameters are valid for command - vector validParameters = command->getValidParameters(); + vector validParameters = command->setParameters(); OptionParser parser(options); map parameters = parser.getParameters(); @@ -366,47 +358,51 @@ bool PipelineCommand::checkForValidAndRequiredParameters(string name, string opt map >::iterator itMade; for (it = parameters.begin(); it != parameters.end(); it++) { + if (validParameter.isValidParameter(it->first, validParameters, it->second) != true) { return true; } // not valid - if (it->second == "mothurmade") { + if (it->second == "current") { itMade = mothurMadeFiles.find(it->first); if (itMade == mothurMadeFiles.end()) { - m->mothurOut("You have the " + it->first + " listed as a mothurmade file for the " + name + " command, but it seems mothur will not make that file in your current pipeline, please correct."); m->mothurOutEndLine(); + m->mothurOut("You have the " + it->first + " listed as a current file for the " + name + " command, but it seems mothur will not make that file in your current pipeline, please correct."); m->mothurOutEndLine(); return true; } } } - + //is the command missing any required - vector requiredParameters = command->getRequiredParameters(); - - //check for or - bool hasOr = false; - int numFound = 0; - if (requiredParameters.size() > 2) { - if (requiredParameters[(requiredParameters.size()-1)] == "or") { hasOr = true; } + vector commandParameters = command->getParameters(); + vector requiredParameters; + for (int i = 0; i < commandParameters.size(); i++) { + if (commandParameters[i].required) { + requiredParameters.push_back(commandParameters[i].name); + } } - + for (int i = 0; i < requiredParameters.size(); i++) { it = parameters.find(requiredParameters[i]); - if (it != parameters.end()) { numFound++; } - else { - if (!hasOr) { m->mothurOut(name + " requires the " + requiredParameters[i] + " parameter, please correct."); m->mothurOutEndLine(); } + if (it == parameters.end()) { + + string paraToLookFor = requiredParameters[i]; + + //does mothur have a current file for this? + itMade = mothurMadeFiles.find(requiredParameters[i]); + + if (itMade == mothurMadeFiles.end()) { + m->mothurOut(name + " requires the " + requiredParameters[i] + " parameter, please correct."); m->mothurOutEndLine(); + + } } } - - // if all are needed and not all are found - if ((!hasOr) && (numFound != requiredParameters.size())) { return true; } - //if one is needed and none are found - else if ((hasOr) && (numFound == 0)) { return true; } + //update MothurMade map > thisCommandsFile = command->getOutputFiles(); for (itMade = thisCommandsFile.begin(); itMade != thisCommandsFile.end(); itMade++) { mothurMadeFiles[itMade->first] = itMade->second; //adds any new types } - + return false; } catch(exception& e) { @@ -431,8 +427,8 @@ int PipelineCommand::runUsersPipeline(){ CommandOptionParser parser(nextCommand); string commandName = parser.getCommandString(); string options = parser.getOptionString(); - - if (options != "") { + + if ((options != "") && (commandName != "system")) { bool error = fillInMothurMade(options, mothurMadeFiles); if (error) { in.close(); return 0; } } @@ -514,6 +510,8 @@ int PipelineCommand::runUsersPipeline(){ } in.close(); + + return 0; } catch(exception& e) { m->errorOut(e, "PipelineCommand", "runUsersPipeline"); @@ -521,8 +519,9 @@ int PipelineCommand::runUsersPipeline(){ } } //********************************************************************************************************************** -bool PipelineCommand::fillInMothurMade(string& options, map > mothurMadeFiles){ +bool PipelineCommand::fillInMothurMade(string& options, map >& mothurMadeFiles){ try { + OptionParser parser(options); map parameters = parser.getParameters(); map::iterator it; @@ -532,21 +531,26 @@ bool PipelineCommand::fillInMothurMade(string& options, mapsecond == "mothurmade") { - itMade = mothurMadeFiles.find(it->first); + string paraType = it->first; + string tempOption = it->second; + + if (tempOption == "current") { + + itMade = mothurMadeFiles.find(paraType); if (itMade == mothurMadeFiles.end()) { - m->mothurOut("Looking for a mothurmade " + it->first + " file, but it seems mothur has not made that file type in your current pipeline, please correct."); m->mothurOutEndLine(); + m->mothurOut("Looking for a current " + paraType + " file, but it seems mothur has not made that file type in your current pipeline, please correct."); m->mothurOutEndLine(); return true; }else{ vector temp = itMade->second; if (temp.size() > 1) { //ask user which file to use - m->mothurOut("More than one file has been created for the " + it->first + " parameter. "); m->mothurOutEndLine(); + m->mothurOut("More than one file has been created for the " + paraType + " parameter. "); m->mothurOutEndLine(); for (int i = 0; i < temp.size(); i++) { m->mothurOut(toString(i) + " - " + temp[i]); m->mothurOutEndLine(); } + m->mothurOut("Please select the number of the file you would like to use: "); int num = 0; cin >> num; @@ -554,23 +558,43 @@ bool PipelineCommand::fillInMothurMade(string& options, map (temp.size()-1))) { m->mothurOut("Not a valid response, quitting."); m->mothurOutEndLine(); return true; } else { - parameters[it->first] = temp[num]; + tempOption = temp[num]; } //clears buffer so next command doesn't have error string s; getline(cin, s); + vector newTemp; + for (int i = 0; i < temp.size(); i++) { + if (i == num) { newTemp.push_back(temp[i]); } + else { + m->mothurOut("Would you like to remove " + temp[i] + " as an option for " + paraType + ", (y/n): "); m->mothurOutEndLine(); + string response; + cin >> response; + m->mothurOutJustToLog(response); m->mothurOutEndLine(); + + if (response == "n") { newTemp.push_back(temp[i]); } + + //clears buffer so next command doesn't have error + string s; + getline(cin, s); + } + } + + mothurMadeFiles[paraType] = newTemp; + + }else if (temp.size() == 0){ - m->mothurOut("Sorry, we seem to think you created a " + it->first + " file, but it seems mothur doesn't have a filename."); m->mothurOutEndLine(); + m->mothurOut("Sorry, we seem to think you created a " + paraType + " file, but it seems mothur doesn't have a filename."); m->mothurOutEndLine(); return true; }else{ - parameters[it->first] = temp[0]; + tempOption = temp[0]; } } } - options += it->first + "=" + parameters[it->first] + ", "; + options += it->first + "=" + tempOption + ", "; } //rip off extra comma @@ -590,76 +614,76 @@ void PipelineCommand::createPatsPipeline(){ //sff.info command string thisCommand = "sffinfo(sff=" + sffFile + ")"; - //commands.push_back(thisCommand); + commands.push_back(thisCommand); //trim.seqs command string fastaFile = m->getRootName(m->getSimpleName(sffFile)) + "fasta"; string qualFile = m->getRootName(m->getSimpleName(sffFile)) + "qual"; - //thisCommand = "trim.seqs(processors=" + toString(processors) + ", fasta=" + fastaFile + ", allfiles=F, maxambig=0, maxhomop=8, flip=T, bdiffs=1, pdiffs=2, qwindowaverage=35, qwindowsize=50, oligos=" + oligosFile + ", qfile=" + qualFile + ")"; - //commands.push_back(thisCommand); + thisCommand = "trim.seqs(processors=" + toString(processors) + ", fasta=current, allfiles=T, maxambig=0, maxhomop=8, flip=T, bdiffs=1, pdiffs=2, qwindowaverage=35, qwindowsize=50, oligos=" + oligosFile + ", qfile=current)"; + commands.push_back(thisCommand); //unique.seqs string groupFile = m->getRootName(m->getSimpleName(fastaFile)) + "groups"; qualFile = m->getRootName(m->getSimpleName(fastaFile)) + "trim.qual"; fastaFile = m->getRootName(m->getSimpleName(fastaFile)) + "trim.fasta"; - //thisCommand = "unique.seqs(fasta=" + fastaFile + ")"; - //commands.push_back(thisCommand); + thisCommand = "unique.seqs(fasta=current)"; + commands.push_back(thisCommand); //align.seqs string nameFile = m->getRootName(m->getSimpleName(fastaFile)) + "names"; fastaFile = m->getRootName(m->getSimpleName(fastaFile)) + "unique" + m->getExtension(fastaFile); - //thisCommand = "align.seqs(processors=" + toString(processors) + ", candidate=" + fastaFile + ", template=" + alignFile + ")"; - //commands.push_back(thisCommand); + thisCommand = "align.seqs(processors=" + toString(processors) + ", candidate=current, template=" + alignFile + ")"; + commands.push_back(thisCommand); //screen.seqs fastaFile = m->getRootName(m->getSimpleName(fastaFile)) + "align"; - //thisCommand = "screen.seqs(processors=" + toString(processors) + ", fasta=" + fastaFile + ", name=" + nameFile + ", group=" + groupFile + ", optimize=end-minlength)"; - // commands.push_back(thisCommand); + thisCommand = "screen.seqs(processors=" + toString(processors) + ", fasta=current, name=current, group=current, optimize=end-minlength)"; + commands.push_back(thisCommand); //chimera.slayer fastaFile = m->getRootName(m->getSimpleName(fastaFile)) + "good" + m->getExtension(fastaFile); nameFile = m->getRootName(m->getSimpleName(nameFile)) + "good" + m->getExtension(nameFile); groupFile = m->getRootName(m->getSimpleName(groupFile)) + "good" + m->getExtension(groupFile); - //thisCommand = "chimera.slayer(processors=" + toString(processors) + ", fasta=" + fastaFile + ", template=" + chimeraFile + ")"; - // commands.push_back(thisCommand); + thisCommand = "chimera.slayer(processors=" + toString(processors) + ", fasta=current, template=" + chimeraFile + ")"; + commands.push_back(thisCommand); //remove.seqs string accnosFile = m->getRootName(m->getSimpleName(fastaFile)) + "slayer.accnos"; - thisCommand = "remove.seqs(fasta=" + fastaFile + ", name=" + nameFile + ", group=" + groupFile + ", accnos=" + accnosFile + ", dups=T)"; + thisCommand = "remove.seqs(fasta=current, name=current, group=current, accnos=current, dups=T)"; commands.push_back(thisCommand); //filter.seqs nameFile = m->getRootName(m->getSimpleName(nameFile)) + "pick" + m->getExtension(nameFile); groupFile = m->getRootName(m->getSimpleName(groupFile)) + "pick" + m->getExtension(groupFile); fastaFile = m->getRootName(m->getSimpleName(fastaFile)) + "pick" + m->getExtension(fastaFile); - thisCommand = "filter.seqs(processors=" + toString(processors) + ", fasta=" + fastaFile + ", vertical=T, trump=.)"; + thisCommand = "filter.seqs(processors=" + toString(processors) + ", fasta=current, vertical=T, trump=.)"; commands.push_back(thisCommand); //unique.seqs fastaFile = m->getRootName(m->getSimpleName(fastaFile)) + "filter.fasta"; - thisCommand = "unique.seqs(fasta=" + fastaFile + ", name=" + nameFile + ")"; + thisCommand = "unique.seqs(fasta=current, name=current)"; commands.push_back(thisCommand); //pre.cluster nameFile = m->getRootName(m->getSimpleName(fastaFile)) + "names"; fastaFile = m->getRootName(m->getSimpleName(fastaFile)) + "unique" + m->getExtension(fastaFile); - thisCommand = "pre.cluster(fasta=" + fastaFile + ", name=" + nameFile + ", diffs=2)"; + thisCommand = "pre.cluster(fasta=current, name=current, diffs=2)"; commands.push_back(thisCommand); //dist.seqs nameFile = m->getRootName(m->getSimpleName(fastaFile)) + "precluster.names"; fastaFile = m->getRootName(m->getSimpleName(fastaFile)) + "precluster" + m->getExtension(fastaFile); - thisCommand = "dist.seqs(processors=" + toString(processors) + ", fasta=" + fastaFile + ", cutoff=0.20)"; + thisCommand = "dist.seqs(processors=" + toString(processors) + ", fasta=current, cutoff=0.20)"; commands.push_back(thisCommand); //dist.seqs string columnFile = m->getRootName(m->getSimpleName(fastaFile)) + "dist"; - thisCommand = "dist.seqs(processors=" + toString(processors) + ", fasta=" + fastaFile + ", output=lt)"; + thisCommand = "dist.seqs(processors=" + toString(processors) + ", fasta=current, output=lt)"; commands.push_back(thisCommand); //read.dist string phylipFile = m->getRootName(m->getSimpleName(fastaFile)) + "phylip.dist"; - thisCommand = "read.dist(column=" + columnFile + ", name=" + nameFile + ")"; + thisCommand = "read.dist(column=current, name=current)"; commands.push_back(thisCommand); //cluster @@ -670,12 +694,12 @@ void PipelineCommand::createPatsPipeline(){ string rabundFile = m->getRootName(m->getSimpleName(columnFile)) + "an.rabund"; //degap.seqs - thisCommand = "degap.seqs(fasta=" + fastaFile + ")"; + thisCommand = "degap.seqs(fasta=current)"; commands.push_back(thisCommand); //classify.seqs fastaFile = m->getRootName(m->getSimpleName(fastaFile)) + "ng.fasta"; - thisCommand = "classify.seqs(processors=" + toString(processors) + ", fasta=" + fastaFile + ", name=" + nameFile + ", template=" + classifyFile + ", taxonomy=" + taxonomyFile + ", cutoff=80)"; + thisCommand = "classify.seqs(processors=" + toString(processors) + ", fasta=current, name=current, template=" + classifyFile + ", taxonomy=" + taxonomyFile + ", cutoff=80)"; commands.push_back(thisCommand); string RippedTaxName = m->getRootName(m->getSimpleName(taxonomyFile)); @@ -687,68 +711,68 @@ void PipelineCommand::createPatsPipeline(){ string taxSummaryFile = m->getRootName(m->getSimpleName(fastaFile)) + RippedTaxName + "tax.summary"; //phylotype - thisCommand = "phylotype(taxonomy=" + fastaTaxFile + ", name=" + nameFile + ")"; + thisCommand = "phylotype(taxonomy=current, name=current)"; commands.push_back(thisCommand); string phyloListFile = m->getRootName(m->getSimpleName(fastaTaxFile)) + "tx.list"; string phyloRabundFile = m->getRootName(m->getSimpleName(fastaTaxFile)) + "tx.rabund"; //clearcut - thisCommand = "clearcut(phylip=" + phylipFile + ", neighbor=T)"; + thisCommand = "clearcut(phylip=current, neighbor=T)"; commands.push_back(thisCommand); string treeFile = m->getRootName(m->getSimpleName(phylipFile)) + "tre"; //read.otu - thisCommand = "read.otu(list=" + listFile + ", group=" + groupFile + ", label=0.03)"; + thisCommand = "make.shared(list=" + listFile + ", group=" + groupFile + ", label=0.03)"; commands.push_back(thisCommand); string sharedFile = m->getRootName(m->getSimpleName(listFile)) + "shared"; //read.otu - thisCommand = "read.otu(list=" + phyloListFile + ", group=" + groupFile + ", label=1)"; + thisCommand = "make.shared(list=" + phyloListFile + ", group=" + groupFile + ", label=1)"; commands.push_back(thisCommand); string phyloSharedFile = m->getRootName(m->getSimpleName(phyloListFile)) + "shared"; //read.otu - thisCommand = "read.otu(shared=" + sharedFile + ")"; + thisCommand = "set.current(shared=" + sharedFile + ")"; commands.push_back(thisCommand); //summary.single - thisCommand = "summary.single(calc=nseqs-sobs-coverage-bergerparker-chao-ace-jack-bootstrap-boneh-efron-shen-solow-shannon-npshannon-invsimpson-qstat-simpsoneven-shannoneven-heip-smithwilson, size=5000)"; + thisCommand = "summary.single(shared=current, calc=nseqs-sobs-coverage-bergerparker-chao-ace-jack-bootstrap-boneh-efron-shen-solow-shannon-npshannon-invsimpson-qstat-simpsoneven-shannoneven-heip-smithwilson, size=5000)"; commands.push_back(thisCommand); //summary.shared - thisCommand = "summary.shared(calc=sharednseqs-sharedsobs-sharedchao-sharedace-anderberg-jclass-jest-kulczynski-kulczynskicody-lennon-ochiai-sorclass-sorest-whittaker-braycurtis-jabund-morisitahorn-sorabund-thetan-thetayc)"; + thisCommand = "summary.shared(shared=current, calc=sharednseqs-sharedsobs-sharedchao-sharedace-anderberg-jclass-jest-kulczynski-kulczynskicody-lennon-ochiai-sorclass-sorest-whittaker-braycurtis-jabund-morisitahorn-sorabund-thetan-thetayc)"; commands.push_back(thisCommand); //read.otu - thisCommand = "read.otu(rabund=" + rabundFile + ", label=0.03)"; - commands.push_back(thisCommand); + //thisCommand = "read.otu(rabund=" + rabundFile + ", label=0.03)"; + //commands.push_back(thisCommand); //summary.single - thisCommand = "summary.single(calc=nseqs-sobs-coverage-bergerparker-chao-ace-jack-bootstrap-boneh-efron-shen-solow-shannon-npshannon-invsimpson-qstat-simpsoneven-shannoneven-heip-smithwilson, size=5000)"; + thisCommand = "summary.single(rabund=" + rabundFile + ", label=0.03, calc=nseqs-sobs-coverage-bergerparker-chao-ace-jack-bootstrap-boneh-efron-shen-solow-shannon-npshannon-invsimpson-qstat-simpsoneven-shannoneven-heip-smithwilson, size=5000)"; commands.push_back(thisCommand); //read.otu - thisCommand = "read.otu(shared=" + phyloSharedFile + ")"; + thisCommand = "set.current(shared=" + phyloSharedFile + ")"; commands.push_back(thisCommand); //summary.single - thisCommand = "summary.single(calc=nseqs-sobs-coverage-bergerparker-chao-ace-jack-bootstrap-boneh-efron-shen-solow-shannon-npshannon-invsimpson-qstat-simpsoneven-shannoneven-heip-smithwilson, size=5000)"; + thisCommand = "summary.single(shared=current, calc=nseqs-sobs-coverage-bergerparker-chao-ace-jack-bootstrap-boneh-efron-shen-solow-shannon-npshannon-invsimpson-qstat-simpsoneven-shannoneven-heip-smithwilson, size=5000)"; commands.push_back(thisCommand); //summary.shared - thisCommand = "summary.shared(calc=sharednseqs-sharedsobs-sharedchao-sharedace-anderberg-jclass-jest-kulczynski-kulczynskicody-lennon-ochiai-sorclass-sorest-whittaker-braycurtis-jabund-morisitahorn-sorabund-thetan-thetayc)"; + thisCommand = "summary.shared(shared=current, calc=sharednseqs-sharedsobs-sharedchao-sharedace-anderberg-jclass-jest-kulczynski-kulczynskicody-lennon-ochiai-sorclass-sorest-whittaker-braycurtis-jabund-morisitahorn-sorabund-thetan-thetayc)"; commands.push_back(thisCommand); //read.otu - thisCommand = "read.otu(rabund=" + phyloRabundFile + ", label=1)"; - commands.push_back(thisCommand); + //thisCommand = "read.otu(rabund=" + phyloRabundFile + ", label=1)"; + //commands.push_back(thisCommand); //summary.single - thisCommand = "summary.single(calc=nseqs-sobs-coverage-bergerparker-chao-ace-jack-bootstrap-boneh-efron-shen-solow-shannon-npshannon-invsimpson-qstat-simpsoneven-shannoneven-heip-smithwilson, size=5000)"; + thisCommand = "summary.single(rabund=" + phyloRabundFile + ", label=1, calc=nseqs-sobs-coverage-bergerparker-chao-ace-jack-bootstrap-boneh-efron-shen-solow-shannon-npshannon-invsimpson-qstat-simpsoneven-shannoneven-heip-smithwilson, size=5000)"; commands.push_back(thisCommand); //classify.otu @@ -760,19 +784,19 @@ void PipelineCommand::createPatsPipeline(){ commands.push_back(thisCommand); //read.tree - thisCommand = "read.tree(tree=" + treeFile + ", name=" + nameFile + ", group=" + groupFile + ")"; + thisCommand = "set.current(tree=" + treeFile + ", name=" + nameFile + ", group=" + groupFile + ")"; commands.push_back(thisCommand); //phylo.diversity - thisCommand = "phylo.diversity(iters=100,rarefy=T)"; + thisCommand = "phylo.diversity(tree=current, group=current, name=current, iters=100,rarefy=T)"; commands.push_back(thisCommand); //unifrac.weighted - thisCommand = "unifrac.weighted(random=false, distance=true, groups=all, processors=" + toString(processors) + ")"; + thisCommand = "unifrac.weighted(tree=current, group=current, name=current, random=false, distance=true, groups=all, processors=" + toString(processors) + ")"; commands.push_back(thisCommand); //unifrac.unweighted - thisCommand = "unifrac.unweighted(random=false, distance=true, processors=" + toString(processors) + ")"; + thisCommand = "unifrac.unweighted(tree=current, group=current, name=current, random=false, distance=true, processors=" + toString(processors) + ")"; commands.push_back(thisCommand);