+}
+
+/**************************************************************************************************/
+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(); }
+ }
+
+ m->mothurOut("Random comparison percentage complete: 100"); m->mothurOutEndLine();
+
+ return 0;
+
+ }
+ catch(exception& e) {
+ m->errorOut(e, "UnifracWeightedCommand", "driver");
+ exit(1);
+ }
+}
+/***********************************************************/
+void UnifracWeightedCommand::printWeightedFile() {
+ try {
+ vector<double> data;
+ vector<string> tags;
+ tags.push_back("Score"); tags.push_back("RandFreq"); tags.push_back("RandCumul");
+
+ for(int a = 0; a < numComp; a++) {
+ output->initFile(groupComb[a], tags);
+ //print each line
+ for (map<float,float>::iterator it = validScores.begin(); it != validScores.end(); it++) {
+ data.push_back(it->first); data.push_back(rScoreFreq[a][it->first]); data.push_back(rCumul[a][it->first]);
+ output->output(data);
+ data.clear();
+ }
+ output->resetFile();
+ }
+ }
+ catch(exception& e) {
+ m->errorOut(e, "UnifracWeightedCommand", "printWeightedFile");