]> git.donarmstrong.com Git - mothur.git/blobdiff - summarysharedcommand.cpp
added mantel command
[mothur.git] / summarysharedcommand.cpp
index b3f7729e10a709a202b627148386b7bd66d5ac31..b5214448cd2a5e8f8af0b70bfc700ee05465d4af 100644 (file)
@@ -65,8 +65,7 @@ vector<string> SummarySharedCommand::getValidParameters(){
 //**********************************************************************************************************************
 SummarySharedCommand::SummarySharedCommand(){  
        try {
-               abort = true;
-               //initialize outputTypes
+               abort = true; calledHelp = true; 
                vector<string> tempOutNames;
                outputTypes["summary"] = tempOutNames;
        }
@@ -103,13 +102,13 @@ vector<string> SummarySharedCommand::getRequiredFiles(){
 SummarySharedCommand::SummarySharedCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
-               abort = false;
+               abort = false; calledHelp = false;   
                allLines = 1;
                labels.clear();
                Estimators.clear();
                
                //allow user to run help
-               if(option == "help") { validCalculator = new ValidCalculators(); help(); abort = true; }
+               if(option == "help") { validCalculator = new ValidCalculators(); help(); abort = true; calledHelp = true; }
                
                else {
                        //valid paramters for this command
@@ -317,7 +316,7 @@ SummarySharedCommand::~SummarySharedCommand(){
 int SummarySharedCommand::execute(){
        try {
        
-               if (abort == true) { return 0; }
+               if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                
                ofstream outputFileHandle, outAll;
                string outputFileName = outputDir + m->getRootName(m->getSimpleName(globaldata->inputFileName)) + "shared.summary";
@@ -665,6 +664,7 @@ int SummarySharedCommand::process(vector<SharedRAbundVector*> thisLookup, string
                                        outDist.close();
                                }
                        }
+               return 0;
        }
        catch(exception& e) {
                m->errorOut(e, "SummarySharedCommand", "process");
@@ -743,7 +743,7 @@ int SummarySharedCommand::driver(vector<SharedRAbundVector*> thisLookup, int sta
                                        outputFileHandle << '\t';
                                        sumCalculators[i]->print(outputFileHandle);
                                        
-                                       seqDist temp(l, k, tempdata[0]);
+                                       seqDist temp(l, k, (1.0 - tempdata[0]));
                                        calcDists[i].push_back(temp);
                                }
                                outputFileHandle << endl;