From bee7952bbdc4ed46c7a12bef11769345fa3224d7 Mon Sep 17 00:00:00 2001 From: westcott Date: Mon, 23 Nov 2009 18:40:54 +0000 Subject: [PATCH] changed label outputs for phylotype command --- phylotypecommand.cpp | 8 ++++++-- taxonomyequalizer.cpp | 4 ++-- taxonomyequalizer.h | 5 +++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/phylotypecommand.cpp b/phylotypecommand.cpp index ef87282..8aa639d 100644 --- a/phylotypecommand.cpp +++ b/phylotypecommand.cpp @@ -69,7 +69,10 @@ void PhylotypeCommand::help(){ mothurOut("The phylotype command reads a taxonomy file and outputs a .list, .rabund and .sabund file. \n"); mothurOut("The phylotype command parameter options are taxonomy, cutoff and label. The taxonomy parameter is required.\n"); mothurOut("The cutoff parameter allows you to specify the level you want to stop at. The default is the highest level in your taxonomy file. \n"); + mothurOut("For example: taxonomy = Bacteria;Bacteroidetes-Chlorobi;Bacteroidetes; - cutoff=2, would truncate the taxonomy to Bacteria;Bacteroidetes-Chlorobi; \n"); + mothurOut("For the cutoff parameter levels count up from the root of the phylotree. This enables you to look at the grouping down to a specific resolution, say the genus level.\n"); mothurOut("The label parameter allows you to specify which level you would like, and are separated by dashes. The default all levels in your taxonomy file. \n"); + mothurOut("For the label parameter, levels count down from the root to keep the output similiar to mothur's other commands which report information from finer resolution to coarser resolutions.\n"); mothurOut("The phylotype command should be in the following format: \n"); mothurOut("phylotype(taxonomy=yourTaxonomyFile, cutoff=yourCutoff, label=yourLabels) \n"); mothurOut("Eaxample: phylotype(taxonomy=amazon.taxonomy, cutoff=5, label=1-3-5).\n\n"); @@ -119,11 +122,12 @@ int PhylotypeCommand::execute(){ string outputRabundFile = getRootName(taxonomyFileName) + "tax.rabund"; openOutputFile(outputRabundFile, outRabund); - + int count = 1; //start at leaves of tree and work towards root, processing the labels the user wants while((!done) && ((allLines == 1) || (labels.size() != 0))) { - string level = toString(tree->get(currentNodes.begin()->first).level); + string level = toString(count); + count++; //is this a level the user want output for if(allLines == 1 || labels.count(level) == 1){ diff --git a/taxonomyequalizer.cpp b/taxonomyequalizer.cpp index 37b7720..e7fa07a 100644 --- a/taxonomyequalizer.cpp +++ b/taxonomyequalizer.cpp @@ -17,7 +17,7 @@ TaxEqualizer::TaxEqualizer(string tfile, int c) : cutoff(c) { ifstream inTax; openInputFile(tfile, inTax); - int highestLevel = getHighestLevel(inTax); + highestLevel = getHighestLevel(inTax); //if the user has specified a cutoff and it's smaller than the highest level if ((cutoff != -1) && (cutoff < highestLevel)) { @@ -43,7 +43,7 @@ TaxEqualizer::TaxEqualizer(string tfile, int c) : cutoff(c) { //is this a taxonomy that needs to be extended? if (seqLevels[name] < highestLevel) { extendTaxonomy(name, tax, highestLevel); - }else if (seqLevels[name] > highestLevel) { //this can happen if hte user enters a cutoff + }else if (seqLevels[name] > highestLevel) { //this can happen if the user enters a cutoff truncateTaxonomy(name, tax, highestLevel); } diff --git a/taxonomyequalizer.h b/taxonomyequalizer.h index 6308d71..9f38b2f 100644 --- a/taxonomyequalizer.h +++ b/taxonomyequalizer.h @@ -25,13 +25,14 @@ public: TaxEqualizer(string, int); ~TaxEqualizer() {}; - string getEqualizedTaxFile() { return equalizedFile; } + string getEqualizedTaxFile() { return equalizedFile; } + int getHighestLevel() { return highestLevel; } private: string equalizedFile, testTax; bool containsConfidence; - int cutoff; + int cutoff, highestLevel; map seqLevels; //maps name to level of taxonomy int getHighestLevel(ifstream&); //scans taxonomy file to find taxonomy with highest level -- 2.39.2