]> git.donarmstrong.com Git - mothur.git/blobdiff - unifracweightedcommand.cpp
fixed shhh.flows outputdir bug
[mothur.git] / unifracweightedcommand.cpp
index a0d710e7b2ebbb7cffaf4aca88365a3ab73a197c..b3a54c929ace3221fe3ba736a3b5fad7f87818f9 100644 (file)
@@ -141,7 +141,7 @@ UnifracWeightedCommand::UnifracWeightedCommand(string option) {
                        
                        //check for required parameters
                        treefile = validParameter.validFile(parameters, "tree", true);
-                       if (treefile == "not open") { abort = true; }
+                       if (treefile == "not open") { treefile = ""; abort = true; }
                        else if (treefile == "not found") {                             //if there is a current design file, use it
                                treefile = m->getTreeFile(); 
                                if (treefile != "") { m->mothurOut("Using " + treefile + " as input file for the tree parameter."); m->mothurOutEndLine(); }
@@ -155,7 +155,7 @@ UnifracWeightedCommand::UnifracWeightedCommand(string option) {
                        else { m->setGroupFile(groupfile); }
                        
                        namefile = validParameter.validFile(parameters, "name", true);
-                       if (namefile == "not open") { abort = true; }
+                       if (namefile == "not open") { namefile = ""; abort = true; }
                        else if (namefile == "not found") { namefile = ""; }
                        else { m->setNameFile(namefile); }
                        
@@ -172,7 +172,7 @@ UnifracWeightedCommand::UnifracWeightedCommand(string option) {
                        }
                                
                        itersString = validParameter.validFile(parameters, "iters", false);                     if (itersString == "not found") { itersString = "1000"; }
-                       convert(itersString, iters); 
+                       m->mothurConvert(itersString, iters); 
                        
                        string temp = validParameter.validFile(parameters, "distance", false);                  
                        if (temp == "not found") { phylip = false; outputForm = ""; }
@@ -189,9 +189,14 @@ UnifracWeightedCommand::UnifracWeightedCommand(string option) {
                        
                        temp = validParameter.validFile(parameters, "processors", false);       if (temp == "not found"){       temp = m->getProcessors();      }
                        m->setProcessors(temp);
-                       convert(temp, processors);
+                       m->mothurConvert(temp, processors);
                        
                        if (!random) {  iters = 0;  } //turn off random calcs
+                       
+                       if (namefile == "") {
+                               vector<string> files; files.push_back(treefile);
+                               parser.getNameFile(files);
+                       }
                }
                
                
@@ -277,10 +282,11 @@ int UnifracWeightedCommand::execute() {
                        
                util = new SharedUtil();
                string s; //to make work with setgroups
-               vector<string> Groups = m->getGroups();
+               Groups = m->getGroups();
                vector<string> nameGroups = tmap->getNamesOfGroups();
                util->setGroups(Groups, nameGroups, s, numGroups, "weighted");  //sets the groups the user wants to analyze
                util->getCombos(groupComb, Groups, numComp);
+               m->setGroups(Groups);
                delete util;
                
                weighted = new Weighted(tmap, includeRoot);
@@ -336,7 +342,7 @@ int UnifracWeightedCommand::execute() {
                                
                                lines.clear();
                                
-                               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                        if(processors != 1){
                                                int numPairs = namesOfGroupCombos.size();
                                                int numPairsPerProcessor = numPairs / processors;
@@ -355,7 +361,7 @@ int UnifracWeightedCommand::execute() {
                                //get scores for random trees
                                for (int j = 0; j < iters; j++) {
                                
-                                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                                if(processors == 1){
                                                        driver(T[i],  namesOfGroupCombos, 0, namesOfGroupCombos.size(),  rScores);
                                                }else{
@@ -453,7 +459,7 @@ int UnifracWeightedCommand::execute() {
 
 int UnifracWeightedCommand::createProcesses(Tree* t, vector< vector<string> > namesOfGroupCombos, vector< vector<double> >& scores) {
        try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 1;
                vector<int> processIDS;