+ driver(t, randT, namesOfGroupCombos, lines[0]->start, lines[0]->num, sums, scores);
+
+ //force parent to wait until all the processes are done
+ for (int i=0;i<(processors-1);i++) {
+ int temp = processIDS[i];
+ wait(&temp);
+ }
+
+ //get data created by processes
+ for (int i=0;i<(processors-1);i++) {
+ ifstream in;
+ string s = outputDir + toString(processIDS[i]) + ".weightedcommand.results.temp";
+ m->openInputFile(s, in);
+
+ for (int i = lines[process]->start; i < (lines[process]->start + lines[process]->num); i++) { in >> scores[i][0]; }
+ in.close();
+ remove(s.c_str());
+ }
+
+ m->mothurOut("DONE."); m->mothurOutEndLine(); m->mothurOutEndLine();
+
+ return 0;
+#endif
+ }
+ catch(exception& e) {
+ m->errorOut(e, "UnifracWeightedCommand", "createProcesses");
+ exit(1);
+ }
+}
+
+/**************************************************************************************************/
+int UnifracWeightedCommand::driver(Tree* t, Tree* randT, vector< vector<string> > namesOfGroupCombos, int start, int num, vector<double>& sums, vector< vector<double> >& scores) {
+ try {
+ int count = 0;
+ int total = num;
+ int twentyPercent = (total * 0.20);
+
+ for (int h = start; h < (start+num); h++) {
+
+ if (m->control_pressed) { return 0; }
+
+ //initialize weighted score
+ string groupA = namesOfGroupCombos[h][0];
+ string groupB = namesOfGroupCombos[h][1];
+
+ //copy T[i]'s info.
+ randT->getCopy(t);
+
+ //create a random tree with same topology as T[i], but different labels
+ randT->assembleRandomUnifracTree(groupA, groupB);
+
+ if (m->control_pressed) { delete randT; return 0; }
+
+
+ //get wscore of random tree
+ EstOutput randomData = weighted->getValues(randT, groupA, groupB, sums);
+
+ if (m->control_pressed) { delete randT; return 0; }
+
+ //save scores
+ scores[h].push_back(randomData[0]);
+
+ count++;
+
+ //report progress
+ if((count) % twentyPercent == 0){ m->mothurOut("Random comparison percentage complete: " + toString(int((count / (float)total) * 100.0))); m->mothurOutEndLine(); }