]> git.donarmstrong.com Git - mothur.git/blobdiff - venncommand.cpp
added mothur executable to cvs
[mothur.git] / venncommand.cpp
index 35c814d2625a4f236667646801e01eb1b6c056bd..8b617d8881000bd7e837e901fc1765b18592d6b4 100644 (file)
@@ -15,6 +15,7 @@
 #include "sharedsobscollectsummary.h"
 #include "sharedchao1.h"
 #include "sharedace.h"
+#include "nseqs.h"
 
 
 //**********************************************************************************************************************
@@ -52,7 +53,7 @@ VennCommand::VennCommand(string option)  {
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
                        outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  
                                outputDir = ""; 
-                               outputDir += hasPath(globaldata->inputFileName); //if user entered a file with a path then preserve it  
+                               outputDir += m->hasPath(globaldata->inputFileName); //if user entered a file with a path then preserve it       
                        }
 
                        //check for optional parameter and set defaults
@@ -60,7 +61,7 @@ VennCommand::VennCommand(string option)  {
                        label = validParameter.validFile(parameters, "label", false);                   
                        if (label == "not found") { label = ""; }
                        else { 
-                               if(label != "all") {  splitAtDash(label, labels);  allLines = 0;  }
+                               if(label != "all") {  m->splitAtDash(label, labels);  allLines = 0;  }
                                else { allLines = 1;  }
                        }
                        
@@ -73,7 +74,7 @@ VennCommand::VennCommand(string option)  {
                        groups = validParameter.validFile(parameters, "groups", false);                 
                        if (groups == "not found") { groups = ""; }
                        else { 
-                               splitAtDash(groups, Groups);
+                               m->splitAtDash(groups, Groups);
                                globaldata->Groups = Groups;
                        }
                        
@@ -89,7 +90,7 @@ VennCommand::VennCommand(string option)  {
                                        else { calc = "sharedsobs"; }
                                }
                        }
-                       splitAtDash(calc, Estimators);
+                       m->splitAtDash(calc, Estimators);
                        
                        string temp;
                        temp = validParameter.validFile(parameters, "abund", false);            if (temp == "not found") { temp = "10"; }
@@ -111,6 +112,8 @@ VennCommand::VennCommand(string option)  {
                                                                if(abund < 5)
                                                                        abund = 10;
                                                                vennCalculators.push_back(new Ace(abund));
+                                                       }else if (Estimators[i] == "nseqs") { 
+                                                               vennCalculators.push_back(new NSeqs());
                                                        }
                                                }
                                        }
@@ -123,13 +126,18 @@ VennCommand::VennCommand(string option)  {
                                                                vennCalculators.push_back(new SharedChao1());
                                                        }else if (Estimators[i] == "sharedace") { 
                                                                vennCalculators.push_back(new SharedAce());
+                                                       }else if (Estimators[i] == "nseqs") { 
+                                                               vennCalculators.push_back(new NSeqs());
                                                        }
                                                }
                                        }
                                }
                                
-                               venn = new Venn(outputDir);
+                               //if the users entered no valid calculators don't execute command
+                               if (vennCalculators.size() == 0) { m->mothurOut("No valid calculators given, please correct."); m->mothurOutEndLine(); abort = true;  }
+                               else {  venn = new Venn(outputDir);  }
                        }
+                       
                }
 
                
@@ -188,9 +196,6 @@ int VennCommand::execute(){
                string lastLabel;
                vector<string> outputNames;
                
-               //if the users entered no valid calculators don't execute command
-               if (vennCalculators.size() == 0) { return 0; }
-               
                if (format == "sharedfile") {
                        //you have groups
                        read = new ReadOTUFile(globaldata->inputFileName);      
@@ -240,7 +245,7 @@ int VennCommand::execute(){
                                        for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); }  }
                                }
                                
-                               if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
+                               if ((m->anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
                                        string saveLabel = lookup[0]->getLabel();
                                        
                                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
@@ -342,7 +347,7 @@ int VennCommand::execute(){
                                        userLabels.erase(sabund->getLabel());
                                }
                                
-                               if ((anyLabelsToProcess(sabund->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
+                               if ((m->anyLabelsToProcess(sabund->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
                                        string saveLabel = sabund->getLabel();
                                
                                        delete sabund;