From f37a59b81c339f574d97042ff6e364146feb457a Mon Sep 17 00:00:00 2001 From: westcott Date: Tue, 22 Sep 2009 14:16:08 +0000 Subject: [PATCH] removed line option --- binsequencecommand.cpp | 37 +++++++++--------------------- binsequencecommand.h | 3 +-- bootstrapsharedcommand.cpp | 37 ++++++++---------------------- bootstrapsharedcommand.h | 3 +-- collect.cpp | 2 +- collectcommand.cpp | 42 +++++++++++----------------------- collectcommand.h | 13 +++++------ collectsharedcommand.cpp | 42 +++++++++++----------------------- collectsharedcommand.h | 16 +------------ getoturepcommand.cpp | 40 ++++++++++---------------------- getoturepcommand.h | 3 +-- getrabundcommand.cpp | 41 ++++++++++----------------------- getrabundcommand.h | 3 +-- getsabundcommand.cpp | 43 +++++++++++----------------------- getsabundcommand.h | 3 +-- globaldata.cpp | 2 +- globaldata.hpp | 1 - heatmapcommand.cpp | 47 ++++++++++++-------------------------- heatmapcommand.h | 3 +-- heatmapsimcommand.cpp | 41 ++++++++++----------------------- heatmapsimcommand.h | 3 +-- matrixoutputcommand.cpp | 41 ++++++++++----------------------- matrixoutputcommand.h | 5 ++-- rarefactcommand.cpp | 38 +++++++++--------------------- rarefactcommand.h | 17 +------------- rarefactsharedcommand.cpp | 38 +++++++++--------------------- rarefactsharedcommand.h | 15 +----------- readotucommand.cpp | 22 ++++-------------- readotucommand.h | 17 +------------- sharedcommand.cpp | 11 +++------ summarycommand.cpp | 45 ++++++++++++------------------------ summarycommand.h | 15 +----------- summarysharedcommand.cpp | 42 +++++++++++----------------------- summarysharedcommand.h | 18 +-------------- treegroupscommand.cpp | 37 +++++++++--------------------- treegroupscommand.h | 3 +-- venncommand.cpp | 45 ++++++++++++------------------------ venncommand.h | 3 +-- 38 files changed, 230 insertions(+), 607 deletions(-) diff --git a/binsequencecommand.cpp b/binsequencecommand.cpp index e4e4c48..08ae6b6 100644 --- a/binsequencecommand.cpp +++ b/binsequencecommand.cpp @@ -15,7 +15,6 @@ BinSeqCommand::BinSeqCommand(string option){ globaldata = GlobalData::getInstance(); abort = false; allLines = 1; - lines.clear(); labels.clear(); //allow user to run help @@ -23,7 +22,7 @@ BinSeqCommand::BinSeqCommand(string option){ else { //valid paramters for this command - string AlignArray[] = {"fasta","line","label","name", "group"}; + string AlignArray[] = {"fasta","label","name", "group"}; vector myArray (AlignArray, AlignArray+(sizeof(AlignArray)/sizeof(string))); OptionParser parser(option); @@ -51,12 +50,6 @@ BinSeqCommand::BinSeqCommand(string option){ //check for optional parameter and set defaults // ...at some point should added some additional type checking... - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - } label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } @@ -65,13 +58,10 @@ BinSeqCommand::BinSeqCommand(string option){ else { allLines = 1; } } - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - //if the user has not specified any line or labels use the ones from read.otu - else if ((line == "") && (label == "")) { + //if the user has not specified any labels use the ones from read.otu + if (label == "") { allLines = globaldata->allLines; labels = globaldata->labels; - lines = globaldata->lines; } namesfile = validParameter.validFile(parameters, "name", true); @@ -103,11 +93,11 @@ BinSeqCommand::BinSeqCommand(string option){ void BinSeqCommand::help(){ try { mothurOut("The bin.seqs command can only be executed after a successful read.otu command of a listfile.\n"); - mothurOut("The bin.seqs command parameters are fasta, name, line, label and group. The fasta parameter is required, and you may not use line and label at the same time.\n"); - mothurOut("The line and label allow you to select what distance levels you would like a output files created for, and are separated by dashes.\n"); - mothurOut("The bin.seqs command should be in the following format: bin.seqs(fasta=yourFastaFile, name=yourNamesFile, group=yourGroupFile, line=yourLines, label=yourLabels).\n"); - mothurOut("Example bin.seqs(fasta=amazon.fasta, group=amazon.groups, line=1-3-5, name=amazon.names).\n"); - mothurOut("The default value for line and label are all lines in your inputfile.\n"); + mothurOut("The bin.seqs command parameters are fasta, name, label and group. The fasta parameter is required.\n"); + mothurOut("The label parameter allows you to select what distance levels you would like a output files created for, and are separated by dashes.\n"); + mothurOut("The bin.seqs command should be in the following format: bin.seqs(fasta=yourFastaFile, name=yourNamesFile, group=yourGroupFile, label=yourLabels).\n"); + mothurOut("Example bin.seqs(fasta=amazon.fasta, group=amazon.groups, name=amazon.names).\n"); + mothurOut("The default value for label is all lines in your inputfile.\n"); mothurOut("The bin.seqs command outputs a .fasta file for each distance you specify appending the OTU number to each name.\n"); mothurOut("If you provide a groupfile, then it also appends the sequences group to the name.\n"); mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFastaFile).\n\n"); @@ -137,7 +127,6 @@ int BinSeqCommand::execute(){ try { if (abort == true) { return 0; } - int count = 1; int error = 0; //read fastafile @@ -163,19 +152,17 @@ int BinSeqCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = labels; - set userLines = lines; - while((list != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((list != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(list->getLabel()) == 1){ + if(allLines == 1 || labels.count(list->getLabel()) == 1){ error = process(list); if (error == 1) { return 0; } processedLabels.insert(list->getLabel()); userLabels.erase(list->getLabel()); - userLines.erase(count); } if ((anyLabelsToProcess(list->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { @@ -187,14 +174,12 @@ int BinSeqCommand::execute(){ processedLabels.insert(list->getLabel()); userLabels.erase(list->getLabel()); - } lastLabel = list->getLabel(); delete list; list = input->getListVector(); - count++; } @@ -211,7 +196,7 @@ int BinSeqCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { if (list != NULL) { delete list; } list = input->getListVector(lastLabel); diff --git a/binsequencecommand.h b/binsequencecommand.h index 8ea88cb..a183151 100644 --- a/binsequencecommand.h +++ b/binsequencecommand.h @@ -37,9 +37,8 @@ private: FastaMap* fasta; GroupMap* groupMap; bool abort, allLines; - set lines; //hold lines to be used set labels; //holds labels to be used - string filename, fastafile, namesfile, groupfile, line, label; + string filename, fastafile, namesfile, groupfile, label; ofstream out; ifstream in, inNames; diff --git a/bootstrapsharedcommand.cpp b/bootstrapsharedcommand.cpp index 0c6c53c..0f758c1 100644 --- a/bootstrapsharedcommand.cpp +++ b/bootstrapsharedcommand.cpp @@ -27,7 +27,6 @@ BootSharedCommand::BootSharedCommand(string option){ globaldata = GlobalData::getInstance(); abort = false; allLines = 1; - lines.clear(); labels.clear(); Groups.clear(); Estimators.clear(); @@ -37,7 +36,7 @@ BootSharedCommand::BootSharedCommand(string option){ else { //valid paramters for this command - string Array[] = {"line","label","calc","groups","iters"}; + string Array[] = {"label","calc","groups","iters"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); OptionParser parser(option); @@ -58,13 +57,6 @@ BootSharedCommand::BootSharedCommand(string option){ //check for optional parameter and set defaults // ...at some point should added some additional type checking... - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - } - label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { @@ -72,13 +64,10 @@ BootSharedCommand::BootSharedCommand(string option){ else { allLines = 1; } } - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - //if the user has not specified any line or labels use the ones from read.otu - else if((line == "") && (label == "")) { + //if the user has not specified any labels use the ones from read.otu + if(label == "") { allLines = globaldata->allLines; labels = globaldata->labels; - lines = globaldata->lines; } groups = validParameter.validFile(parameters, "groups", false); @@ -158,11 +147,11 @@ BootSharedCommand::BootSharedCommand(string option){ void BootSharedCommand::help(){ try { mothurOut("The bootstrap.shared command can only be executed after a successful read.otu command.\n"); - mothurOut("The bootstrap.shared command parameters are groups, calc, iters, line and label. You may not use line and label at the same time.\n"); + mothurOut("The bootstrap.shared command parameters are groups, calc, iters and label.\n"); mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included used.\n"); - mothurOut("The group names are separated by dashes. The line and label allow you to select what distance levels you would like trees created for, and are also separated by dashes.\n"); - mothurOut("The bootstrap.shared command should be in the following format: bootstrap.shared(groups=yourGroups, calc=yourCalcs, line=yourLines, label=yourLabels, iters=yourIters).\n"); - mothurOut("Example bootstrap.shared(groups=A-B-C, line=1-3-5, calc=jabund-sorabund, iters=100).\n"); + mothurOut("The group names are separated by dashes. The label parameter allows you to select what distance levels you would like trees created for, and is also separated by dashes.\n"); + mothurOut("The bootstrap.shared command should be in the following format: bootstrap.shared(groups=yourGroups, calc=yourCalcs, label=yourLabels, iters=yourIters).\n"); + mothurOut("Example bootstrap.shared(groups=A-B-C, calc=jabund-sorabund, iters=100).\n"); mothurOut("The default value for groups is all the groups in your groupfile.\n"); mothurOut("The default value for calc is jclass-thetayc. The default for iters is 1000.\n"); } @@ -191,7 +180,6 @@ int BootSharedCommand::execute(){ if (abort == true) { return 0; } - int count = 1; util = new SharedUtil(); //read first line @@ -207,7 +195,6 @@ int BootSharedCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = labels; - set userLines = lines; //set users groups util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups, "treegroup"); @@ -224,19 +211,18 @@ int BootSharedCommand::execute(){ tmap->makeSim(globaldata->gGroupmap); globaldata->gTreemap = tmap; - while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(order->getLabel()) == 1){ + if(allLines == 1 || labels.count(order->getLabel()) == 1){ mothurOut(order->getLabel()); mothurOutEndLine(); process(order); processedLabels.insert(order->getLabel()); userLabels.erase(order->getLabel()); - userLines.erase(count); } - //you have a label the user want that is smaller than this line and the last line has not already been processed + //you have a label the user want that is smaller than this label and the last label has not already been processed if ((anyLabelsToProcess(order->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { delete order; @@ -254,7 +240,6 @@ int BootSharedCommand::execute(){ //get next line to process delete order; order = input->getSharedOrderVector(); - count++; } //output error messages about any remaining user labels @@ -280,8 +265,6 @@ int BootSharedCommand::execute(){ } - - //reset groups parameter globaldata->Groups.clear(); diff --git a/bootstrapsharedcommand.h b/bootstrapsharedcommand.h index cf68e00..794da84 100644 --- a/bootstrapsharedcommand.h +++ b/bootstrapsharedcommand.h @@ -55,9 +55,8 @@ private: vector lookup; bool abort, allLines; - set lines; //hold lines to be used set labels; //holds labels to be used - string outputFile, calc, groups, line, label; + string outputFile, calc, groups, label; int numGroups, iters; vector Estimators, Groups; //holds estimators to be used diff --git a/collect.cpp b/collect.cpp index 2d1f6e3..77d279d 100644 --- a/collect.cpp +++ b/collect.cpp @@ -129,7 +129,7 @@ try { totalNumSeq = i+1; } - //calculate last line if you haven't already + //calculate last label if you haven't already if(numSeqs % increment != 0){ //how many comparisons to make i.e. for group a, b, c = ab, ac, bc. int n = 1; diff --git a/collectcommand.cpp b/collectcommand.cpp index 58aa32c..7d3daef 100644 --- a/collectcommand.cpp +++ b/collectcommand.cpp @@ -36,7 +36,6 @@ CollectCommand::CollectCommand(string option){ globaldata = GlobalData::getInstance(); abort = false; allLines = 1; - lines.clear(); labels.clear(); Estimators.clear(); @@ -45,7 +44,7 @@ CollectCommand::CollectCommand(string option){ else { //valid paramters for this command - string Array[] = {"freq","line","label","calc","abund","size"}; + string Array[] = {"freq","label","calc","abund","size"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); OptionParser parser(option); @@ -63,13 +62,6 @@ CollectCommand::CollectCommand(string option){ //check for optional parameter and set defaults // ...at some point should added some additional type checking... - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - } - label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { @@ -77,13 +69,10 @@ CollectCommand::CollectCommand(string option){ else { allLines = 1; } } - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - //if the user has not specified any line or labels use the ones from read.otu - else if((line == "") && (label == "")) { + //if the user has not specified any labels use the ones from read.otu + if (label == "") { allLines = globaldata->allLines; labels = globaldata->labels; - lines = globaldata->lines; } calc = validParameter.validFile(parameters, "calc", false); @@ -168,13 +157,13 @@ void CollectCommand::help(){ try { mothurOut("The collect.single command can only be executed after a successful read.otu command. WITH ONE EXECEPTION. \n"); mothurOut("The collect.single command can be executed after a successful cluster command. It will use the .list file from the output of the cluster.\n"); - mothurOut("The collect.single command parameters are label, line, freq, calc and abund. No parameters are required, but you may not use \n"); - mothurOut("both the line and label parameters at the same time. The collect.single command should be in the following format: \n"); - mothurOut("collect.single(label=yourLabel, line=yourLines, iters=yourIters, freq=yourFreq, calc=yourEstimators).\n"); - mothurOut("Example collect(label=unique-.01-.03, line=0-5-10, iters=10000, freq=10, calc=sobs-chao-ace-jack).\n"); + mothurOut("The collect.single command parameters are label, freq, calc and abund. No parameters are required. \n"); + mothurOut("The collect.single command should be in the following format: \n"); + mothurOut("collect.single(label=yourLabel, iters=yourIters, freq=yourFreq, calc=yourEstimators).\n"); + mothurOut("Example collect(label=unique-.01-.03, iters=10000, freq=10, calc=sobs-chao-ace-jack).\n"); mothurOut("The default values for freq is 100, and calc are sobs-chao-ace-jack-shannon-npshannon-simpson.\n"); validCalculator->printCalc("single", cout); - mothurOut("The label and line parameters are used to analyze specific lines in your input.\n"); + mothurOut("The label parameter is used to analyze specific labels in your input.\n"); mothurOut("Note: No spaces between parameter labels (i.e. freq), '=' and parameters (i.e.yourFreq).\n\n"); } catch(exception& e) { @@ -201,8 +190,6 @@ int CollectCommand::execute(){ try { if (abort == true) { return 0; } - - int count = 1; //if the users entered no valid calculators don't execute command if (cDisplays.size() == 0) { return 0; } @@ -217,11 +204,10 @@ int CollectCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = labels; - set userLines = lines; - while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(order->getLabel()) == 1){ + if(allLines == 1 || labels.count(order->getLabel()) == 1){ cCurve = new Collect(order, cDisplays); cCurve->getCurve(freq); @@ -230,11 +216,10 @@ int CollectCommand::execute(){ mothurOut(order->getLabel()); mothurOutEndLine(); processedLabels.insert(order->getLabel()); userLabels.erase(order->getLabel()); - userLines.erase(count); - //you have a label the user want that is smaller than this line and the last line has not already been processed - } + } + //you have a label the user want that is smaller than this label and the last label has not already been processed if ((anyLabelsToProcess(order->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { delete order; @@ -253,7 +238,6 @@ int CollectCommand::execute(){ delete order; order = (input->getOrderVector()); - count++; } //output error messages about any remaining user labels @@ -269,7 +253,7 @@ int CollectCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { if (order != NULL) { delete order; } order = (input->getOrderVector(lastLabel)); diff --git a/collectcommand.h b/collectcommand.h index b099c8a..10894e7 100644 --- a/collectcommand.h +++ b/collectcommand.h @@ -22,13 +22,13 @@ The collect command generates a collector's curve from the given file. The collect command can only be executed after a successful read.list, read.sabund or read.rabund command, with one exception. The collect command can be executed after a successful cluster command. It will use the .list file from the output of the cluster. - The collect command outputs a file for each estimator you choose to use. The collect command parameters are label, line, freq, single, abund. - No parameters are required, but you may not use both the line and label parameters at the same time. - The collect command should be in the following format: collect(label=yourLabel, line=yourLines, freq=yourFreq, single=yourEstimators, abund=yourAbund). - example collect(label=unique-.01-.03, line=0,5,10, freq=10, single=collect-chao-ace-jack). + The collect command outputs a file for each estimator you choose to use. The collect command parameters are label, freq, single, abund. + No parameters are required. + The collect command should be in the following format: collect(label=yourLabel, freq=yourFreq, single=yourEstimators, abund=yourAbund). + example collect(label=unique-.01-.03, freq=10, single=collect-chao-ace-jack). The default values for freq is 100, for abund is 10, and single are collect-chao-ace-jack-bootstrap-shannon-npshannon-simpson. The valid single estimators are: collect-chao-ace-jack-bootstrap-shannon-npshannon-simpson. - The label and line parameters are used to analyze specific lines in your input. */ + The label parameter is used to analyze specific labels in your input. */ @@ -53,9 +53,8 @@ private: int freq, abund, size; bool abort, allLines; - set lines; //hold lines to be used set labels; //holds labels to be used - string line, label, calc; + string label, calc; vector Estimators; diff --git a/collectsharedcommand.cpp b/collectsharedcommand.cpp index 697bc53..18faa2d 100644 --- a/collectsharedcommand.cpp +++ b/collectsharedcommand.cpp @@ -41,7 +41,6 @@ CollectSharedCommand::CollectSharedCommand(string option){ globaldata = GlobalData::getInstance(); abort = false; allLines = 1; - lines.clear(); labels.clear(); Estimators.clear(); Groups.clear(); @@ -51,7 +50,7 @@ CollectSharedCommand::CollectSharedCommand(string option){ else { //valid paramters for this command - string Array[] = {"freq","line","label","calc","groups"}; + string Array[] = {"freq","label","calc","groups"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); OptionParser parser(option); @@ -72,14 +71,7 @@ CollectSharedCommand::CollectSharedCommand(string option){ //check for optional parameter and set defaults - // ...at some point should added some additional type checking... - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - } - + // ...at some point should added some additional type checking.. label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { @@ -87,13 +79,10 @@ CollectSharedCommand::CollectSharedCommand(string option){ else { allLines = 1; } } - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - //if the user has not specified any line or labels use the ones from read.otu - else if((line == "") && (label == "")) { + //if the user has not specified any labels use the ones from read.otu + if(label == "") { allLines = globaldata->allLines; labels = globaldata->labels; - lines = globaldata->lines; } calc = validParameter.validFile(parameters, "calc", false); @@ -184,14 +173,14 @@ CollectSharedCommand::CollectSharedCommand(string option){ void CollectSharedCommand::help(){ try { mothurOut("The collect.shared command can only be executed after a successful read.otu command.\n"); - mothurOut("The collect.shared command parameters are label, line, freq, calc and groups. No parameters are required, but you may not use \n"); - mothurOut("both the line and label parameters at the same time. The collect.shared command should be in the following format: \n"); - mothurOut("collect.shared(label=yourLabel, line=yourLines, freq=yourFreq, calc=yourEstimators, groups=yourGroups).\n"); - mothurOut("Example collect.shared(label=unique-.01-.03, line=0-5-10, freq=10, groups=B-C, calc=sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan).\n"); + mothurOut("The collect.shared command parameters are label, freq, calc and groups. No parameters are required \n"); + mothurOut("The collect.shared command should be in the following format: \n"); + mothurOut("collect.shared(label=yourLabel, freq=yourFreq, calc=yourEstimators, groups=yourGroups).\n"); + mothurOut("Example collect.shared(label=unique-.01-.03, freq=10, groups=B-C, calc=sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan).\n"); mothurOut("The default values for freq is 100 and calc are sharedsobs-sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan.\n"); mothurOut("The default value for groups is all the groups in your groupfile.\n"); validCalculator->printCalc("shared", cout); - mothurOut("The label and line parameters are used to analyze specific lines in your input.\n"); + mothurOut("The label parameter is used to analyze specific labels in your input.\n"); mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed. You must enter at least 2 valid groups.\n"); mothurOut("Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListfile).\n\n"); @@ -221,8 +210,6 @@ int CollectSharedCommand::execute(){ if (abort == true) { return 0; } - int count = 1; - //if the users entered no valid calculators don't execute command if (cDisplays.size() == 0) { return 0; } @@ -236,15 +223,14 @@ int CollectSharedCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = labels; - set userLines = lines; //set users groups util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups, "collect"); util->updateGroupIndex(globaldata->Groups, globaldata->gGroupmap->groupIndex); - while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(order->getLabel()) == 1){ + if(allLines == 1 || labels.count(order->getLabel()) == 1){ //create collectors curve cCurve = new Collect(order, cDisplays); @@ -254,10 +240,9 @@ int CollectSharedCommand::execute(){ mothurOut(order->getLabel()); mothurOutEndLine(); processedLabels.insert(order->getLabel()); userLabels.erase(order->getLabel()); - userLines.erase(count); } - //you have a label the user want that is smaller than this line and the last line has not already been processed + //you have a label the user want that is smaller than this label and the last label has not already been processed if ((anyLabelsToProcess(order->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { delete order; order = input->getSharedOrderVector(lastLabel); @@ -278,7 +263,6 @@ int CollectSharedCommand::execute(){ //get next line to process delete order; order = input->getSharedOrderVector(); - count++; } //output error messages about any remaining user labels @@ -294,7 +278,7 @@ int CollectSharedCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { if (order != NULL) { delete order; } order = input->getSharedOrderVector(lastLabel); diff --git a/collectsharedcommand.h b/collectsharedcommand.h index 67e8e0c..e8b7b96 100644 --- a/collectsharedcommand.h +++ b/collectsharedcommand.h @@ -21,19 +21,6 @@ #include "validcalculator.h" #include "sharedutilities.h" -/* The collect.shared() command: - The collect command generates a collector's curve from the given file representing several groups. - The collect.shared command can only be executed after a successful read.shared command. - It outputs a file for each estimator you choose to use. The collect.shared command parameters are label, line, freq and shared. - No parameters are required, but you may not use both the line and label parameters at the same time. - The collect.shared command should be in the following format: collect.shared(label=yourLabel, line=yourLines, - freq=yourFreq, shared=yourEstimators). Example collect.shared(label=unique-.01-.03, line=0,5,10, freq=10, - shared=sharedChao-sharedAce-sharedJabund). The default value for - freq is 100 and shared are sharedChao-sharedAce-sharedJabund-sharedSorensonAbund-sharedJclass-sharedSorClass-sharedJest-sharedSorEst-SharedThetaYC-SharedThetaN. - The valid shared estimators are: sharedChao-sharedAce-sharedJabund-sharedSorensonAbund-sharedJclass-sharedSorClass-sharedJest-sharedSorEst-SharedThetaYC-SharedThetaN. - The label and line parameters are used to analyze specific lines in your input. */ - - class GlobalData; class CollectSharedCommand : public Command { @@ -59,9 +46,8 @@ private: string format; bool abort, allLines; - set lines; //hold lines to be used set labels; //holds labels to be used - string line, label, calc, groups; + string label, calc, groups; vector Estimators, Groups; diff --git a/getoturepcommand.cpp b/getoturepcommand.cpp index 441e824..0748619 100644 --- a/getoturepcommand.cpp +++ b/getoturepcommand.cpp @@ -15,7 +15,6 @@ GetOTURepCommand::GetOTURepCommand(string option){ globaldata = GlobalData::getInstance(); abort = false; allLines = 1; - lines.clear(); labels.clear(); //allow user to run help @@ -23,7 +22,7 @@ GetOTURepCommand::GetOTURepCommand(string option){ help(); abort = true; } else { //valid paramters for this command - string Array[] = {"fasta","list","line","label","name", "group"}; + string Array[] = {"fasta","list","label","name", "group"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); OptionParser parser(option); @@ -53,13 +52,6 @@ GetOTURepCommand::GetOTURepCommand(string option){ //check for optional parameter and set defaults // ...at some point should added some additional type checking... - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - } - label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { @@ -67,13 +59,10 @@ GetOTURepCommand::GetOTURepCommand(string option){ else { allLines = 1; } } - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - //if the user has not specified any line or labels use the ones from read.otu - else if ((line == "") && (label == "")) { + //if the user has not specified any labels use the ones from read.otu + if (label == "") { allLines = globaldata->allLines; labels = globaldata->labels; - lines = globaldata->lines; } namesfile = validParameter.validFile(parameters, "name", true); @@ -136,11 +125,11 @@ GetOTURepCommand::GetOTURepCommand(string option){ void GetOTURepCommand::help(){ try { mothurOut("The get.oturep command can only be executed after a successful read.dist command.\n"); - mothurOut("The get.oturep command parameters are list, fasta, name, group, line and label. The fasta and list parameters are required, and you may not use line and label at the same time.\n"); - mothurOut("The line and label allow you to select what distance levels you would like a output files created for, and are separated by dashes.\n"); - mothurOut("The get.oturep command should be in the following format: get.oturep(fasta=yourFastaFile, list=yourListFile, name=yourNamesFile, group=yourGroupFile, line=yourLines, label=yourLabels).\n"); - mothurOut("Example get.oturep(fasta=amazon.fasta, list=amazon.fn.list, group=amazon.groups, line=1-3-5, name=amazon.names).\n"); - mothurOut("The default value for line and label are all lines in your inputfile.\n"); + mothurOut("The get.oturep command parameters are list, fasta, name, group and label. The fasta and list parameters are required.\n"); + mothurOut("The label parameter allows you to select what distance levels you would like a output files created for, and is separated by dashes.\n"); + mothurOut("The get.oturep command should be in the following format: get.oturep(fasta=yourFastaFile, list=yourListFile, name=yourNamesFile, group=yourGroupFile, label=yourLabels).\n"); + mothurOut("Example get.oturep(fasta=amazon.fasta, list=amazon.fn.list, group=amazon.groups, name=amazon.names).\n"); + mothurOut("The default value for label is all labels in your inputfile.\n"); mothurOut("The get.oturep command outputs a .fastarep file for each distance you specify, selecting one OTU representative for each bin.\n"); mothurOut("If you provide a groupfile, then it also appends the names of the groups present in that bin.\n"); mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFastaFile).\n\n"); @@ -171,7 +160,6 @@ int GetOTURepCommand::execute(){ if (abort == true) { return 0; } - int count = 1; int error; //read fastafile @@ -198,19 +186,16 @@ int GetOTURepCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = labels; - set userLines = lines; - - while((list != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((list != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if (allLines == 1 || lines.count(count) == 1 || labels.count(list->getLabel()) == 1){ + if (allLines == 1 || labels.count(list->getLabel()) == 1){ mothurOut(list->getLabel() + "\t" + toString(list->size())); mothurOutEndLine(); error = process(list); if (error == 1) { return 0; } //there is an error in hte input files, abort command processedLabels.insert(list->getLabel()); userLabels.erase(list->getLabel()); - userLines.erase(count); } if ((anyLabelsToProcess(list->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { @@ -228,7 +213,6 @@ int GetOTURepCommand::execute(){ delete list; list = input->getListVector(); - count++; } //output error messages about any remaining user labels @@ -243,7 +227,7 @@ int GetOTURepCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { if (list != NULL) { delete list; } list = input->getListVector(lastLabel); @@ -332,7 +316,7 @@ string GetOTURepCommand::findRep(int bin, string& group, ListVector* thisList, i group = group.substr(0, group.length()-1); } - // if only 1 sequence in bin or processing the "unique" line, then + // if only 1 sequence in bin or processing the "unique" label, then // the first sequence of the OTU is the representative one if ((names.size() == 1) || (list->getLabel() == "unique")) { return names[0]; diff --git a/getoturepcommand.h b/getoturepcommand.h index 4f755d0..a48cbf1 100644 --- a/getoturepcommand.h +++ b/getoturepcommand.h @@ -39,13 +39,12 @@ private: InputData* input; FastaMap* fasta; GroupMap* groupMap; - string filename, fastafile, listfile, namesfile, groupfile, line, label; + string filename, fastafile, listfile, namesfile, groupfile, label; ofstream out; ifstream in, inNames; bool groupError; bool abort, allLines; - set lines; //hold lines to be used set labels; //holds labels to be used map nameToIndex; //maps sequence name to index in sparsematrix diff --git a/getrabundcommand.cpp b/getrabundcommand.cpp index dd4fdd5..04b1b0b 100644 --- a/getrabundcommand.cpp +++ b/getrabundcommand.cpp @@ -16,7 +16,6 @@ GetRAbundCommand::GetRAbundCommand(string option){ globaldata = GlobalData::getInstance(); abort = false; allLines = 1; - lines.clear(); labels.clear(); //allow user to run help @@ -24,7 +23,7 @@ GetRAbundCommand::GetRAbundCommand(string option){ else { //valid paramters for this command - string Array[] = {"line","label","sorted"}; + string Array[] = {"label","sorted"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); OptionParser parser(option); @@ -47,13 +46,6 @@ GetRAbundCommand::GetRAbundCommand(string option){ temp = validParameter.validFile(parameters, "sorted", false); if (temp == "not found") { temp = "T"; } sorted = isTrue(temp); - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - } - label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { @@ -61,13 +53,10 @@ GetRAbundCommand::GetRAbundCommand(string option){ else { allLines = 1; } } - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - //if the user has not specified any line or labels use the ones from read.otu - else if((line == "") && (label == "")) { + //if the user has not specified any labels use the ones from read.otu + if(label == "") { allLines = globaldata->allLines; labels = globaldata->labels; - lines = globaldata->lines; } if (abort == false) { @@ -87,14 +76,14 @@ GetRAbundCommand::GetRAbundCommand(string option){ void GetRAbundCommand::help(){ try { mothurOut("The get.rabund command can only be executed after a successful read.otu of a listfile.\n"); - mothurOut("The get.rabund command parameters are line, label and sorted. No parameters are required, and you may not use line and label at the same time.\n"); - mothurOut("The line and label allow you to select what distance levels you would like included in your .rabund file, and are separated by dashes.\n"); + mothurOut("The get.rabund command parameters are label and sorted. No parameters are required.\n"); + mothurOut("The label parameter allows you to select what distance levels you would like included in your .rabund file, and are separated by dashes.\n"); mothurOut("The sorted parameters allows you to print the rabund results sorted by abundance or not. The default is sorted.\n"); - mothurOut("The get.rabund command should be in the following format: get.rabund(line=yourLines, label=yourLabels, sorted=yourSorted).\n"); - mothurOut("Example get.rabund(line=1-3-5, sorted=F).\n"); - mothurOut("The default value for line and label are all lines in your inputfile.\n"); + mothurOut("The get.rabund command should be in the following format: get.rabund(label=yourLabels, sorted=yourSorted).\n"); + mothurOut("Example get.rabund(sorted=F).\n"); + mothurOut("The default value for label is all labels in your inputfile.\n"); mothurOut("The get.rabund command outputs a .rabund file containing the lines you selected.\n"); - mothurOut("Note: No spaces between parameter labels (i.e. line), '=' and parameters (i.e.yourLines).\n\n"); + mothurOut("Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabels).\n\n"); } catch(exception& e) { errorOut(e, "GetRAbundCommand", "help"); @@ -115,8 +104,6 @@ int GetRAbundCommand::execute(){ if (abort == true) { return 0; } - int count = 1; - //read first line read = new ReadOTUFile(globaldata->inputFileName); read->read(&*globaldata); @@ -128,12 +115,10 @@ int GetRAbundCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = labels; - set userLines = lines; - - while((list != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((list != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(list->getLabel()) == 1){ + if(allLines == 1 || labels.count(list->getLabel()) == 1){ mothurOut(list->getLabel()); mothurOutEndLine(); rabund = new RAbundVector(); *rabund = (list->getRAbundVector()); @@ -145,7 +130,6 @@ int GetRAbundCommand::execute(){ processedLabels.insert(list->getLabel()); userLabels.erase(list->getLabel()); - userLines.erase(count); } if ((anyLabelsToProcess(list->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { @@ -169,7 +153,6 @@ int GetRAbundCommand::execute(){ delete list; list = input->getListVector(); - count++; } //output error messages about any remaining user labels @@ -185,7 +168,7 @@ int GetRAbundCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { if (list != NULL) { delete list; } list = input->getListVector(lastLabel); diff --git a/getrabundcommand.h b/getrabundcommand.h index 92e8475..ed51be1 100644 --- a/getrabundcommand.h +++ b/getrabundcommand.h @@ -35,9 +35,8 @@ private: RAbundVector* rabund; bool abort, allLines, sorted; - set lines; //hold lines to be used set labels; //holds labels to be used - string line, label; + string label; }; diff --git a/getsabundcommand.cpp b/getsabundcommand.cpp index 8cbb9d4..80a4429 100644 --- a/getsabundcommand.cpp +++ b/getsabundcommand.cpp @@ -16,7 +16,6 @@ GetSAbundCommand::GetSAbundCommand(string option){ globaldata = GlobalData::getInstance(); abort = false; allLines = 1; - lines.clear(); labels.clear(); //allow user to run help @@ -24,7 +23,7 @@ GetSAbundCommand::GetSAbundCommand(string option){ else { //valid paramters for this command - string Array[] = {"line","label"}; + string Array[] = {"label"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); OptionParser parser(option); @@ -42,13 +41,6 @@ GetSAbundCommand::GetSAbundCommand(string option){ //check for optional parameter and set defaults // ...at some point should added some additional type checking... - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - } - label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { @@ -56,13 +48,10 @@ GetSAbundCommand::GetSAbundCommand(string option){ else { allLines = 1; } } - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - //if the user has not specified any line or labels use the ones from read.otu - else if((line == "") && (label == "")) { + //if the user has not specified any labels use the ones from read.otu + if(label == "") { allLines = globaldata->allLines; labels = globaldata->labels; - lines = globaldata->lines; } if (abort == false) { @@ -82,13 +71,13 @@ GetSAbundCommand::GetSAbundCommand(string option){ void GetSAbundCommand::help(){ try { mothurOut("The get.sabund command can only be executed after a successful read.otu of a listfile or rabundfile.\n"); - mothurOut("The get.sabund command parameters are line and label. No parameters are required, and you may not use line and label at the same time.\n"); - mothurOut("The line and label allow you to select what distance levels you would like included in your .sabund file, and are separated by dashes.\n"); - mothurOut("The get.sabund command should be in the following format: get.sabund(line=yourLines, label=yourLabels).\n"); - mothurOut("Example get.sabund(line=1-3-5).\n"); - mothurOut("The default value for line and label are all lines in your inputfile.\n"); - mothurOut("The get.sabund command outputs a .sabund file containing the lines you selected.\n"); - mothurOut("Note: No spaces between parameter labels (i.e. line), '=' and parameters (i.e.yourLines).\n\n"); + mothurOut("The get.sabund command parameters is label. No parameters are required.\n"); + mothurOut("The label parameter allows you to select what distance levels you would like included in your .sabund file, and are separated by dashes.\n"); + mothurOut("The get.sabund command should be in the following format: get.sabund(label=yourLabels).\n"); + mothurOut("Example get.sabund().\n"); + mothurOut("The default value for label is all labels in your inputfile.\n"); + mothurOut("The get.sabund command outputs a .sabund file containing the labels you selected.\n"); + mothurOut("Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabel).\n\n"); } catch(exception& e) { errorOut(e, "GetSAbundCommand", "help"); @@ -108,8 +97,6 @@ int GetSAbundCommand::execute(){ if (abort == true) { return 0; } - int count = 1; - //using order vector so you don't have to distinguish between the list and rabund files read = new ReadOTUFile(globaldata->inputFileName); read->read(&*globaldata); @@ -121,12 +108,10 @@ int GetSAbundCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = labels; - set userLines = lines; - - while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(order->getLabel()) == 1){ + if(allLines == 1 || labels.count(order->getLabel()) == 1){ mothurOut(order->getLabel()); mothurOutEndLine(); sabund = new SAbundVector(); *sabund = (order->getSAbundVector()); @@ -135,7 +120,6 @@ int GetSAbundCommand::execute(){ processedLabels.insert(order->getLabel()); userLabels.erase(order->getLabel()); - userLines.erase(count); } if ((anyLabelsToProcess(order->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { @@ -157,7 +141,6 @@ int GetSAbundCommand::execute(){ delete order; order = (input->getOrderVector()); - count++; } //output error messages about any remaining user labels @@ -173,7 +156,7 @@ int GetSAbundCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { if (order != NULL) { delete order; } order = (input->getOrderVector(lastLabel)); diff --git a/getsabundcommand.h b/getsabundcommand.h index 2612b7d..e2ea5d2 100644 --- a/getsabundcommand.h +++ b/getsabundcommand.h @@ -35,9 +35,8 @@ private: SAbundVector* sabund; bool abort, allLines; - set lines; //hold lines to be used set labels; //holds labels to be used - string line, label; + string label; }; diff --git a/globaldata.cpp b/globaldata.cpp index 155aad5..690a8c3 100644 --- a/globaldata.cpp +++ b/globaldata.cpp @@ -119,7 +119,7 @@ void GlobalData::newRead() { gTree.clear(); Treenames.clear(); - labels.clear(); lines.clear(); Groups.clear(); + labels.clear(); Groups.clear(); allLines = 1; runParse = true; } diff --git a/globaldata.hpp b/globaldata.hpp index 759bcae..e125e6f 100644 --- a/globaldata.hpp +++ b/globaldata.hpp @@ -44,7 +44,6 @@ public: string inputFileName, argv; bool allLines, runParse, jumble; vector Estimators, Groups; //holds estimators to be used - set lines; //hold lines to be used set labels; //holds labels to be used vector Treenames; diff --git a/heatmapcommand.cpp b/heatmapcommand.cpp index e2fdc64..52395bb 100644 --- a/heatmapcommand.cpp +++ b/heatmapcommand.cpp @@ -17,7 +17,6 @@ HeatMapCommand::HeatMapCommand(string option){ globaldata = GlobalData::getInstance(); abort = false; allLines = 1; - lines.clear(); labels.clear(); //allow user to run help @@ -25,7 +24,7 @@ HeatMapCommand::HeatMapCommand(string option){ else { //valid paramters for this command - string AlignArray[] = {"groups","line","label","sorted","scale"}; + string AlignArray[] = {"groups","label","sorted","scale"}; vector myArray (AlignArray, AlignArray+(sizeof(AlignArray)/sizeof(string))); OptionParser parser(option); @@ -45,13 +44,6 @@ HeatMapCommand::HeatMapCommand(string option){ //check for optional parameter and set defaults // ...at some point should added some additional type checking... - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - } - label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { @@ -59,13 +51,10 @@ HeatMapCommand::HeatMapCommand(string option){ else { allLines = 1; } } - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - //if the user has not specified any line or labels use the ones from read.otu - else if ((line == "") && (label == "")) { + //if the user has not specified any labels use the ones from read.otu + if (label == "") { allLines = globaldata->allLines; labels = globaldata->labels; - lines = globaldata->lines; } groups = validParameter.validFile(parameters, "groups", false); @@ -97,17 +86,17 @@ HeatMapCommand::HeatMapCommand(string option){ void HeatMapCommand::help(){ try { mothurOut("The heatmap.bin command can only be executed after a successful read.otu command.\n"); - mothurOut("The heatmap.bin command parameters are groups, sorted, scale, line and label. No parameters are required, but you may not use line and label at the same time.\n"); + mothurOut("The heatmap.bin command parameters are groups, sorted, scale label. No parameters are required.\n"); mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included in your heatmap.\n"); mothurOut("The sorted parameter allows you to choose to see the file with the shared otus at the top or the otus in the order they appear in your input file. \n"); mothurOut("The scale parameter allows you to choose the range of color your bin information will be displayed with.\n"); - mothurOut("The group names are separated by dashes. The line and label allow you to select what distance levels you would like a heatmap created for, and are also separated by dashes.\n"); - mothurOut("The heatmap.bin command should be in the following format: heatmap.bin(groups=yourGroups, sorted=yourSorted, line=yourLines, label=yourLabels).\n"); - mothurOut("Example heatmap.bin(groups=A-B-C, line=1-3-5, sorted=F, scale=log10).\n"); - mothurOut("The default value for groups is all the groups in your groupfile, and all lines in your inputfile will be used.\n"); + mothurOut("The group names are separated by dashes. The label parameter allows you to select what distance levels you would like a heatmap created for, and are also separated by dashes.\n"); + mothurOut("The heatmap.bin command should be in the following format: heatmap.bin(groups=yourGroups, sorted=yourSorted, label=yourLabels).\n"); + mothurOut("Example heatmap.bin(groups=A-B-C, sorted=F, scale=log10).\n"); + mothurOut("The default value for groups is all the groups in your groupfile, and all labels in your inputfile will be used.\n"); mothurOut("The default value for sorted is T meaning you want the shared otus on top, you may change it to F meaning the exact representation of your input file.\n"); mothurOut("The default value for scale is log10; your other options are log2 and linear.\n"); - mothurOut("The heatmap.bin command outputs a .svg file for each line or label you specify.\n"); + mothurOut("The heatmap.bin command outputs a .svg file for each label you specify.\n"); mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n"); } @@ -133,7 +122,6 @@ int HeatMapCommand::execute(){ if (abort == true) { return 0; } - int count = 1; string lastLabel; if (format == "sharedfile") { @@ -159,21 +147,19 @@ int HeatMapCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = labels; - set userLines = lines; if ((format != "list") && (format != "rabund") && (format != "sabund")) { //as long as you are not at the end of the file or done wih the lines you want - while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(lookup[0]->getLabel()) == 1){ + if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){ mothurOut(lookup[0]->getLabel()); mothurOutEndLine(); heatmap->getPic(lookup); processedLabels.insert(lookup[0]->getLabel()); userLabels.erase(lookup[0]->getLabel()); - userLines.erase(count); } if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { @@ -193,7 +179,6 @@ int HeatMapCommand::execute(){ //get next line to process lookup = input->getSharedRAbundVectors(); - count++; } //output error messages about any remaining user labels @@ -209,7 +194,7 @@ int HeatMapCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { for (int i = 0; i < lookup.size(); i++) { if (lookup[i] != NULL) { delete lookup[i]; } } lookup = input->getSharedRAbundVectors(lastLabel); @@ -226,16 +211,15 @@ int HeatMapCommand::execute(){ }else{ - while((rabund != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((rabund != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(rabund->getLabel()) == 1){ + if(allLines == 1 || labels.count(rabund->getLabel()) == 1){ mothurOut(rabund->getLabel()); mothurOutEndLine(); heatmap->getPic(rabund); processedLabels.insert(rabund->getLabel()); userLabels.erase(rabund->getLabel()); - userLines.erase(count); } if ((anyLabelsToProcess(rabund->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { @@ -255,7 +239,6 @@ int HeatMapCommand::execute(){ lastLabel = rabund->getLabel(); delete rabund; rabund = input->getRAbundVector(); - count++; } //output error messages about any remaining user labels @@ -271,7 +254,7 @@ int HeatMapCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { if (rabund != NULL) { delete rabund; } diff --git a/heatmapcommand.h b/heatmapcommand.h index 6d6c1d5..5c00b28 100644 --- a/heatmapcommand.h +++ b/heatmapcommand.h @@ -38,9 +38,8 @@ private: HeatMap* heatmap; bool abort, allLines; - set lines; //hold lines to be used set labels; //holds labels to be used - string format, groups, sorted, scale, line, label; + string format, groups, sorted, scale, label; vector Groups; diff --git a/heatmapsimcommand.cpp b/heatmapsimcommand.cpp index 004a3bf..d88bec0 100644 --- a/heatmapsimcommand.cpp +++ b/heatmapsimcommand.cpp @@ -27,7 +27,6 @@ HeatMapSimCommand::HeatMapSimCommand(string option){ globaldata = GlobalData::getInstance(); abort = false; allLines = 1; - lines.clear(); labels.clear(); Groups.clear(); Estimators.clear(); @@ -37,7 +36,7 @@ HeatMapSimCommand::HeatMapSimCommand(string option){ else { //valid paramters for this command - string AlignArray[] = {"groups","line","label", "calc"}; + string AlignArray[] = {"groups","label", "calc"}; vector myArray (AlignArray, AlignArray+(sizeof(AlignArray)/sizeof(string))); OptionParser parser(option); @@ -57,13 +56,6 @@ HeatMapSimCommand::HeatMapSimCommand(string option){ //check for optional parameter and set defaults // ...at some point should added some additional type checking... - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - } - label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { @@ -71,13 +63,10 @@ HeatMapSimCommand::HeatMapSimCommand(string option){ else { allLines = 1; } } - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - //if the user has not specified any line or labels use the ones from read.otu - else if ((line == "") && (label == "")) { + //if the user has not specified any labels use the ones from read.otu + if (label == "") { allLines = globaldata->allLines; labels = globaldata->labels; - lines = globaldata->lines; } calc = validParameter.validFile(parameters, "calc", false); @@ -142,15 +131,15 @@ HeatMapSimCommand::HeatMapSimCommand(string option){ void HeatMapSimCommand::help(){ try { mothurOut("The heatmap.sim command can only be executed after a successful read.otu command.\n"); - mothurOut("The heatmap.sim command parameters are groups, calc, line and label. No parameters are required, but you may not use line and label at the same time.\n"); + mothurOut("The heatmap.sim command parameters are groups, calc and label. No parameters are required.\n"); mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included in your heatmap.\n"); - mothurOut("The group names are separated by dashes. The line and label allow you to select what distance levels you would like a heatmap created for, and are also separated by dashes.\n"); - mothurOut("The heatmap.sim command should be in the following format: heatmap.sim(groups=yourGroups, calc=yourCalc, line=yourLines, label=yourLabels).\n"); - mothurOut("Example heatmap.sim(groups=A-B-C, line=1-3-5, calc=jabund).\n"); - mothurOut("The default value for groups is all the groups in your groupfile, and all lines in your inputfile will be used.\n"); + mothurOut("The group names are separated by dashes. The label parameter allows you to select what distance levels you would like a heatmap created for, and is also separated by dashes.\n"); + mothurOut("The heatmap.sim command should be in the following format: heatmap.sim(groups=yourGroups, calc=yourCalc, label=yourLabels).\n"); + mothurOut("Example heatmap.sim(groups=A-B-C, calc=jabund).\n"); + mothurOut("The default value for groups is all the groups in your groupfile, and all labels in your inputfile will be used.\n"); validCalculator->printCalc("heat", cout); mothurOut("The default value for calc is jclass-thetayc.\n"); - mothurOut("The heatmap.sim command outputs a .svg file for each calculator you choose at each line or label you specify.\n"); + mothurOut("The heatmap.sim command outputs a .svg file for each calculator you choose at each label you specify.\n"); mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n"); } @@ -178,8 +167,6 @@ int HeatMapSimCommand::execute(){ if (abort == true) { return 0; } - int count = 1; - //if the users entered no valid calculators don't execute command if (heatCalculators.size() == 0) { mothurOut("No valid calculators."); mothurOutEndLine(); return 0; } @@ -196,20 +183,17 @@ int HeatMapSimCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = labels; - set userLines = lines; - //as long as you are not at the end of the file or done wih the lines you want - while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(lookup[0]->getLabel()) == 1){ + if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){ mothurOut(lookup[0]->getLabel()); mothurOutEndLine(); heatmap->getPic(lookup, heatCalculators); processedLabels.insert(lookup[0]->getLabel()); userLabels.erase(lookup[0]->getLabel()); - userLines.erase(count); } if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { @@ -231,7 +215,6 @@ int HeatMapSimCommand::execute(){ //get next line to process for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } lookup = input->getSharedRAbundVectors(); - count++; } //output error messages about any remaining user labels @@ -247,7 +230,7 @@ int HeatMapSimCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { for (int i = 0; i < lookup.size(); i++) { if (lookup[i] != NULL) { delete lookup[i]; } } lookup = input->getSharedRAbundVectors(lastLabel); diff --git a/heatmapsimcommand.h b/heatmapsimcommand.h index 091da26..595f918 100644 --- a/heatmapsimcommand.h +++ b/heatmapsimcommand.h @@ -38,9 +38,8 @@ private: map parameters; map::iterator it; bool abort, allLines; - set lines; //hold lines to be used set labels; //holds labels to be used - string format, groups, line, label, calc; + string format, groups, label, calc; vector Estimators, Groups; diff --git a/matrixoutputcommand.cpp b/matrixoutputcommand.cpp index 9b4935f..6ccbf35 100644 --- a/matrixoutputcommand.cpp +++ b/matrixoutputcommand.cpp @@ -27,7 +27,6 @@ MatrixOutputCommand::MatrixOutputCommand(string option){ globaldata = GlobalData::getInstance(); abort = false; allLines = 1; - lines.clear(); labels.clear(); Groups.clear(); Estimators.clear(); @@ -37,7 +36,7 @@ MatrixOutputCommand::MatrixOutputCommand(string option){ else { //valid paramters for this command - string Array[] = {"line","label","calc","groups"}; + string Array[] = {"label","calc","groups"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); OptionParser parser(option); @@ -58,13 +57,6 @@ MatrixOutputCommand::MatrixOutputCommand(string option){ //check for optional parameter and set defaults // ...at some point should added some additional type checking... - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - } - label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { @@ -72,13 +64,10 @@ MatrixOutputCommand::MatrixOutputCommand(string option){ else { allLines = 1; } } - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - //if the user has not specified any line or labels use the ones from read.otu - else if((line == "") && (label == "")) { + //if the user has not specified any labels use the ones from read.otu + if (label == "") { allLines = globaldata->allLines; labels = globaldata->labels; - lines = globaldata->lines; } groups = validParameter.validFile(parameters, "groups", false); @@ -141,11 +130,11 @@ MatrixOutputCommand::MatrixOutputCommand(string option){ void MatrixOutputCommand::help(){ try { mothurOut("The dist.shared command can only be executed after a successful read.otu command.\n"); - mothurOut("The dist.shared command parameters are groups, calc, line and label. The calc parameter is required, and you may not use line and label at the same time.\n"); + mothurOut("The dist.shared command parameters are groups, calc and label. No parameters are required.\n"); mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included used.\n"); - mothurOut("The group names are separated by dashes. The line and label allow you to select what distance levels you would like distance matrices created for, and are also separated by dashes.\n"); - mothurOut("The dist.shared command should be in the following format: dist.shared(groups=yourGroups, calc=yourCalcs, line=yourLines, label=yourLabels).\n"); - mothurOut("Example dist.shared(groups=A-B-C, line=1-3-5, calc=jabund-sorabund).\n"); + mothurOut("The group names are separated by dashes. The label parameter allows you to select what distance levels you would like distance matrices created for, and is also separated by dashes.\n"); + mothurOut("The dist.shared command should be in the following format: dist.shared(groups=yourGroups, calc=yourCalcs, label=yourLabels).\n"); + mothurOut("Example dist.shared(groups=A-B-C, calc=jabund-sorabund).\n"); mothurOut("The default value for groups is all the groups in your groupfile.\n"); mothurOut("The default value for calc is jclass and thetayc.\n"); validCalculator->printCalc("matrix", cout); @@ -175,9 +164,7 @@ int MatrixOutputCommand::execute(){ try { if (abort == true) { return 0; } - - int count = 1; - + //if the users entered no valid calculators don't execute command if (matrixCalculators.size() == 0) { mothurOut("No valid calculators."); mothurOutEndLine(); return 0; } @@ -192,22 +179,20 @@ int MatrixOutputCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = labels; - set userLines = lines; - + if (lookup.size() < 2) { mothurOut("You have not provided enough valid groups. I cannot run the command."); mothurOutEndLine(); return 0;} numGroups = lookup.size(); //as long as you are not at the end of the file or done wih the lines you want - while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(lookup[0]->getLabel()) == 1){ + if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){ mothurOut(lookup[0]->getLabel()); mothurOutEndLine(); process(lookup); processedLabels.insert(lookup[0]->getLabel()); userLabels.erase(lookup[0]->getLabel()); - userLines.erase(count); } if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { @@ -222,13 +207,11 @@ int MatrixOutputCommand::execute(){ userLabels.erase(lookup[0]->getLabel()); } - lastLabel = lookup[0]->getLabel(); //get next line to process for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } lookup = input->getSharedRAbundVectors(); - count++; } //output error messages about any remaining user labels @@ -244,7 +227,7 @@ int MatrixOutputCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { for (int i = 0; i < lookup.size(); i++) { if (lookup[i] != NULL) { delete lookup[i]; } } lookup = input->getSharedRAbundVectors(lastLabel); diff --git a/matrixoutputcommand.h b/matrixoutputcommand.h index 07743e5..02e8fe6 100644 --- a/matrixoutputcommand.h +++ b/matrixoutputcommand.h @@ -18,7 +18,7 @@ // aka. dist.shared() /* This command create a tree file for each similarity calculator at distance level, using various calculators to find the similiarity between groups. - The user can select the lines or labels they wish to use as well as the groups they would like included. + The user can select the labels they wish to use as well as the groups they would like included. They can also use as many or as few calculators as they wish. */ class GlobalData; @@ -47,9 +47,8 @@ private: ofstream out; bool abort, allLines; - set lines; //hold lines to be used set labels; //holds labels to be used - string outputFile, calc, groups, line, label; + string outputFile, calc, groups, label; vector Estimators, Groups; //holds estimators to be used diff --git a/rarefactcommand.cpp b/rarefactcommand.cpp index 5584b9b..76d6602 100644 --- a/rarefactcommand.cpp +++ b/rarefactcommand.cpp @@ -27,7 +27,6 @@ RareFactCommand::RareFactCommand(string option){ globaldata = GlobalData::getInstance(); abort = false; allLines = 1; - lines.clear(); labels.clear(); Estimators.clear(); @@ -36,7 +35,7 @@ RareFactCommand::RareFactCommand(string option){ else { //valid paramters for this command - string Array[] = {"iters","freq","line","label","calc","abund"}; + string Array[] = {"iters","freq","label","calc","abund"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); OptionParser parser(option); @@ -54,13 +53,6 @@ RareFactCommand::RareFactCommand(string option){ //check for optional parameter and set defaults // ...at some point should added some additional type checking... - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - } - label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { @@ -68,13 +60,10 @@ RareFactCommand::RareFactCommand(string option){ else { allLines = 1; } } - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - //if the user has not specified any line or labels use the ones from read.otu - else if((line == "") && (label == "")) { + //if the user has not specified any labels use the ones from read.otu + if(label == "") { allLines = globaldata->allLines; labels = globaldata->labels; - lines = globaldata->lines; } calc = validParameter.validFile(parameters, "calc", false); @@ -144,13 +133,13 @@ void RareFactCommand::help(){ try { mothurOut("The rarefaction.single command can only be executed after a successful read.otu WTIH ONE EXECEPTION.\n"); mothurOut("The rarefaction.single command can be executed after a successful cluster command. It will use the .list file from the output of the cluster.\n"); - mothurOut("The rarefaction.single command parameters are label, line, iters, freq, calc and abund. No parameters are required, but you may not use \n"); - mothurOut("both the line and label parameters at the same time. The rarefaction.single command should be in the following format: \n"); - mothurOut("rarefaction.single(label=yourLabel, line=yourLines, iters=yourIters, freq=yourFreq, calc=yourEstimators).\n"); - mothurOut("Example rarefaction.single(label=unique-.01-.03, line=0-5-10, iters=10000, freq=10, calc=sobs-rchao-race-rjack-rbootstrap-rshannon-rnpshannon-rsimpson).\n"); + mothurOut("The rarefaction.single command parameters are label, iters, freq, calc and abund. No parameters are required. \n"); + mothurOut("The rarefaction.single command should be in the following format: \n"); + mothurOut("rarefaction.single(label=yourLabel, iters=yourIters, freq=yourFreq, calc=yourEstimators).\n"); + mothurOut("Example rarefaction.single(label=unique-.01-.03, iters=10000, freq=10, calc=sobs-rchao-race-rjack-rbootstrap-rshannon-rnpshannon-rsimpson).\n"); mothurOut("The default values for iters is 1000, freq is 100, and calc is rarefaction which calculates the rarefaction curve for the observed richness.\n"); validCalculator->printCalc("rarefaction", cout); - mothurOut("The label and line parameters are used to analyze specific lines in your input.\n"); + mothurOut("The label parameter is used to analyze specific labels in your input.\n"); mothurOut("Note: No spaces between parameter labels (i.e. freq), '=' and parameters (i.e.yourFreq).\n\n"); } catch(exception& e) { @@ -177,8 +166,6 @@ int RareFactCommand::execute(){ if (abort == true) { return 0; } - int count = 1; - //if the users entered no valid calculators don't execute command if (rDisplays.size() == 0) { return 0; } @@ -192,12 +179,11 @@ int RareFactCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = labels; - set userLines = lines; //as long as you are not at the end of the file or done wih the lines you want - while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(order->getLabel()) == 1){ + if(allLines == 1 || labels.count(order->getLabel()) == 1){ rCurve = new Rarefact(order, rDisplays); rCurve->getCurve(freq, nIters); @@ -206,7 +192,6 @@ int RareFactCommand::execute(){ mothurOut(order->getLabel()); mothurOutEndLine(); processedLabels.insert(order->getLabel()); userLabels.erase(order->getLabel()); - userLines.erase(count); } if ((anyLabelsToProcess(order->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { @@ -226,7 +211,6 @@ int RareFactCommand::execute(){ delete order; order = (input->getOrderVector()); - count++; } //output error messages about any remaining user labels @@ -242,7 +226,7 @@ int RareFactCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { if (order != NULL) { delete order; } order = (input->getOrderVector(lastLabel)); diff --git a/rarefactcommand.h b/rarefactcommand.h index 1bcb0cf..88b0ade 100644 --- a/rarefactcommand.h +++ b/rarefactcommand.h @@ -18,20 +18,6 @@ #include "validcalculator.h" -/*The rarefaction() command: - The rarefaction command generates a rarefaction curve from a given file. - The rarefaction command can only be executed after a successful read.list, read.sabund or read.rabund command, with one exception. - The rarefaction command can be executed after a successful cluster command. It will use the .list file from the output of the cluster. - The rarefaction command outputs a file for each estimator you choose to use. It is recommended to only use rarefaction estimator. - The rarefaction command parameters are label, line, iters, freq, rarefaction. No parameters are required, - but you may not use both the line and label parameters at the same time. The rarefaction command should be in the following format: - rarefaction(label=yourLabel, line=yourLines, iters=yourIters, freq=yourFreq, rarefaction=yourEstimators). - Example rarefaction(label=unique-.01-.03, line=0,5,10, iters=10000, freq=10, rarefaction=rarefaction-rchao-race-rjack-rbootstrap-rshannon-rnpshannon-rsimpson). - The default values for iters is 1000, freq is 100, and rarefaction is rarefaction which calculates the rarefaction curve for the observed richness. - The valid rarefaction estimators are: rarefaction-rchao-race-rjack-rbootstrap-rshannon-rnpshannon-rsimpson. - Rarefaction is the only recommended estimator. The label and line parameters are used to analyze specific lines in your input. */ - - class GlobalData; class RareFactCommand : public Command { @@ -53,9 +39,8 @@ private: int freq, nIters, abund; bool abort, allLines; - set lines; //hold lines to be used set labels; //holds labels to be used - string line, label, calc; + string label, calc; vector Estimators; }; diff --git a/rarefactsharedcommand.cpp b/rarefactsharedcommand.cpp index 7e1b477..022ae65 100644 --- a/rarefactsharedcommand.cpp +++ b/rarefactsharedcommand.cpp @@ -19,7 +19,6 @@ RareFactSharedCommand::RareFactSharedCommand(string option){ abort = false; allLines = 1; - lines.clear(); labels.clear(); Estimators.clear(); Groups.clear(); @@ -29,7 +28,7 @@ RareFactSharedCommand::RareFactSharedCommand(string option){ else { //valid paramters for this command - string Array[] = {"iters","line","label","calc","groups", "jumble"}; + string Array[] = {"iters","label","calc","groups", "jumble"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); OptionParser parser(option); @@ -51,13 +50,6 @@ RareFactSharedCommand::RareFactSharedCommand(string option){ //check for optional parameter and set defaults // ...at some point should added some additional type checking... - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - } - label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { @@ -65,13 +57,10 @@ RareFactSharedCommand::RareFactSharedCommand(string option){ else { allLines = 1; } } - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - //if the user has not specified any line or labels use the ones from read.otu - else if((line == "") && (label == "")) { + //if the user has not specified any labels use the ones from read.otu + if(label == "") { allLines = globaldata->allLines; labels = globaldata->labels; - lines = globaldata->lines; } calc = validParameter.validFile(parameters, "calc", false); @@ -130,14 +119,14 @@ RareFactSharedCommand::RareFactSharedCommand(string option){ void RareFactSharedCommand::help(){ try { mothurOut("The rarefaction.shared command can only be executed after a successful read.otu command.\n"); - mothurOut("The rarefaction.shared command parameters are label, line, iters, groups, jumble and calc. No parameters are required, but you may not use \n"); - mothurOut("both the line and label parameters at the same time. The rarefaction command should be in the following format: \n"); - mothurOut("rarefaction.shared(label=yourLabel, line=yourLines, iters=yourIters, calc=yourEstimators, jumble=yourJumble, groups=yourGroups).\n"); - mothurOut("Example rarefaction.shared(label=unique-.01-.03, line=0-5-10, iters=10000, groups=B-C, jumble=T, calc=sharedobserved).\n"); + mothurOut("The rarefaction.shared command parameters are label, iters, groups, jumble and calc. No parameters are required.\n"); + mothurOut("The rarefaction command should be in the following format: \n"); + mothurOut("rarefaction.shared(label=yourLabel, iters=yourIters, calc=yourEstimators, jumble=yourJumble, groups=yourGroups).\n"); + mothurOut("Example rarefaction.shared(label=unique-0.01-0.03, iters=10000, groups=B-C, jumble=T, calc=sharedobserved).\n"); mothurOut("The default values for iters is 1000, freq is 100, and calc is sharedobserved which calculates the shared rarefaction curve for the observed richness.\n"); mothurOut("The default value for groups is all the groups in your groupfile, and jumble is true.\n"); validCalculator->printCalc("sharedrarefaction", cout); - mothurOut("The label and line parameters are used to analyze specific lines in your input.\n"); + mothurOut("The label parameter is used to analyze specific labels in your input.\n"); mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed. You must enter at least 2 valid groups.\n"); mothurOut("Note: No spaces between parameter labels (i.e. freq), '=' and parameters (i.e.yourFreq).\n\n"); } @@ -164,8 +153,6 @@ int RareFactSharedCommand::execute(){ if (abort == true) { return 0; } - int count = 1; - //if the users entered no valid calculators don't execute command if (rDisplays.size() == 0) { return 0; } @@ -185,12 +172,11 @@ int RareFactSharedCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = labels; - set userLines = lines; //as long as you are not at the end of the file or done wih the lines you want - while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(lookup[0]->getLabel()) == 1){ + if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){ rCurve = new Rarefact(lookup, rDisplays); rCurve->getSharedCurve(freq, nIters); @@ -199,7 +185,6 @@ int RareFactSharedCommand::execute(){ mothurOut(lookup[0]->getLabel()); mothurOutEndLine(); processedLabels.insert(lookup[0]->getLabel()); userLabels.erase(lookup[0]->getLabel()); - userLines.erase(count); } if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { @@ -221,7 +206,6 @@ int RareFactSharedCommand::execute(){ //get next line to process for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } lookup = input->getSharedRAbundVectors(); - count++; } //output error messages about any remaining user labels @@ -237,7 +221,7 @@ int RareFactSharedCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { for (int i = 0; i < lookup.size(); i++) { if (lookup[i] != NULL) { delete lookup[i]; } } lookup = input->getSharedRAbundVectors(lastLabel); diff --git a/rarefactsharedcommand.h b/rarefactsharedcommand.h index b010957..a141988 100644 --- a/rarefactsharedcommand.h +++ b/rarefactsharedcommand.h @@ -16,18 +16,6 @@ #include "readotu.h" #include "validcalculator.h" -/* The rarefaction.shared() command: - The rarefaction command generates a rarefaction curve from a given file representing several groups. - The rarefaction.shared command can only be executed after a successful read.shared command. It outputs a file for each estimator you choose to use. - The rarefaction.shared command parameters are label, line, iters and sharedrarefaction. - No parameters are required, but you may not use both the line and label parameters at the same time. - The rarefaction command should be in the following format: rarefaction.shared(label=yourLabel, line=yourLines, iters=yourIters, - sharedrarefaction=yourEstimators). Example rarefaction.shared(label=unique-.01-.03, line=0,5,10, iters=10000, - sharedrarefaction =sharedobserved). The default values for - iters is 1000 and sharedrarefaction is sharedobserved which calculates the shared rarefaction curve for the observed richness. - The valid sharedrarefaction estimator is sharedobserved. The label and line parameters are used to analyze specific lines in your input. */ - - class GlobalData; class RareFactSharedCommand : public Command { @@ -50,9 +38,8 @@ private: string format; bool abort, allLines, jumble; - set lines; //hold lines to be used set labels; //holds labels to be used - string line, label, calc, groups; + string label, calc, groups; vector Estimators, Groups; diff --git a/readotucommand.cpp b/readotucommand.cpp index 999d8de..2e2bbc9 100644 --- a/readotucommand.cpp +++ b/readotucommand.cpp @@ -21,7 +21,7 @@ ReadOtuCommand::ReadOtuCommand(string option){ else { //valid paramters for this command - string Array[] = {"list","order","shared", "line", "label","group","sabund", "rabund"}; + string Array[] = {"list","order","shared", "label","group","sabund", "rabund"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); OptionParser parser(option); @@ -77,14 +77,6 @@ ReadOtuCommand::ReadOtuCommand(string option){ //check for optional parameter and set defaults // ...at some point should added some additional type checking... - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - globaldata->lines = lines; - } - label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { @@ -95,9 +87,6 @@ ReadOtuCommand::ReadOtuCommand(string option){ globaldata->allLines = allLines; - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - orderfile = validParameter.validFile(parameters, "order", true); if (orderfile == "not open") { abort = true; } else if (orderfile == "not found") { orderfile = ""; } @@ -123,16 +112,15 @@ void ReadOtuCommand::help(){ try { mothurOut("The read.otu command must be run before you execute a collect.single, rarefaction.single, summary.single, \n"); mothurOut("collect.shared, rarefaction.shared or summary.shared command. Mothur will generate a .list, .rabund and .sabund upon completion of the cluster command \n"); - mothurOut("or you may use your own. The read.otu command parameter options are list, rabund, sabund, shared, group, order, line and label.\n"); + mothurOut("or you may use your own. The read.otu command parameter options are list, rabund, sabund, shared, group, order and label.\n"); mothurOut("The read.otu command can be used in two ways. The first is to read a list, rabund or sabund and run the collect.single, rarefaction.single or summary.single.\n"); mothurOut("For this use the read.otu command should be in the following format: read.otu(list=yourListFile, order=yourOrderFile, label=yourLabels).\n"); mothurOut("The list, rabund or sabund parameter is required, but you may only use one of them.\n"); - mothurOut("The line and label parameters are optional but you may not use both the line and label parameters at the same time.\n"); - mothurOut("The label and line parameters are used to read specific lines in your input.\n"); + mothurOut("The label parameter is used to read specific labels in your input.\n"); mothurOut("The second way to use the read.otu command is to read a list and a group, or a shared so you can use the collect.shared, rarefaction.shared or summary.shared commands.\n"); - mothurOut("In this case the read.otu command should be in the following format: read.otu(list=yourListFile, group=yourGroupFile, line=yourLines) or read.otu(shared=yourSharedFile). \n"); + mothurOut("In this case the read.otu command should be in the following format: read.otu(list=yourListFile, group=yourGroupFile) or read.otu(shared=yourSharedFile). \n"); mothurOut("The list parameter and group paramaters or the shared paremeter is required. When using the command the second way with a list and group file read.otu command parses the .list file\n"); - mothurOut("and separates it into groups. It outputs a .shared file containing the OTU information for each group. The read.otu command also outputs a .list file for each group. \n"); + mothurOut("and separates it into groups. It outputs a .shared file containing the OTU information for each group. The read.otu command also outputs a .rabund file for each group. \n"); mothurOut("Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListfile).\n\n"); } diff --git a/readotucommand.h b/readotucommand.h index 6ec3541..dd0cf3a 100644 --- a/readotucommand.h +++ b/readotucommand.h @@ -15,19 +15,6 @@ #include "groupmap.h" #include "sharedcommand.h" -/* The read.otu must be run before you execute a collect.single, rarefaction.single, summary.single, -collect.shared, rarefaction.shared or summary.shared command. Mothur will generate a .list, .rabund and .sabund -upon completion of the cluster command or you may use your own. The read.otu command parameter options are -listfile, rabundfile, sabundfile, groupfile and orderfile. The reaad.otu command can be used in two ways. -The first is to read a listfile, rabundfile or sabundfile and run the collect.single, rarefaction.single or summary.single. -For this use the read.otu command should be in the following format: read.otu(listfile=yourListFile, orderfile=yourOrderFile). -The listfile, rabundfile or sabundfile parameter is required, but you may only use one of them. -The second way to use the read.otu command is to read a listfile and a groupfile so you can use the collect.shared, -rarefaction.shared or summary.shared commands. In this case the read.otu command should be in the following format: -read.otu(listfile=yourListFile, groupfile=yourGroupFile). The listfile parameter and groupfile paramaters are required. -When using the command the second way read.otu command parses the .list file and separates it into groups. -It outputs a .shared file containing the OTU information for each group. The read.otu command also outputs a .list file for each group. */ - class GlobalData; class ReadOtuCommand : public Command { @@ -39,14 +26,12 @@ public: private: GlobalData* globaldata; - //ReadOTUFile* read; InputData* input; Command* shared; GroupMap* groupMap; - string filename, listfile, orderfile, sharedfile, line, label, groupfile, sabundfile, rabundfile, format; + string filename, listfile, orderfile, sharedfile, label, groupfile, sabundfile, rabundfile, format; bool abort, allLines; - set lines; //hold lines to be used set labels; //holds labels to be used }; diff --git a/sharedcommand.cpp b/sharedcommand.cpp index aba07b2..c3f99d2 100644 --- a/sharedcommand.cpp +++ b/sharedcommand.cpp @@ -51,7 +51,6 @@ int SharedCommand::execute(){ try { //lookup.clear(); - int count = 1; string errorOff = "no error"; //read in listfile @@ -82,13 +81,12 @@ int SharedCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = globaldata->labels; - set userLines = globaldata->lines; - while((SharedList != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((SharedList != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) { - if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(SharedList->getLabel()) == 1){ + if(globaldata->allLines == 1 || globaldata->labels.count(SharedList->getLabel()) == 1){ lookup = SharedList->getSharedRAbundVector(); mothurOut(lookup[0]->getLabel()); mothurOutEndLine(); @@ -98,7 +96,6 @@ int SharedCommand::execute(){ processedLabels.insert(SharedList->getLabel()); userLabels.erase(SharedList->getLabel()); - userLines.erase(count); } if ((anyLabelsToProcess(SharedList->getLabel(), userLabels, errorOff) == true) && (processedLabels.count(lastLabel) != 1)) { @@ -120,8 +117,6 @@ int SharedCommand::execute(){ delete SharedList; SharedList = input->getSharedListVector(); //get new list vector to process - - count++; } //output error messages about any remaining user labels @@ -133,7 +128,7 @@ int SharedCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { if (SharedList != NULL) { delete SharedList; } SharedList = input->getSharedListVector(lastLabel); //get new list vector to process diff --git a/summarycommand.cpp b/summarycommand.cpp index 731a410..a2f79f9 100644 --- a/summarycommand.cpp +++ b/summarycommand.cpp @@ -36,7 +36,6 @@ SummaryCommand::SummaryCommand(string option){ globaldata = GlobalData::getInstance(); abort = false; allLines = 1; - lines.clear(); labels.clear(); Estimators.clear(); @@ -45,7 +44,7 @@ SummaryCommand::SummaryCommand(string option){ else { //valid paramters for this command - string Array[] = {"line","label","calc","abund","size"}; + string Array[] = {"label","calc","abund","size"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); OptionParser parser(option); @@ -63,13 +62,6 @@ SummaryCommand::SummaryCommand(string option){ //check for optional parameter and set defaults // ...at some point should added some additional type checking... - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - } - label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { @@ -77,13 +69,10 @@ SummaryCommand::SummaryCommand(string option){ else { allLines = 1; } } - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - //if the user has not specified any line or labels use the ones from read.otu - else if((line == "") && (label == "")) { + //if the user has not specified any labels use the ones from read.otu + if(label == "") { allLines = globaldata->allLines; labels = globaldata->labels; - lines = globaldata->lines; } calc = validParameter.validFile(parameters, "calc", false); @@ -168,14 +157,14 @@ void SummaryCommand::help(){ try { mothurOut("The summary.single command can only be executed after a successful read.otu WTIH ONE EXECEPTION.\n"); mothurOut("The summary.single command can be executed after a successful cluster command. It will use the .list file from the output of the cluster.\n"); - mothurOut("The summary.single command parameters are label, line, calc, abund. No parameters are required, but you may not use \n"); - mothurOut("both the line and label parameters at the same time. The summary.single command should be in the following format: \n"); - mothurOut("summary.single(label=yourLabel, line=yourLines, calc=yourEstimators).\n"); - mothurOut("Example summary.single(label=unique-.01-.03, line=0,5,10, calc=sobs-chao-ace-jack-bootstrap-shannon-npshannon-simpson).\n"); + mothurOut("The summary.single command parameters are label, calc, abund. No parameters are required.\n"); + mothurOut("The summary.single command should be in the following format: \n"); + mothurOut("summary.single(label=yourLabel, calc=yourEstimators).\n"); + mothurOut("Example summary.single(label=unique-.01-.03, calc=sobs-chao-ace-jack-bootstrap-shannon-npshannon-simpson).\n"); validCalculator->printCalc("summary", cout); mothurOut("The default value calc is sobs-chao-ace-jack-shannon-npshannon-simpson\n"); - mothurOut("The label and line parameters are used to analyze specific lines in your input.\n"); - mothurOut("Note: No spaces between parameter labels (i.e. line), '=' and parameters (i.e.yourLines).\n\n"); + mothurOut("The label parameter is used to analyze specific labels in your input.\n"); + mothurOut("Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabels).\n\n"); } catch(exception& e) { errorOut(e, "SummaryCommand", "help"); @@ -201,8 +190,6 @@ int SummaryCommand::execute(){ if (abort == true) { return 0; } - int count = 1; - //if the users entered no valid calculators don't execute command if (sumCalculators.size() == 0) { return 0; } @@ -230,18 +217,15 @@ int SummaryCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = labels; - set userLines = lines; - - while((sabund != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(sabund->getLabel()) == 1){ + while((sabund != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { + + if(allLines == 1 || labels.count(sabund->getLabel()) == 1){ mothurOut(sabund->getLabel()); mothurOutEndLine(); processedLabels.insert(sabund->getLabel()); userLabels.erase(sabund->getLabel()); - userLines.erase(count); - - + outputFileHandle << sabund->getLabel(); for(int i=0;i data = sumCalculators[i]->getValues(sabund); @@ -272,7 +256,6 @@ int SummaryCommand::execute(){ delete sabund; sabund = input->getSAbundVector(); - count++; } //output error messages about any remaining user labels @@ -288,7 +271,7 @@ int SummaryCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { if (sabund != NULL) { delete sabund; } sabund = input->getSAbundVector(lastLabel); diff --git a/summarycommand.h b/summarycommand.h index b12f76f..6ee8c4a 100644 --- a/summarycommand.h +++ b/summarycommand.h @@ -16,18 +16,6 @@ #include "readotu.h" #include "validcalculator.h" -/* The summary() command: - The summary command can only be executed after a successful read.list, read.sabund or read.rabund command, with one exception. - The summary command can be executed after a successful cluster command. It will use the .list file from the output of the cluster. - The summary command outputs a file for each estimator you choose to use. The summary command parameters are label, line, summary. - No parameters are required, but you may not use both the line and label parameters at the same time. - The summary command should be in the following format: summary(label=yourLabel, line=yourLines, summary=yourEstimators). - Example summary(label=unique-.01-.03, line=0,5,10, summary=collect-chao-ace-jack-bootstrap-shannon-npshannon-simpson). - The default value for summary is collect-chao-ace-jack-bootstrap-shannon-npshannon-simpson. - The valid summary estimators are: collect-chao-ace-jack-bootstrap-shannon-npshannon-simpson. - The label and line parameters are used to analyze specific lines in your input. */ - - class GlobalData; class SummaryCommand : public Command { @@ -50,9 +38,8 @@ private: int abund, size; bool abort, allLines; - set lines; //hold lines to be used set labels; //holds labels to be used - string line, label, calc; + string label, calc; vector Estimators; }; diff --git a/summarysharedcommand.cpp b/summarysharedcommand.cpp index 9f951de..ef0485c 100644 --- a/summarysharedcommand.cpp +++ b/summarysharedcommand.cpp @@ -40,7 +40,6 @@ SummarySharedCommand::SummarySharedCommand(string option){ globaldata = GlobalData::getInstance(); abort = false; allLines = 1; - lines.clear(); labels.clear(); Estimators.clear(); @@ -49,7 +48,7 @@ SummarySharedCommand::SummarySharedCommand(string option){ else { //valid paramters for this command - string Array[] = {"line","label","calc","groups"}; + string Array[] = {"label","calc","groups"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); OptionParser parser(option); @@ -69,13 +68,6 @@ SummarySharedCommand::SummarySharedCommand(string option){ //check for optional parameter and set defaults // ...at some point should added some additional type checking... - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - } - label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { @@ -83,13 +75,10 @@ SummarySharedCommand::SummarySharedCommand(string option){ else { allLines = 1; } } - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - //if the user has not specified any line or labels use the ones from read.otu - else if((line == "") && (label == "")) { + //if the user has not specified any labels use the ones from read.otu + if(label == "") { allLines = globaldata->allLines; labels = globaldata->labels; - lines = globaldata->lines; } calc = validParameter.validFile(parameters, "calc", false); @@ -176,16 +165,16 @@ SummarySharedCommand::SummarySharedCommand(string option){ void SummarySharedCommand::help(){ try { mothurOut("The summary.shared command can only be executed after a successful read.otu command.\n"); - mothurOut("The summary.shared command parameters are label, line and calc. No parameters are required, but you may not use \n"); - mothurOut("both the line and label parameters at the same time. The summary.shared command should be in the following format: \n"); - mothurOut("summary.shared(label=yourLabel, line=yourLines, calc=yourEstimators, groups=yourGroups).\n"); - mothurOut("Example summary.shared(label=unique-.01-.03, line=0,5,10, groups=B-C, calc=sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan).\n"); + mothurOut("The summary.shared command parameters are label and calc. No parameters are required.\n"); + mothurOut("The summary.shared command should be in the following format: \n"); + mothurOut("summary.shared(label=yourLabel, calc=yourEstimators, groups=yourGroups).\n"); + mothurOut("Example summary.shared(label=unique-.01-.03, groups=B-C, calc=sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan).\n"); validCalculator->printCalc("sharedsummary", cout); mothurOut("The default value for calc is sharedsobs-sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan\n"); mothurOut("The default value for groups is all the groups in your groupfile.\n"); - mothurOut("The label and line parameters are used to analyze specific lines in your input.\n"); + mothurOut("The label parameter is used to analyze specific labels in your input.\n"); mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed. You must enter at least 2 valid groups.\n"); - mothurOut("Note: No spaces between parameter labels (i.e. line), '=' and parameters (i.e.yourLines).\n\n"); + mothurOut("Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabel).\n\n"); } catch(exception& e) { errorOut(e, "SummarySharedCommand", "help"); @@ -208,8 +197,6 @@ int SummarySharedCommand::execute(){ try { if (abort == true) { return 0; } - - int count = 1; //if the users entered no valid calculators don't execute command if (sumCalculators.size() == 0) { return 0; } @@ -267,18 +254,16 @@ int SummarySharedCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = labels; - set userLines = lines; - + //as long as you are not at the end of the file or done wih the lines you want - while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(lookup[0]->getLabel()) == 1){ + if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){ mothurOut(lookup[0]->getLabel()); mothurOutEndLine(); process(lookup); processedLabels.insert(lookup[0]->getLabel()); userLabels.erase(lookup[0]->getLabel()); - userLines.erase(count); } if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { @@ -300,7 +285,6 @@ int SummarySharedCommand::execute(){ //prevent memory leak for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } lookup = input->getSharedRAbundVectors(); - count++; } //output error messages about any remaining user labels @@ -316,7 +300,7 @@ int SummarySharedCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { for (int i = 0; i < lookup.size(); i++) { if (lookup[i] != NULL) { delete lookup[i]; } } lookup = input->getSharedRAbundVectors(lastLabel); diff --git a/summarysharedcommand.h b/summarysharedcommand.h index 515c776..119a75c 100644 --- a/summarysharedcommand.h +++ b/summarysharedcommand.h @@ -17,23 +17,8 @@ #include "readotu.h" #include "validcalculator.h" - -/*The summary.shared() command - The summary.shared command can only be executed after a successful read.shared command. - It outputs a file for each estimator you choose to use. The summary.shared command parameters are label, - line and sharedsummary. No parameters are required, but you may not use both the line and label parameters at the same time. - The summary.shared command should be in the following format: summary.shared(label=yourLabel, - line=yourLines, sharedsummary=yourEstimators). - Example summary.shared(label=unique-.01-.03, line=0,5,10, sharedsummary=sharedChao-sharedAce-sharedJabund - -sharedSorensonAbund-sharedJclass-sharedSorClass-sharedJest-sharedSorEst-SharedThetaYC-SharedThetaN). - The default value for sharedsummary is sharedChao-sharedAce-sharedJabund-sharedSorensonAbund-sharedJclass-sharedSorClass-sharedJest-sharedSorEst-SharedThetaYC-SharedThetaN. - The valid sharedsummary estimators are: sharedChao-sharedAce-sharedJabund-sharedSorensonAbund-sharedJclass-sharedSorClass - -sharedJest-sharedSorEst-SharedThetaYC-SharedThetaN. The label and line parameters are used to analyze specific lines in your input. */ - - class GlobalData; - class SummarySharedCommand : public Command { public: @@ -53,9 +38,8 @@ private: map parameters; map::iterator it; bool abort, allLines, mult; - set lines; //hold lines to be used set labels; //holds labels to be used - string line, label, calc, groups; + string label, calc, groups; vector Estimators, Groups; vector lookup; string outputFileName, format, outAllFileName; diff --git a/treegroupscommand.cpp b/treegroupscommand.cpp index 27f701f..d25c46a 100644 --- a/treegroupscommand.cpp +++ b/treegroupscommand.cpp @@ -27,7 +27,6 @@ TreeGroupCommand::TreeGroupCommand(string option){ globaldata = GlobalData::getInstance(); abort = false; allLines = 1; - lines.clear(); labels.clear(); Groups.clear(); Estimators.clear(); @@ -37,7 +36,7 @@ TreeGroupCommand::TreeGroupCommand(string option){ else { //valid paramters for this command - string Array[] = {"line","label","calc","groups", "phylip", "column", "name", "precision","cutoff"}; + string Array[] = {"label","calc","groups", "phylip", "column", "name", "precision","cutoff"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); OptionParser parser(option); @@ -78,13 +77,6 @@ TreeGroupCommand::TreeGroupCommand(string option){ //check for optional parameter and set defaults // ...at some point should added some additional type checking... - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - } - label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { @@ -92,13 +84,10 @@ TreeGroupCommand::TreeGroupCommand(string option){ else { allLines = 1; } } - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - //if the user has not specified any line or labels use the ones from read.otu - else if((line == "") && (label == "")) { + //if the user has not specified any labels use the ones from read.otu + if(label == "") { allLines = globaldata->allLines; labels = globaldata->labels; - lines = globaldata->lines; } groups = validParameter.validFile(parameters, "groups", false); @@ -172,13 +161,13 @@ void TreeGroupCommand::help(){ try { mothurOut("The tree.shared command creates a .tre to represent the similiarity between groups or sequences.\n"); mothurOut("The tree.shared command can only be executed after a successful read.otu command or by providing a distance file.\n"); - mothurOut("The tree.shared command parameters are groups, calc, phylip, column, name, cutoff, precision, line and label. You may not use line and label at the same time.\n"); + mothurOut("The tree.shared command parameters are groups, calc, phylip, column, name, cutoff, precision and label.\n"); mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included used.\n"); - mothurOut("The group names are separated by dashes. The line and label allow you to select what distance levels you would like trees created for, and are also separated by dashes.\n"); + mothurOut("The group names are separated by dashes. The label allow you to select what distance levels you would like trees created for, and are also separated by dashes.\n"); mothurOut("The phylip or column parameter are required if you do not run the read.otu command first, and only one may be used. If you use a column file the name filename is required. \n"); mothurOut("If you do not provide a cutoff value 10.00 is assumed. If you do not provide a precision value then 100 is assumed.\n"); - mothurOut("The tree.shared command should be in the following format: tree.shared(groups=yourGroups, calc=yourCalcs, line=yourLines, label=yourLabels).\n"); - mothurOut("Example tree.shared(groups=A-B-C, line=1-3-5, calc=jabund-sorabund).\n"); + mothurOut("The tree.shared command should be in the following format: tree.shared(groups=yourGroups, calc=yourCalcs, label=yourLabels).\n"); + mothurOut("Example tree.shared(groups=A-B-C, calc=jabund-sorabund).\n"); mothurOut("The default value for groups is all the groups in your groupfile.\n"); mothurOut("The default value for calc is jclass-thetayc.\n"); mothurOut("The tree.shared command outputs a .tre file for each calculator you specify at each distance you choose.\n"); @@ -427,7 +416,6 @@ void TreeGroupCommand::makeSimsDist() { /***********************************************************/ void TreeGroupCommand::makeSimsShared() { try { - int count = 1; //clear globaldatas old tree names if any globaldata->Treenames.clear(); @@ -442,18 +430,16 @@ void TreeGroupCommand::makeSimsShared() { set processedLabels; set userLabels = labels; - set userLines = lines; - + //as long as you are not at the end of the file or done wih the lines you want - while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(lookup[0]->getLabel()) == 1){ + if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){ mothurOut(lookup[0]->getLabel()); mothurOutEndLine(); process(lookup); processedLabels.insert(lookup[0]->getLabel()); userLabels.erase(lookup[0]->getLabel()); - userLines.erase(count); } if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { @@ -472,7 +458,6 @@ void TreeGroupCommand::makeSimsShared() { //get next line to process for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } lookup = input->getSharedRAbundVectors(); - count++; } //output error messages about any remaining user labels @@ -488,7 +473,7 @@ void TreeGroupCommand::makeSimsShared() { } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { for (int i = 0; i < lookup.size(); i++) { if (lookup[i] != NULL) { delete lookup[i]; } } lookup = input->getSharedRAbundVectors(lastLabel); diff --git a/treegroupscommand.h b/treegroupscommand.h index 08389f8..3f2822c 100644 --- a/treegroupscommand.h +++ b/treegroupscommand.h @@ -66,9 +66,8 @@ private: float precision, cutoff; bool abort, allLines; - set lines; //hold lines to be used set labels; //holds labels to be used - string phylipfile, columnfile, namefile, calc, groups, line, label; + string phylipfile, columnfile, namefile, calc, groups, label; vector Estimators, Groups; //holds estimators to be used //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. diff --git a/venncommand.cpp b/venncommand.cpp index f288001..b6a53e6 100644 --- a/venncommand.cpp +++ b/venncommand.cpp @@ -24,7 +24,6 @@ VennCommand::VennCommand(string option){ globaldata = GlobalData::getInstance(); abort = false; allLines = 1; - lines.clear(); labels.clear(); //allow user to run help @@ -32,7 +31,7 @@ VennCommand::VennCommand(string option){ else { //valid paramters for this command - string AlignArray[] = {"groups","line","label","calc", "abund"}; + string AlignArray[] = {"groups","label","calc", "abund"}; vector myArray (AlignArray, AlignArray+(sizeof(AlignArray)/sizeof(string))); OptionParser parser(option); @@ -52,13 +51,6 @@ VennCommand::VennCommand(string option){ //check for optional parameter and set defaults // ...at some point should added some additional type checking... - line = validParameter.validFile(parameters, "line", false); - if (line == "not found") { line = ""; } - else { - if(line != "all") { splitAtDash(line, lines); allLines = 0; } - else { allLines = 1; } - } - label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { @@ -66,13 +58,10 @@ VennCommand::VennCommand(string option){ else { allLines = 1; } } - //make sure user did not use both the line and label parameters - if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; } - //if the user has not specified any line or labels use the ones from read.otu - else if ((line == "") && (label == "")) { + //if the user has not specified any labels use the ones from read.otu + if (label == "") { allLines = globaldata->allLines; labels = globaldata->labels; - lines = globaldata->lines; } groups = validParameter.validFile(parameters, "groups", false); @@ -151,12 +140,12 @@ VennCommand::VennCommand(string option){ void VennCommand::help(){ try { mothurOut("The venn command can only be executed after a successful read.otu command.\n"); - mothurOut("The venn command parameters are groups, calc, abund, line and label. No parameters are required, but you may not use line and label at the same time.\n"); + mothurOut("The venn command parameters are groups, calc, abund and label. No parameters are required.\n"); mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included in your venn diagram, you may only use a maximum of 4 groups.\n"); - mothurOut("The group names are separated by dashes. The line and label allow you to select what distance levels you would like a venn diagram created for, and are also separated by dashes.\n"); - mothurOut("The venn command should be in the following format: venn(groups=yourGroups, calc=yourCalcs, line=yourLines, label=yourLabels, abund=yourAbund).\n"); - mothurOut("Example venn(groups=A-B-C, line=1-3-5, calc=sharedsobs-sharedchao, abund=20).\n"); - mothurOut("The default value for groups is all the groups in your groupfile up to 4, and all lines in your inputfile will be used.\n"); + mothurOut("The group names are separated by dashes. The label allows you to select what distance levels you would like a venn diagram created for, and are also separated by dashes.\n"); + mothurOut("The venn command should be in the following format: venn(groups=yourGroups, calc=yourCalcs, label=yourLabels, abund=yourAbund).\n"); + mothurOut("Example venn(groups=A-B-C, calc=sharedsobs-sharedchao, abund=20).\n"); + mothurOut("The default value for groups is all the groups in your groupfile up to 4, and all labels in your inputfile will be used.\n"); mothurOut("The default value for calc is sobs if you have only read a list file or if you have selected only one group, and sharedsobs if you have multiple groups.\n"); mothurOut("The default available estimators for calc are sobs, chao and ace if you have only read a list file, and sharedsobs, sharedchao and sharedace if you have read a list and group file or a shared file.\n"); mothurOut("The only estmiator available four 4 groups is sharedsobs.\n"); @@ -189,7 +178,6 @@ int VennCommand::execute(){ if (abort == true) { return 0; } - int count = 1; string lastLabel; //if the users entered no valid calculators don't execute command @@ -216,18 +204,16 @@ int VennCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = labels; - set userLines = lines; if (format != "list") { //as long as you are not at the end of the file or done wih the lines you want - while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(lookup[0]->getLabel()) == 1){ + if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){ mothurOut(lookup[0]->getLabel()); mothurOutEndLine(); processedLabels.insert(lookup[0]->getLabel()); userLabels.erase(lookup[0]->getLabel()); - userLines.erase(count); if (lookup.size() > 4) { mothurOut("Error: Too many groups chosen. You may use up to 4 groups with the venn command. I will use the first four groups in your groupfile."); mothurOutEndLine(); @@ -257,7 +243,6 @@ int VennCommand::execute(){ //get next line to process for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } lookup = input->getSharedRAbundVectors(); - count++; } //output error messages about any remaining user labels @@ -273,7 +258,7 @@ int VennCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { for (int i = 0; i < lookup.size(); i++) { if (lookup[i] != NULL) { delete lookup[i]; } } lookup = input->getSharedRAbundVectors(lastLabel); @@ -296,16 +281,15 @@ int VennCommand::execute(){ }else{ - while((sabund != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) { + while((sabund != NULL) && ((allLines == 1) || (userLabels.size() != 0))) { - if(allLines == 1 || lines.count(count) == 1 || labels.count(sabund->getLabel()) == 1){ + if(allLines == 1 || labels.count(sabund->getLabel()) == 1){ mothurOut(sabund->getLabel()); mothurOutEndLine(); venn->getPic(sabund, vennCalculators); processedLabels.insert(sabund->getLabel()); userLabels.erase(sabund->getLabel()); - userLines.erase(count); } if ((anyLabelsToProcess(sabund->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { @@ -323,7 +307,6 @@ int VennCommand::execute(){ delete sabund; sabund = input->getSAbundVector(); - count++; } //output error messages about any remaining user labels @@ -339,7 +322,7 @@ int VennCommand::execute(){ } } - //run last line if you need to + //run last label if you need to if (needToRun == true) { if (sabund != NULL) { delete sabund; } sabund = input->getSAbundVector(lastLabel); diff --git a/venncommand.h b/venncommand.h index 79a22d9..cc6b333 100644 --- a/venncommand.h +++ b/venncommand.h @@ -41,9 +41,8 @@ private: int abund; bool abort, allLines; - set lines; //hold lines to be used set labels; //holds labels to be used - string format, groups, calc, line, label; + string format, groups, calc, label; vector Estimators, Groups; -- 2.39.2