/***********************************************************/
int ParsimonyCommand::execute() {
try {
-
+ Progress* reading;
+ reading = new Progress("Comparing to random:", iters);
+
//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.
-
+
//output scores for each combination
for(int k = 0; k < numComp; k++) {
+
//update uscoreFreq
it = uscoreFreq[k].find(userData[k]);
if (it == uscoreFreq[k].end()) {//new score
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();
+
//get pscore of random tree
randomData = pars->getValues(randT);
-
+
for(int r = 0; r < numComp; r++) {
//add trees pscore to map of scores
it2 = rscoreFreq[r].find(randomData[r]);
validScores[randomData[r]] = randomData[r];
}
+ //update progress bar
+ reading->update(j);
+
delete randT;
}
+
}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();
+
//get pscore of random tree
randomData = pars->getValues(randT);
-
+
for(int r = 0; r < numComp; r++) {
//add trees pscore to map of scores
it2 = rscoreFreq[r].find(randomData[r]);
validScores[randomData[r]] = randomData[r];
}
+ //update progress bar
+ reading->update(j);
+
delete randT;
}
}
-
+
for(int a = 0; a < numComp; a++) {
float rcumul = 0.0000;
float ucumul = 0.0000;
}
}
+ //finish progress bar
+ reading->finish();
+ delete reading;
+
+
printParsimonyFile();
if (randomtree == "") { printUSummaryFile(); }
//reset globaldata's treemap if you just did random distrib
if (randomtree != "") {
//memory leak prevention
- if (globaldata->gTreemap != NULL) { delete globaldata->gTreemap; }
+ //if (globaldata->gTreemap != NULL) { delete globaldata->gTreemap; }
globaldata->gTreemap = savetmap;
}
//save tmap for later
//memory leak prevention
- if (globaldata->gTreemap != NULL) { delete globaldata->gTreemap; }
+ //if (globaldata->gTreemap != NULL) { delete globaldata->gTreemap; }
globaldata->gTreemap = tmap;
}
if (globaldata->Groups.size() == 0) {
cout << "When using the groups parameter you must have at least 1 valid group. I will run the command using all the groups in your groupfile." << endl;
for (int i = 0; i < tmap->namesOfGroups.size(); i++) {
- globaldata->Groups.push_back(tmap->namesOfGroups[i]);
- numGroups++;
- allGroups += tmap->namesOfGroups[i] + "-";
+ if (tmap->namesOfGroups[i] != "xxx") {
+ allGroups += tmap->namesOfGroups[i] + "-";
+ globaldata->Groups.push_back(tmap->namesOfGroups[i]);
+ numGroups++;
+ }
}
allGroups = allGroups.substr(0, allGroups.length()-1);
}else {
}else{//user has enter "all" and wants the default groups
globaldata->Groups.clear();
for (int i = 0; i < tmap->namesOfGroups.size(); i++) {
- globaldata->Groups.push_back(tmap->namesOfGroups[i]);
- numGroups++;
- allGroups += tmap->namesOfGroups[i] + "-";
+ if (tmap->namesOfGroups[i] != "xxx") {
+ globaldata->Groups.push_back(tmap->namesOfGroups[i]);
+ numGroups++;
+ allGroups += tmap->namesOfGroups[i] + "-";
+ }
}
allGroups = allGroups.substr(0, allGroups.length()-1);
globaldata->setGroups("");
}
}else {
for (int i = 0; i < tmap->namesOfGroups.size(); i++) {
- allGroups += tmap->namesOfGroups[i] + "-";
+ if (tmap->namesOfGroups[i] != "xxx") {
+ allGroups += tmap->namesOfGroups[i] + "-";
+ }
}
allGroups = allGroups.substr(0, allGroups.length()-1);
numGroups = 1;