From: westcott Date: Wed, 2 Jun 2010 14:03:39 +0000 (+0000) Subject: added classify.otu command X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=8130ff9b30d872c578963f8d6f24af821b1ec33c added classify.otu command --- diff --git a/Mothur.xcodeproj/project.pbxproj b/Mothur.xcodeproj/project.pbxproj index 9a61c6c..1736df4 100644 --- a/Mothur.xcodeproj/project.pbxproj +++ b/Mothur.xcodeproj/project.pbxproj @@ -36,6 +36,8 @@ A7825503116519F70002E2DD /* chimerabellerophoncommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chimerabellerophoncommand.cpp; sourceTree = ""; }; A78434881162224F00100BE0 /* chimeraccodecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chimeraccodecommand.h; sourceTree = ""; }; A78434891162224F00100BE0 /* chimeraccodecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chimeraccodecommand.cpp; sourceTree = ""; }; + A7BBDA7B11B5694E006E6551 /* classifyotucommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = classifyotucommand.h; sourceTree = ""; }; + A7BBDA7C11B5694E006E6551 /* classifyotucommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = classifyotucommand.cpp; sourceTree = ""; }; A7D215C811996C6E00F13F13 /* clearcutcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = clearcutcommand.h; sourceTree = ""; }; A7D215C911996C6E00F13F13 /* clearcutcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = clearcutcommand.cpp; sourceTree = ""; }; A7D216061199C47F00F13F13 /* catchallcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catchallcommand.h; sourceTree = ""; }; @@ -672,6 +674,8 @@ A73953DB11987ED100B0B160 /* chopseqscommand.cpp */, A7DA201E113FECD400BF472F /* classifyseqscommand.h */, A7DA201D113FECD400BF472F /* classifyseqscommand.cpp */, + A7BBDA7B11B5694E006E6551 /* classifyotucommand.h */, + A7BBDA7C11B5694E006E6551 /* classifyotucommand.cpp */, A7D215C811996C6E00F13F13 /* clearcutcommand.h */, A7D215C911996C6E00F13F13 /* clearcutcommand.cpp */, A7DA2021113FECD400BF472F /* clustercommand.cpp */, @@ -696,8 +700,8 @@ A7DA205D113FECD400BF472F /* getlabelcommand.h */, A7DA205E113FECD400BF472F /* getlistcountcommand.cpp */, A7DA205F113FECD400BF472F /* getlistcountcommand.h */, - A7DA2060113FECD400BF472F /* getoturepcommand.cpp */, A7DA2061113FECD400BF472F /* getoturepcommand.h */, + A7DA2060113FECD400BF472F /* getoturepcommand.cpp */, A7DA2062113FECD400BF472F /* getrabundcommand.cpp */, A7DA2063113FECD400BF472F /* getrabundcommand.h */, A7DA2064113FECD400BF472F /* getsabundcommand.cpp */, diff --git a/classifyotucommand.cpp b/classifyotucommand.cpp index 5e7e787..94a60d4 100644 --- a/classifyotucommand.cpp +++ b/classifyotucommand.cpp @@ -118,8 +118,8 @@ void ClassifyOtuCommand::help(){ 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"); @@ -293,7 +293,7 @@ int ClassifyOtuCommand::readTaxonomyFile() { } } //********************************************************************************************************************** -string ClassifyOtuCommand::findConcensusTaxonomy(int bin, ListVector* thisList, int& size) { +string ClassifyOtuCommand::findConsensusTaxonomy(int bin, ListVector* thisList, int& size) { try{ string conTax = ""; vector names; @@ -316,7 +316,7 @@ string ClassifyOtuCommand::findConcensusTaxonomy(int bin, ListVector* thisList, 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(); + m->mothurOut(names[i] + " is not in your taxonomy file. I will not include it in the consensus."); m->mothurOutEndLine(); }else{ //if namesfile include the names @@ -325,7 +325,7 @@ string ClassifyOtuCommand::findConcensusTaxonomy(int bin, ListVector* thisList, 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 concensus."); m->mothurOutEndLine(); + m->mothurOut(names[i] + " is not in your name file. I will not include it in the consensus."); m->mothurOutEndLine(); }else{ vector nameFileNames; @@ -371,11 +371,11 @@ string ClassifyOtuCommand::findConcensusTaxonomy(int bin, ListVector* thisList, } //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 + ";"; } @@ -396,7 +396,7 @@ string ClassifyOtuCommand::findConcensusTaxonomy(int bin, ListVector* thisList, } catch(exception& e) { - m->errorOut(e, "ClassifyOtuCommand", "findConcensusTaxonomy"); + m->errorOut(e, "ClassifyOtuCommand", "findConsensusTaxonomy"); exit(1); } } @@ -417,7 +417,7 @@ int ClassifyOtuCommand::process(ListVector* processList) { //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; } diff --git a/classifyotucommand.h b/classifyotucommand.h index 0ac0288..1077781 100644 --- a/classifyotucommand.h +++ b/classifyotucommand.h @@ -39,7 +39,7 @@ private: int readTaxonomyFile(); void removeConfidences(string&); int process(ListVector*); - string findConcensusTaxonomy(int, ListVector*, int&); // returns the name of the "representative" taxonomy of given bin + string findConsensusTaxonomy(int, ListVector*, int&); // returns the name of the "representative" taxonomy of given bin }; diff --git a/classifyseqscommand.cpp b/classifyseqscommand.cpp index 7d015a8..e5c0494 100644 --- a/classifyseqscommand.cpp +++ b/classifyseqscommand.cpp @@ -320,7 +320,7 @@ void ClassifySeqsCommand::help(){ m->mothurOut("The gapextend parameter allows you to specify the penalty for extending a gap in an alignment. The default is -1.0.\n"); m->mothurOut("The numwanted parameter allows you to specify the number of sequence matches you want with the knn method. The default is 10.\n"); m->mothurOut("The cutoff parameter allows you to specify a bootstrap confidence threshold for your taxonomy. The default is 0.\n"); - m->mothurOut("The probs parameter shut off the bootstrapping results for the bayesian method. The default is true, meaning you want the bootstrapping to be run.\n"); + m->mothurOut("The probs parameter shuts off the bootstrapping results for the bayesian method. The default is true, meaning you want the bootstrapping to be shown.\n"); m->mothurOut("The iters parameter allows you to specify how many iterations to do when calculating the bootstrap confidence score for your taxonomy with the bayesian method. The default is 100.\n"); m->mothurOut("The classify.seqs command should be in the following format: \n"); m->mothurOut("classify.seqs(template=yourTemplateFile, fasta=yourFastaFile, method=yourClassificationMethod, search=yourSearchmethod, ksize=yourKmerSize, taxonomy=yourTaxonomyFile, processors=yourProcessors) \n"); diff --git a/commandfactory.cpp b/commandfactory.cpp index a40c432..bd519ee 100644 --- a/commandfactory.cpp +++ b/commandfactory.cpp @@ -79,6 +79,7 @@ #include "catchallcommand.h" #include "splitabundcommand.h" #include "clustersplitcommand.h" +#include "classifyotucommand.h" /*******************************************************/ @@ -165,6 +166,7 @@ CommandFactory::CommandFactory(){ commands["catchall"] = "catchall"; commands["split.abund"] = "split.abund"; commands["cluster.split"] = "cluster.split"; + commands["classify.otu"] = "classify.otu"; commands["classify.seqs"] = "MPIEnabled"; commands["dist.seqs"] = "MPIEnabled"; commands["filter.seqs"] = "MPIEnabled"; @@ -288,6 +290,7 @@ Command* CommandFactory::getCommand(string commandName, string optionString){ else if(commandName == "catchall") { command = new CatchAllCommand(optionString); } else if(commandName == "split.abund") { command = new SplitAbundCommand(optionString); } else if(commandName == "cluster.split") { command = new ClusterSplitCommand(optionString); } + else if(commandName == "classify.otu") { command = new ClassifyOtuCommand(optionString); } else { command = new NoCommand(optionString); } return command; @@ -339,9 +342,9 @@ bool CommandFactory::isValidCommand(string command) { /***********************************************************************/ void CommandFactory::printCommands(ostream& out) { try { - out << "Valid commands are "; + out << "Valid commands are: "; for (it = commands.begin(); it != commands.end(); it++) { - out << it->first << ", "; + out << it->first << ","; } out << endl; } diff --git a/makefile b/makefile index 0c5adac..a973241 100644 --- a/makefile +++ b/makefile @@ -26,7 +26,7 @@ ifeq ($(strip $(USEREADLINE)),yes) -L../readline-6.0 endif -USEMPI ?= yes +USEMPI ?= no ifeq ($(strip $(USEMPI)),yes) CC = mpic++ @@ -224,6 +224,7 @@ mothur : \ ./taxonomyequalizer.o\ ./phylotypecommand.o\ ./classifyseqscommand.o\ + ./classifyotucommand.o\ ./parsesffcommand.o\ ./classify.o\ ./phylotree.o\ @@ -432,6 +433,7 @@ mothur : \ ./taxonomyequalizer.o\ ./phylotypecommand.o\ ./classifyseqscommand.o\ + ./classifyotucommand.o\ ./parsesffcommand.o\ ./classify.o\ ./phylotree.o\ @@ -643,6 +645,7 @@ clean : ./taxonomyequalizer.o\ ./phylotypecommand.o\ ./classifyseqscommand.o\ + ./classifyotucommand.o\ ./parsesffcommand.o\ ./classify.o\ ./phylotree.o\ @@ -1697,5 +1700,10 @@ install : mothur # Item # 207 -- splitmatrix -- ./clustersplitcommand.o : clustersplitcommand.cpp $(CC) $(CC_OPTIONS) clustersplitcommand.cpp -c $(INCLUDE) -o ./clustersplitcommand.o + +# Item # 207 -- splitmatrix -- +./classifyotucommand.o : classifyotucommand.cpp + $(CC) $(CC_OPTIONS) classifyotucommand.cpp -c $(INCLUDE) -o ./classifyotucommand.o + ##### END RUN ####