Progress* reading;
reading = new Progress("Comparing to random:", iters);
+ if (m->control_pressed) {
+ delete reading; delete pars; delete util; delete output;
+ if (randomtree == "") { outSum.close(); }
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ globaldata->Groups.clear();
+ return 0;
+ }
+
+
//get pscore for users tree
userData.resize(numComp,0); //data = AB, AC, BC, ABC.
randomData.resize(numComp,0); //data = AB, AC, BC, ABC.
//get pscores for users trees
for (int i = 0; i < T.size(); i++) {
userData = pars->getValues(T[i]); //data = AB, AC, BC, ABC.
+
+ if (m->control_pressed) {
+ delete reading; delete pars; delete util; delete output;
+ if (randomtree == "") { outSum.close(); }
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ globaldata->Groups.clear();
+ return 0;
+ }
+
//output scores for each combination
for(int k = 0; k < numComp; k++) {
//get pscores for random trees
for (int j = 0; j < iters; j++) {
+
//create new tree with same num nodes and leaves as users
randT = new Tree();
//get pscore of random tree
randomData = pars->getValues(randT);
+
+ if (m->control_pressed) {
+ delete reading; delete pars; delete util; delete output; delete randT;
+ if (randomtree == "") { outSum.close(); }
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ globaldata->Groups.clear();
+ return 0;
+ }
for(int r = 0; r < numComp; r++) {
//add trees pscore to map of scores
}else {
//get pscores for random trees
for (int j = 0; j < iters; j++) {
+
//create new tree with same num nodes and leaves as users
randT = new Tree();
//create random relationships between nodes
randT->assembleRandomTree();
+
+ if (m->control_pressed) {
+ delete reading; delete pars; delete util; delete output; delete randT;
+ globaldata->gTreemap = savetmap;
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ globaldata->Groups.clear();
+ return 0;
+ }
+
//get pscore of random tree
randomData = pars->getValues(randT);
+
+ if (m->control_pressed) {
+ delete reading; delete pars; delete util; delete output; delete randT;
+ globaldata->gTreemap = savetmap;
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ globaldata->Groups.clear();
+ return 0;
+ }
for(int r = 0; r < numComp; r++) {
//add trees pscore to map of scores
}
}
+ if (m->control_pressed) {
+ delete reading; delete pars; delete util; delete output;
+ if (randomtree == "") { outSum.close(); }
+ else { globaldata->gTreemap = savetmap; }
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ globaldata->Groups.clear();
+ return 0;
+ }
+
//finish progress bar
reading->finish();
delete reading;
//reset groups parameter
globaldata->Groups.clear();
+ if (m->control_pressed) {
+ delete pars; delete util; delete output;
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ return 0;
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
}
}
/***********************************************************/
-void ParsimonyCommand::printUSummaryFile() {
+int ParsimonyCommand::printUSummaryFile() {
try {
//column headers
outSum << "Tree#" << '\t' << "Groups" << '\t' << "ParsScore" << '\t' << "ParsSig" << endl;
//print each line
for (int i = 0; i< T.size(); i++) {
for(int a = 0; a < numComp; a++) {
+ if (m->control_pressed) { outSum.close(); return 0; }
if (UScoreSig[a][i] > (1/(float)iters)) {
outSum << setprecision(6) << i+1 << '\t' << groupComb[a] << '\t' << userTreeScores[a][i] << setprecision(itersString.length()) << '\t' << UScoreSig[a][i] << endl;
cout << setprecision(6) << i+1 << '\t' << groupComb[a] << '\t' << userTreeScores[a][i] << setprecision(itersString.length()) << '\t' << UScoreSig[a][i] << endl;
}
outSum.close();
+ return 0;
}
catch(exception& e) {
m->errorOut(e, "ParsimonyCommand", "printUSummaryFile");