void ClassifyOtuCommand::help(){
try {
- m->mothurOut("The classify.otu command parameters are list, taxonomy, name, cutoff, and label. The taxonomy and list parameters are required.\n");
+ m->mothurOut("The classify.otu command parameters are list, taxonomy, name, cutoff, label and probs. The taxonomy and list parameters are required.\n");
m->mothurOut("The name parameter allows you add a names file with your taxonomy file.\n");
m->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");
m->mothurOut("The default value for label is all labels in your inputfile.\n");
- m->mothurOut("The cutoff parameter allows you to specify a concensus confidence threshold for your taxonomy. The default is 51, meaning 51%. Cutoff cannot be below 51.\n");
- m->mothurOut("The probs parameter shuts off the outputting of the concensus confidence results. The default is true, meaning you want the confidence to be shown.\n");
+ m->mothurOut("The cutoff parameter allows you to specify a consensus confidence threshold for your taxonomy. The default is 51, meaning 51%. Cutoff cannot be below 51.\n");
+ m->mothurOut("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");
m->mothurOut("The classify.otu command should be in the following format: classify.otu(taxonomy=yourTaxonomyFile, list=yourListFile, name=yourNamesFile, label=yourLabels).\n");
m->mothurOut("Example classify.otu(taxonomy=abrecovery.silva.full.taxonomy, list=abrecovery.fn.list, label=0.10).\n");
m->mothurOut("Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListFile).\n\n");
inNames >> names; //read from second column A,B,C,D
gobble(inNames);
- nameMap[name] = names;
+ //parse names into vector
+ vector<string> theseNames;
+ splitAtComma(names, theseNames);
+
+ for (int i = 0; i < theseNames.size(); i++) { nameMap[theseNames[i]] = name; }
if (m->control_pressed) { inNames.close(); nameMap.clear(); return 0; }
}
}
}
//**********************************************************************************************************************
-string ClassifyOtuCommand::findConcensusTaxonomy(int bin, ListVector* thisList, int& size) {
+string ClassifyOtuCommand::findConsensusTaxonomy(int bin, ListVector* thisList, int& size) {
try{
string conTax = "";
vector<string> names;
size = 0;
for (int i = 0; i < names.size(); i++) {
-
- if (m->control_pressed) { delete phylo; return conTax; }
-
- //is this sequence in the taxonomy file
- it = taxMap.find(names[i]);
-
- if (it == taxMap.end()) { //this name is not in taxonomy file, skip it
- m->mothurOut(names[i] + " is not in your taxonomy file. I will not include it in the concensus."); m->mothurOutEndLine();
- }else{
+
+ //if namesfile include the names
+ if (namefile != "") {
+ //is this sequence in the name file - namemap maps seqName -> repSeqName
+ it2 = nameMap.find(names[i]);
- //if namesfile include the names
- if (namefile != "") {
- //is this sequence in the name file
- it2 = nameMap.find(names[i]);
+ if (it2 == nameMap.end()) { //this name is not in name file, skip it
+ m->mothurOut(names[i] + " is not in your name file. I will not include it in the consensus."); m->mothurOutEndLine();
+ }else{
- if (it2 == nameMap.end()) { //this name is not in name file, skip it
- m->mothurOut(names[i] + " is not in your name file. I will not include it in the concensus."); m->mothurOutEndLine();
+ //is this sequence in the taxonomy file - look for repSeqName since we are assuming the taxonomy file is unique
+ it = taxMap.find(it2->second);
+
+ if (it == taxMap.end()) { //this name is not in taxonomy file, skip it
+ if (names[i] != it->second) { m->mothurOut(names[i] + " is represented by " + it2->second + " and is not in your taxonomy file. I will not include it in the consensus."); m->mothurOutEndLine(); }
+ else { m->mothurOut(names[i] + " is not in your taxonomy file. I will not include it in the consensus."); m->mothurOutEndLine(); }
}else{
-
- vector<string> nameFileNames;
- splitAtComma(it2->second, nameFileNames);
-
- for (int j = 0; j < nameFileNames.size(); j++) {
- //add seq to tree
- phylo->addSeqToTree(nameFileNames[j], it->second);
- size++;
- }
+
+ //add seq to tree
+ phylo->addSeqToTree(names[i], it->second);
+ size++;
}
-
+ }
+
+ }else{
+ //is this sequence in the taxonomy file - look for repSeqName since we are assuming the taxonomy file is unique
+ it = taxMap.find(names[i]);
+
+ if (it == taxMap.end()) { //this name is not in taxonomy file, skip it
+ m->mothurOut(names[i] + " is not in your taxonomy file. I will not include it in the consensus."); m->mothurOutEndLine();
}else{
//add seq to tree
phylo->addSeqToTree(names[i], it->second);
size++;
}
}
+
+
+ if (m->control_pressed) { delete phylo; return conTax; }
+
}
//build tree
}
//is this taxonomy above cutoff
- int concensusConfidence = ceil((bestChildSize / (float) size) * 100);
+ int consensusConfidence = ceil((bestChildSize / (float) size) * 100);
- if (concensusConfidence >= cutoff) { //if yes, add it
+ if (consensusConfidence >= cutoff) { //if yes, add it
if (probs) {
- conTax += bestChild.name + "(" + toString(concensusConfidence) + ");";
+ conTax += bestChild.name + "(" + toString(consensusConfidence) + ");";
}else{
conTax += bestChild.name + ";";
}
}
catch(exception& e) {
- m->errorOut(e, "ClassifyOtuCommand", "findConcensusTaxonomy");
+ m->errorOut(e, "ClassifyOtuCommand", "findConsensusTaxonomy");
exit(1);
}
}
//for each bin in the list vector
for (int i = 0; i < processList->getNumBins(); i++) {
- conTax = findConcensusTaxonomy(i, processList, size);
+ conTax = findConsensusTaxonomy(i, processList, size);
if (m->control_pressed) { out.close(); return 0; }