]> git.donarmstrong.com Git - mothur.git/commitdiff
changed label outputs for phylotype command
authorwestcott <westcott>
Mon, 23 Nov 2009 18:40:54 +0000 (18:40 +0000)
committerwestcott <westcott>
Mon, 23 Nov 2009 18:40:54 +0000 (18:40 +0000)
phylotypecommand.cpp
taxonomyequalizer.cpp
taxonomyequalizer.h

index ef8728258cd6ee1a90432837de78bad2b0959128..8aa639defefe2369591f87dba548be3d13cb04c7 100644 (file)
@@ -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){  
index 37b7720de256d79e35cd415d91584fddfa05f0a6..e7fa07af76ea792137475c6dff67b2ec0c9bcf7c 100644 (file)
@@ -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);
                        }
                        
index 6308d7168e72651f349ab3bf0a28942949063f62..9f38b2f2a29756d751f10b6b8e97b4cc3925bd00 100644 (file)
@@ -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<string, int> seqLevels;  //maps name to level of taxonomy
        
        int getHighestLevel(ifstream&);  //scans taxonomy file to find taxonomy with highest level