]> git.donarmstrong.com Git - mothur.git/blobdiff - unifracweightedcommand.cpp
mods to amova command
[mothur.git] / unifracweightedcommand.cpp
index 4ded9c51d399de1bf07950da88e0cb3a19e333d0..4c387da9332c6ca280a9359105cf8dfa837cd0a9 100644 (file)
@@ -24,8 +24,7 @@ vector<string> UnifracWeightedCommand::getValidParameters(){
 //**********************************************************************************************************************
 UnifracWeightedCommand::UnifracWeightedCommand(){      
        try {
-               abort = true;
-               //initialize outputTypes
+               abort = true; calledHelp = true; 
                vector<string> tempOutNames;
                outputTypes["weighted"] = tempOutNames;
                outputTypes["wsummary"] = tempOutNames;
@@ -65,11 +64,11 @@ vector<string> UnifracWeightedCommand::getRequiredFiles(){
 UnifracWeightedCommand::UnifracWeightedCommand(string option) {
        try {
                globaldata = GlobalData::getInstance();
-               abort = false;
+               abort = false; calledHelp = false;   
                Groups.clear();
                        
                //allow user to run help
-               if(option == "help") { help(); abort = true; }
+               if(option == "help") { help(); abort = true; calledHelp = true; }
                
                else {
                        //valid paramters for this command
@@ -181,7 +180,7 @@ void UnifracWeightedCommand::help(){
 int UnifracWeightedCommand::execute() {
        try {
        
-               if (abort == true) { return 0; }
+               if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                
                int start = time(NULL);
                
@@ -262,7 +261,7 @@ int UnifracWeightedCommand::execute() {
                                        if (m->control_pressed) { delete output; outSum.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str());  } return 0; }
                                        
                                        //report progress
-                                       m->mothurOut("Iter: " + toString(j+1)); m->mothurOutEndLine();          
+//                                     m->mothurOut("Iter: " + toString(j+1)); m->mothurOutEndLine();          
                                }
                                lines.clear();
                        
@@ -332,7 +331,6 @@ int UnifracWeightedCommand::createProcesses(Tree* t, vector< vector<string> > na
        try {
 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
                int process = 1;
-               int num = 0;
                vector<int> processIDS;
                
                EstOutput results;
@@ -528,7 +526,7 @@ void UnifracWeightedCommand::createPhylipFile() {
                        
                        //flip it so you can print it
                        for (int r=0; r<globaldata->Groups.size(); r++) { 
-                               for (int l = r+1; l < globaldata->Groups.size(); l++) {
+                               for (int l = 0; l < r; l++) {
                                        dists[r][l] = utreeScores[count];
                                        dists[l][r] = utreeScores[count];
                                        count++;