]> git.donarmstrong.com Git - mothur.git/blobdiff - unifracunweightedcommand.cpp
working on parallelizing unifrac.unweighted.
[mothur.git] / unifracunweightedcommand.cpp
index 68c943cb4e4c57efcc23eafe45f0da47fa6d4495..7836eb682f19d444ae2ffb7f82fe538efdb7d933 100644 (file)
@@ -21,7 +21,7 @@ UnifracUnweightedCommand::UnifracUnweightedCommand(string option)  {
                
                else {
                        //valid paramters for this command
-                       string Array[] =  {"groups","iters","distance","random", "outputdir","inputdir"};
+                       string Array[] =  {"groups","iters","distance","random", "processors","outputdir","inputdir"};
                        vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
                        
                        OptionParser parser(option);
@@ -61,6 +61,9 @@ UnifracUnweightedCommand::UnifracUnweightedCommand(string option)  {
                        temp = validParameter.validFile(parameters, "random", false);                                   if (temp == "not found") { temp = "f"; }
                        random = m->isTrue(temp);
                        
+                       temp = validParameter.validFile(parameters, "processors", false);       if (temp == "not found"){       temp = "1";                             }
+                       convert(temp, processors); 
+                       
                        if (!random) {  iters = 0;  } //turn off random calcs
                        
                        //if user selects distance = true and no groups it won't calc the pairwise
@@ -156,14 +159,9 @@ int UnifracUnweightedCommand::execute() {
                        utreeScores.resize(numComp);  
                        UWScoreSig.resize(numComp); 
 
-                       userData = unweighted->getValues(T[i]);  //userData[0] = unweightedscore
+                       userData = unweighted->getValues(T[i], processors, outputDir);  //userData[0] = unweightedscore
                        
-                       if (m->control_pressed) { 
-                               if (random) { delete output;  }
-                               outSum.close();
-                               for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str());  }
-                               return 0; 
-                       }
+                       if (m->control_pressed) { if (random) { delete output;  } outSum.close();  for (int i = 0; i < outputNames.size(); i++) {       remove(outputNames[i].c_str());  }return 0; }
                        
                        //output scores for each combination
                        for(int k = 0; k < numComp; k++) {