Permalink
Browse files

Merge branch 'Reftaxonomy_241' into v.1.38.0

  • Loading branch information...
2 parents 0010015 + e41f158 commit 79c1addeaf4632c7e690dbaaac0453009097f3db @mothur-westcott mothur-westcott committed Jun 30, 2016
@@ -17,7 +17,6 @@ vector<string> ClassifyOtuCommand::setParameters(){
try {
CommandParameter plist("list", "InputTypes", "", "", "none", "none", "none","",false,true,true); parameters.push_back(plist);
CommandParameter ptaxonomy("taxonomy", "InputTypes", "", "", "none", "none", "none","constaxonomy",false,true,true); parameters.push_back(ptaxonomy);
- CommandParameter preftaxonomy("reftaxonomy", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(preftaxonomy);
CommandParameter pname("name", "InputTypes", "", "", "NameCount", "none", "none","",false,false,true); parameters.push_back(pname);
CommandParameter pcount("count", "InputTypes", "", "", "NameCount-CountGroup", "none", "none","",false,false,true); parameters.push_back(pcount);
CommandParameter poutput("output", "Multiple", "plain-detail", "detail", "", "", "","",false,false, true); parameters.push_back(poutput);
@@ -47,8 +46,7 @@ vector<string> ClassifyOtuCommand::setParameters(){
string ClassifyOtuCommand::getHelpString(){
try {
string helpString = "";
- helpString += "The classify.otu command parameters are list, taxonomy, reftaxonomy, name, group, count, persample, cutoff, label, basis, relabund and probs. The taxonomy and list parameters are required unless you have a valid current file.\n";
- helpString += "The reftaxonomy parameter allows you give the name of the reference taxonomy file used when you classified your sequences. Providing it will keep the rankIDs in the summary file static.\n";
+ helpString += "The classify.otu command parameters are list, taxonomy, name, group, count, persample, cutoff, label, basis, relabund and probs. The taxonomy and list parameters are required unless you have a valid current file.\n";
helpString += "The name parameter allows you add a names file with your taxonomy file.\n";
helpString += "The group parameter allows you provide a group file to use in creating the summary file breakdown.\n";
helpString += "The count parameter allows you add a count file associated with your list file. When using the count parameter mothur assumes your list file contains only uniques.\n";
@@ -166,14 +164,6 @@ ClassifyOtuCommand::ClassifyOtuCommand(string option) {
if (path == "") { parameters["taxonomy"] = inputDir + it->second; }
}
- it = parameters.find("reftaxonomy");
- //user has given a template file
- if(it != parameters.end()){
- path = m->hasPath(it->second);
- //if the user has not given a path then, add inputdir. else leave path alone.
- if (path == "") { parameters["reftaxonomy"] = inputDir + it->second; }
- }
-
it = parameters.find("group");
//user has given a template file
if(it != parameters.end()){
@@ -214,10 +204,6 @@ ClassifyOtuCommand::ClassifyOtuCommand(string option) {
}
else if (taxfile == "not open") { abort = true; }
else { m->setTaxonomyFile(taxfile); }
-
- refTaxonomy = validParameter.validFile(parameters, "reftaxonomy", true);
- if (refTaxonomy == "not found") { refTaxonomy = ""; m->mothurOut("reftaxonomy is not required, but if given will keep the rankIDs in the summary file static."); m->mothurOutEndLine(); }
- else if (refTaxonomy == "not open") { abort = true; }
namefile = validParameter.validFile(parameters, "name", true);
if (namefile == "not open") { namefile = ""; abort = true; }
@@ -582,13 +568,8 @@ int ClassifyOtuCommand::process(ListVector* processList) {
out << "OTU\tSize\tTaxonomy" << endl;
PhyloSummary* taxaSum;
- if (countfile != "") {
- if (refTaxonomy != "") { taxaSum = new PhyloSummary(refTaxonomy, ct,relabund, printlevel); }
- else { taxaSum = new PhyloSummary(ct,relabund, printlevel); }
- }else {
- if (refTaxonomy != "") { taxaSum = new PhyloSummary(refTaxonomy, groupMap, relabund, printlevel); }
- else { taxaSum = new PhyloSummary(groupMap,relabund, printlevel); }
- }
+ if (countfile != "") { taxaSum = new PhyloSummary(ct,relabund, printlevel); }
+ else { taxaSum = new PhyloSummary(groupMap,relabund, printlevel); }
vector<string> outs;
vector<PhyloSummary*> taxaSums;
@@ -605,13 +586,8 @@ int ClassifyOtuCommand::process(ListVector* processList) {
outputNames.push_back(outputFile); outputTypes["constaxonomy"].push_back(outputFile);
PhyloSummary* taxaSumt;
- if (countfile != "") {
- if (refTaxonomy != "") { taxaSumt = new PhyloSummary(refTaxonomy, ct, relabund, printlevel); }
- else { taxaSumt = new PhyloSummary(ct, relabund, printlevel); }
- }else {
- if (refTaxonomy != "") { taxaSumt = new PhyloSummary(refTaxonomy, groupMap,relabund, printlevel); }
- else { taxaSumt = new PhyloSummary(groupMap,relabund, printlevel); }
- }
+ if (countfile != "") { taxaSumt = new PhyloSummary(ct, relabund, printlevel);
+ }else { taxaSumt = new PhyloSummary(groupMap,relabund, printlevel); }
taxaSums.push_back(taxaSumt);
}
}
@@ -40,7 +40,7 @@ class ClassifyOtuCommand : public Command {
CountTable* ct;
ListVector* list;
InputData* input;
- string listfile, namefile, taxfile, label, outputDir, refTaxonomy, groupfile, basis, countfile, output;
+ string listfile, namefile, taxfile, label, outputDir, groupfile, basis, countfile, output;
bool abort, allLines, probs, persample, relabund;
int cutoff, threshold, printlevel;
set<string> labels; //holds labels to be used
@@ -1026,8 +1026,14 @@ int MakeBiomCommand::getGreenGenesOTUIDs(vector<SharedRAbundVector*>& lookup, ma
m->removeConfidences(OTUTaxonomy);
//remove unclassifieds to match template
- int thisPos = OTUTaxonomy.find("unclassified;");
- if (thisPos != string::npos) { OTUTaxonomy = OTUTaxonomy.substr(0, thisPos); }
+ int thisPos = OTUTaxonomy.find("unclassified;"); //"Porphyromonadaceae"_unclassified;
+ if (thisPos != string::npos) {
+ OTUTaxonomy = OTUTaxonomy.substr(0, thisPos);
+ thisPos = OTUTaxonomy.find_last_of(";"); //remove rest of parent taxon
+ if (thisPos != string::npos) {
+ OTUTaxonomy = OTUTaxonomy.substr(0, thisPos);
+ }
+ }
//get list of reference ids that map to this taxonomy
vector<string> referenceIds = phylo.getSeqs(OTUTaxonomy);
@@ -1192,8 +1198,14 @@ int MakeBiomCommand::getGreenGenesOTUIDs(vector<SharedRAbundFloatVector*>& looku
m->removeConfidences(OTUTaxonomy);
//remove unclassifieds to match template
- int thisPos = OTUTaxonomy.find("unclassified;");
- if (thisPos != string::npos) { OTUTaxonomy = OTUTaxonomy.substr(0, thisPos); }
+ int thisPos = OTUTaxonomy.find("unclassified;"); //"Porphyromonadaceae"_unclassified;
+ if (thisPos != string::npos) {
+ OTUTaxonomy = OTUTaxonomy.substr(0, thisPos);
+ thisPos = OTUTaxonomy.find_last_of(";"); //remove rest of parent taxon
+ if (thisPos != string::npos) {
+ OTUTaxonomy = OTUTaxonomy.substr(0, thisPos);
+ }
+ }
//get list of reference ids that map to this taxonomy
vector<string> referenceIds = phylo.getSeqs(OTUTaxonomy);
@@ -17,7 +17,6 @@ vector<string> SummaryTaxCommand::setParameters(){
CommandParameter pname("name", "InputTypes", "", "", "NameCount", "none", "none","",false,false,true); parameters.push_back(pname);
CommandParameter pcount("count", "InputTypes", "", "", "NameCount-CountGroup", "none", "none","",false,false,true); parameters.push_back(pcount);
CommandParameter pgroup("group", "InputTypes", "", "", "CountGroup", "none", "none","",false,false,true); parameters.push_back(pgroup);
- CommandParameter preftaxonomy("reftaxonomy", "InputTypes", "", "", "none", "none", "none","",false,false); parameters.push_back(preftaxonomy);
CommandParameter prelabund("relabund", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(prelabund);
CommandParameter poutput("output", "Multiple", "simple-detail", "detail", "", "", "","",false,false, true); parameters.push_back(poutput);
CommandParameter pthreshold("threshold", "Number", "", "0", "", "", "","",false,true); parameters.push_back(pthreshold);
@@ -44,7 +43,6 @@ string SummaryTaxCommand::getHelpString(){
helpString += "The name parameter allows you to enter a name file associated with your taxonomy file. \n";
helpString += "The group parameter allows you add a group file so you can have the summary totals broken up by group.\n";
helpString += "The count parameter allows you add a count file so you can have the summary totals broken up by group.\n";
- helpString += "The reftaxonomy parameter allows you give the name of the reference taxonomy file used when you classified your sequences. It is not required, but providing it will keep the rankIDs in the summary file static.\n";
helpString += "The threshold parameter allows you to specify a cutoff for the taxonomy file that is being inputted. Once the classification falls below the threshold the mothur will refer to it as unclassified when calculating the concensus. This feature is similar to adjusting the cutoff in classify.seqs. Default=0.\n";
helpString += "The output parameter allows you to specify format of your summary file. Options are simple and detail. The default is detail.\n";
helpString += "The printlevel parameter allows you to specify taxlevel of your summary file to print to. Options are 1 to the maz level in the file. The default is -1, meaning max level. If you select a level greater than the level your sequences classify to, mothur will print to the level your max level. \n";
@@ -140,14 +138,6 @@ SummaryTaxCommand::SummaryTaxCommand(string option) {
if (path == "") { parameters["group"] = inputDir + it->second; }
}
- it = parameters.find("reftaxonomy");
- //user has given a template file
- if(it != parameters.end()){
- path = m->hasPath(it->second);
- //if the user has not given a path then, add inputdir. else leave path alone.
- if (path == "") { parameters["reftaxonomy"] = inputDir + it->second; }
- }
-
it = parameters.find("count");
//user has given a template file
if(it != parameters.end()){
@@ -194,11 +184,7 @@ SummaryTaxCommand::SummaryTaxCommand(string option) {
m->mothurOut("[ERROR]: you may only use one of the following: group or count."); m->mothurOutEndLine(); abort=true;
}
- refTaxonomy = validParameter.validFile(parameters, "reftaxonomy", true);
- if (refTaxonomy == "not found") { refTaxonomy = ""; m->mothurOut("reftaxonomy is not required, but if given will keep the rankIDs in the summary file static."); m->mothurOutEndLine(); }
- else if (refTaxonomy == "not open") { refTaxonomy = ""; abort = true; }
-
- //if the user changes the output directory command factory will send this info to us in the output parameter
+ //if the user changes the output directory command factory will send this info to us in the output parameter
outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){
outputDir = "";
outputDir += m->hasPath(taxfile); //if user entered a file with a path then preserve it
@@ -249,13 +235,8 @@ int SummaryTaxCommand::execute(){
}
PhyloSummary* taxaSum;
- if (countfile != "") {
- if (refTaxonomy != "") { taxaSum = new PhyloSummary(refTaxonomy, ct, relabund, printlevel); }
- else { taxaSum = new PhyloSummary(ct, relabund, printlevel); }
- }else {
- if (refTaxonomy != "") { taxaSum = new PhyloSummary(refTaxonomy, groupMap, relabund, printlevel); }
- else { taxaSum = new PhyloSummary(groupMap, relabund, printlevel); }
- }
+ if (countfile != "") { taxaSum = new PhyloSummary(ct, relabund, printlevel);
+ }else { taxaSum = new PhyloSummary(groupMap, relabund, printlevel); }
if (m->control_pressed) { if (groupMap != NULL) { delete groupMap; } if (ct != NULL) { delete ct; } delete taxaSum; return 0; }
@@ -35,7 +35,7 @@ class SummaryTaxCommand : public Command {
private:
bool abort, relabund;
- string taxfile, outputDir, namefile, groupfile, refTaxonomy, countfile, output;
+ string taxfile, outputDir, namefile, groupfile, countfile, output;
int printlevel, threshold;
vector<string> outputNames;
map<string, int> nameMap;

0 comments on commit 79c1add

Please sign in to comment.