helpString += "The probs parameter shuts off the outputting of the consensus confidence results. The default is true, meaning you want the confidence to be shown.\n";
helpString += "The classify.otu command should be in the following format: classify.otu(taxonomy=yourTaxonomyFile, list=yourListFile, name=yourNamesFile, label=yourLabels).\n";
helpString += "Example classify.otu(taxonomy=abrecovery.silva.full.taxonomy, list=abrecovery.fn.list, label=0.10).\n";
- helpString += "Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListFile).\n\n";
+ helpString += "Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListFile).\n";
return helpString;
}
catch(exception& e) {
//allow user to run help
if (option == "help") {
help(); abort = true; calledHelp = true;
- } else {
+ }else if(option == "citation") { citation(); abort = true; calledHelp = true;}
+ else {
vector<string> myArray = setParameters();
OptionParser parser(option);
else { m->mothurOut("You have no current listfile and the list parameter is required."); m->mothurOutEndLine(); abort = true; }
}
else if (listfile == "not open") { abort = true; }
+ else { m->setListFile(listfile); }
taxfile = validParameter.validFile(parameters, "taxonomy", true);
if (taxfile == "not found") { //if there is a current list file, use it
else { m->mothurOut("You have no current taxonomy file and the taxonomy parameter is required."); m->mothurOutEndLine(); abort = true; }
}
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") { abort = true; }
+ if (namefile == "not open") { namefile = ""; abort = true; }
else if (namefile == "not found") { namefile = ""; }
+ else { m->setNameFile(namefile); }
groupfile = validParameter.validFile(parameters, "group", true);
if (groupfile == "not open") { abort = true; }
else if (groupfile == "not found") { groupfile = ""; }
+ else { m->setGroupFile(groupfile); }
//check for optional parameter and set defaults
// ...at some point should added some additional type checking...
if ((basis != "otu") && (basis != "sequence")) { m->mothurOut("Invalid option for basis. basis options are otu and sequence, using otu."); m->mothurOutEndLine(); }
string temp = validParameter.validFile(parameters, "cutoff", false); if (temp == "not found") { temp = "51"; }
- convert(temp, cutoff);
+ m->mothurConvert(temp, cutoff);
temp = validParameter.validFile(parameters, "probs", false); if (temp == "not found"){ temp = "true"; }
probs = m->isTrue(temp);
if ((cutoff < 51) || (cutoff > 100)) { m->mothurOut("cutoff must be above 50, and no greater than 100."); m->mothurOutEndLine(); abort = true; }
+ if (namefile == ""){
+ vector<string> files; files.push_back(taxfile);
+ parser.getNameFile(files);
+ }
+
}
}
catch(exception& e) {
set<string> processedLabels;
set<string> userLabels = labels;
- if (m->control_pressed) { outputTypes.clear(); delete input; delete list; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { outputTypes.clear(); delete input; delete list; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
while((list != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
m->mothurOut(list->getLabel() + "\t" + toString(list->size())); m->mothurOutEndLine();
process(list);
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete input; delete list; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete input; delete list; return 0; }
processedLabels.insert(list->getLabel());
userLabels.erase(list->getLabel());
process(list);
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete input; delete list; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete input; delete list; return 0; }
processedLabels.insert(list->getLabel());
userLabels.erase(list->getLabel());
process(list);
delete list;
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete input; delete list; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete input; delete list; return 0; }
}
delete input;
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
m->gobble(in);
//are there confidence scores, if so remove them
- if (tax.find_first_of('(') != -1) { removeConfidences(tax); }
+ if (tax.find_first_of('(') != -1) { m->removeConfidences(tax); }
taxMap[name] = tax;
phylo->assignHeirarchyIDs(0);
TaxNode currentNode = phylo->get(0);
-
+ int myLevel = 0;
//at each level
while (currentNode.children.size() != 0) { //you still have more to explore
}else{
conTax += bestChild.name + ";";
}
+ myLevel++;
}else{ //if no, quit
break;
}
currentNode = bestChild;
}
-
+ if (myLevel != phylo->getMaxLevel()) {
+ while (myLevel != phylo->getMaxLevel()) {
+ conTax += "unclassified;";
+ myLevel++;
+ }
+ }
if (conTax == "") { conTax = "no_consensus;"; }
delete phylo;
out << (i+1) << '\t' << size << '\t' << conTax << endl;
string noConfidenceConTax = conTax;
- removeConfidences(noConfidenceConTax);
+ m->removeConfidences(noConfidenceConTax);
//add this bins taxonomy to summary
if (basis == "sequence") {
}
}
/**************************************************************************************************/
-void ClassifyOtuCommand::removeConfidences(string& tax) {
- try {
-
- string taxon;
- string newTax = "";
+string ClassifyOtuCommand::addUnclassifieds(string tax, int maxlevel) {
+ try{
+ string newTax, taxon;
+ int level = 0;
+ //keep what you have counting the levels
while (tax.find_first_of(';') != -1) {
//get taxon
- taxon = tax.substr(0,tax.find_first_of(';'));
-
- int pos = taxon.find_first_of('(');
- if (pos != -1) {
- taxon = taxon.substr(0, pos); //rip off confidence
- }
-
- taxon += ";";
-
+ taxon = tax.substr(0,tax.find_first_of(';'))+';';
tax = tax.substr(tax.find_first_of(';')+1, tax.length());
newTax += taxon;
+ level++;
+ }
+
+ //add "unclassified" until you reach maxLevel
+ while (level < maxlevel) {
+ newTax += "unclassified;";
+ level++;
}
- tax = newTax;
+ return newTax;
}
catch(exception& e) {
- m->errorOut(e, "ClassifyOtuCommand", "removeConfidences");
+ m->errorOut(e, "ClassifyOtuCommand", "addUnclassifieds");
exit(1);
}
}