]> git.donarmstrong.com Git - mothur.git/blobdiff - indicatorcommand.cpp
added cutoff change to mgcluster
[mothur.git] / indicatorcommand.cpp
index c25e4fa13b4b7cc8eaf7f320d66b1806a3bf194d..966810b1438bd7e9b4072f6a8cccd6cb2d105cee 100644 (file)
@@ -74,6 +74,7 @@ IndicatorCommand::IndicatorCommand(string option)  {
                
                //allow user to run help
                if(option == "help") { help(); abort = true; calledHelp = true; }
+               else if(option == "citation") { citation(); abort = true; calledHelp = true;}
                
                else {
                        vector<string> myArray = setParameters();
@@ -146,21 +147,22 @@ IndicatorCommand::IndicatorCommand(string option)  {
                                treefile = m->getTreeFile(); 
                                if (treefile != "") { m->mothurOut("Using " + treefile + " as input file for the tree parameter."); m->mothurOutEndLine(); }
                                else {  m->mothurOut("You have no current tree file and the tree parameter is required."); m->mothurOutEndLine(); abort = true; }                                                               
-                       }       
+                       }else { m->setTreeFile(treefile); }     
                        
                        sharedfile = validParameter.validFile(parameters, "shared", true);
                        if (sharedfile == "not open") { abort = true; }
                        else if (sharedfile == "not found") { sharedfile = ""; }
-                       else { inputFileName = sharedfile; }
+                       else { inputFileName = sharedfile; m->setSharedFile(sharedfile); }
                        
                        relabundfile = validParameter.validFile(parameters, "relabund", true);
                        if (relabundfile == "not open") { abort = true; }
                        else if (relabundfile == "not found") { relabundfile = ""; }
-                       else { inputFileName = relabundfile; }
+                       else { inputFileName = relabundfile; m->setRelAbundFile(relabundfile); }
                        
                        designfile = validParameter.validFile(parameters, "design", true);
                        if (designfile == "not open") { abort = true; }
                        else if (designfile == "not found") { designfile = ""; }
+                       else { m->setDesignFile(designfile); }
                        
                        groups = validParameter.validFile(parameters, "groups", false);                 
                        if (groups == "not found") { groups = "";  Groups.push_back("all"); }
@@ -542,6 +544,7 @@ vector<float> IndicatorCommand::getValues(vector< vector<SharedRAbundFloatVector
                        vector<float> terms; 
                        float AijDenominator = 0.0;
                        vector<float> Bij;
+                       
                        //get overall abundance of each grouping
                        for (int j = 0; j < groupings.size(); j++) {
                                
@@ -552,6 +555,7 @@ vector<float> IndicatorCommand::getValues(vector< vector<SharedRAbundFloatVector
                                        if (groupings[j][k]->getAbundance(i) != 0) { numNotZero++; }
                                }
                                
+                               //mean abundance
                                float Aij = (totalAbund / (float) groupings[j].size());
                                terms.push_back(Aij);
                                
@@ -563,7 +567,7 @@ vector<float> IndicatorCommand::getValues(vector< vector<SharedRAbundFloatVector
                        
                        float maxIndVal = 0.0;
                        for (int j = 0; j < terms.size(); j++) { 
-                               float thisAij = (terms[j] / AijDenominator); 
+                               float thisAij = (terms[j] / AijDenominator); //relative abundance
                                float thisValue = thisAij * Bij[j] * 100.0;
                                
                                //save largest
@@ -607,7 +611,8 @@ vector<float> IndicatorCommand::getValues(vector< vector<SharedRAbundVector*> >&
                                        if (groupings[j][k]->getAbundance(i) != 0.0) { numNotZero++; }
                                        
                                }
-                                       
+                               
+                               //mean abundance        
                                float Aij = (totalAbund / (float) groupings[j].size());
                                terms.push_back(Aij);
                                
@@ -619,7 +624,7 @@ vector<float> IndicatorCommand::getValues(vector< vector<SharedRAbundVector*> >&
                        
                        float maxIndVal = 0.0;
                        for (int j = 0; j < terms.size(); j++) { 
-                               float thisAij = (terms[j] / AijDenominator); 
+                               float thisAij = (terms[j] / AijDenominator); //relative abundance
                                float thisValue = thisAij * Bij[j] * 100.0;
                                        
                                //save largest