}else { //user wants random distribution
savetmap = globaldata->gTreemap;
getUserInput();
- parsFile = randomtree + ".rd_parsimony";
- parsFileout = globaldata->getTreeFile() + "temp" + ".rd_parsimony";
+ parsFile = randomtree;
+ parsFileout = globaldata->getTreeFile() + "temp";
}
//set users groups to analyze
if (randomtree == "") { printUSummaryFile(); }
//reset globaldata's treemap if you just did random distrib
- if (randomtree != "") { globaldata->gTreemap = savetmap; }
+ if (randomtree != "") {
+ //memory leak prevention
+ //if (globaldata->gTreemap != NULL) { delete globaldata->gTreemap; }
+ globaldata->gTreemap = savetmap;
+ }
//reset randomTree parameter to ""
globaldata->setRandomTree("");
void ParsimonyCommand::printUSummaryFile() {
try {
//column headers
- outSum << "Tree#" << '\t' << "Comb" << '\t' << "ParsScore" << '\t' << '\t' << "ParsSig" << endl;
- cout << "Tree#" << '\t' << "Comb" << '\t' << "ParsScore" << '\t' << '\t' << "ParsSig" << endl;
+ outSum << "Tree#" << '\t' << "Groups" << '\t' << "ParsScore" << '\t' << "ParsSig" << endl;
+ cout << "Tree#" << '\t' << "Groups" << '\t' << "ParsScore" << '\t' << "ParsSig" << endl;
//format output
outSum.setf(ios::fixed, ios::floatfield); outSum.setf(ios::showpoint);
for (int i = 0; i< T.size(); i++) {
for(int a = 0; a < numComp; a++) {
if (UScoreSig[a][i] > (1/(float)iters)) {
- outSum << setprecision(globaldata->getIters().length()) << i+1 << '\t' << groupComb[a] << '\t' << '\t' << userTreeScores[a][i] << '\t' << UScoreSig[a][i] << endl;
- cout << setprecision(globaldata->getIters().length()) << i+1 << '\t' << groupComb[a] << '\t' << '\t' << userTreeScores[a][i] << '\t' << UScoreSig[a][i] << endl;
+ outSum << setprecision(6) << i+1 << '\t' << groupComb[a] << '\t' << userTreeScores[a][i] << setprecision(globaldata->getIters().length()) << '\t' << UScoreSig[a][i] << endl;
+ cout << setprecision(6) << i+1 << '\t' << groupComb[a] << '\t' << userTreeScores[a][i] << setprecision(globaldata->getIters().length()) << '\t' << UScoreSig[a][i] << endl;
}else {
- outSum << setprecision(globaldata->getIters().length()) << i+1 << '\t' << groupComb[a] << '\t' << '\t' << userTreeScores[a][i] << '\t' << "<" << (1/float(iters)) << endl;
- cout << setprecision(globaldata->getIters().length()) << i+1 << '\t' << groupComb[a] << '\t' << '\t' << userTreeScores[a][i] << '\t' << "<" << (1/float(iters)) << endl;
+ outSum << setprecision(6) << i+1 << '\t' << groupComb[a] << '\t' << userTreeScores[a][i] << setprecision(globaldata->getIters().length()) << '\t' << "<" << (1/float(iters)) << endl;
+ cout << setprecision(6) << i+1 << '\t' << groupComb[a] << '\t' << userTreeScores[a][i] << setprecision(globaldata->getIters().length()) << '\t' << "<" << (1/float(iters)) << endl;
}
}
}
getline(cin, s);
//save tmap for later
+ //memory leak prevention
+ //if (globaldata->gTreemap != NULL) { delete globaldata->gTreemap; }
globaldata->gTreemap = tmap;
}
if (randomtree == "") {
out << inputBuffer << '\t' << label + "Score" << '\t' << label + "UserFreq" << '\t' << label + "UserCumul" << '\t' << label + "RandFreq" << '\t' << label + "RandCumul" << endl;
}else {
- out << inputBuffer << '\t' << label + "Score" << '\t' << label + "RandFreq" << '\t' << label + "RandCumul" << endl;
+ out << inputBuffer << '\t' << "Score" << '\t' << "RandFreq" << '\t' << "RandCumul" << endl;
}
}else{
openOutputFile(parsFileout, out);
if (randomtree == "") {
out << label + "Score" << '\t' << label + "UserFreq" << '\t' << label + "UserCumul" << '\t' << label + "RandFreq" << '\t' << label + "RandCumul" << endl;
}else {
- out << label + "Score" << '\t' << label + "RandFreq" << '\t' << label + "RandCumul" << endl;
+ out << "Score" << '\t' << "RandFreq" << '\t' << "RandCumul" << endl;
}
}
getline(inFile, inputBuffer);
if (randomtree == "") {
- out << inputBuffer << '\t' << setprecision(globaldata->getIters().length()) << data[0] << '\t' << data[1] << '\t' << data[2] << '\t' << data[3] << '\t' << data[4] << endl;
+ out << inputBuffer << '\t' << setprecision(6) << data[0] << setprecision(globaldata->getIters().length()) << '\t' << data[1] << '\t' << data[2] << '\t' << data[3] << '\t' << data[4] << endl;
}else{
- out << inputBuffer << '\t' << setprecision(globaldata->getIters().length()) << data[0] << '\t' << data[1] << '\t' << data[2] << endl;
+ out << inputBuffer << '\t' << setprecision(6) << data[0] << setprecision(globaldata->getIters().length()) << '\t' << data[1] << '\t' << data[2] << endl;
}
}
else{
if (randomtree == "") {
- out << setprecision(globaldata->getIters().length()) << data[0] << '\t' << data[1] << '\t' << data[2] << '\t' << data[3] << '\t' << data[4] << endl;
+ out << setprecision(6) << data[0] << setprecision(globaldata->getIters().length()) << '\t' << data[1] << '\t' << data[2] << '\t' << data[3] << '\t' << data[4] << endl;
}else{
- out << setprecision(globaldata->getIters().length()) << data[0] << '\t' << data[1] << '\t' << data[2] << endl;
+ out << setprecision(6) << data[0] << setprecision(globaldata->getIters().length()) << '\t' << data[1] << '\t' << data[2] << endl;
}
}