X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=parsimonycommand.cpp;h=c7340c7b1704c585b70e2677c0701aaf7edb4e33;hb=9651e8e7172d86707b34af15e95ec60ad4c3c3f9;hp=ee2125e99168553cb0e45de137d46211bdfc6421;hpb=f94ef0ca699bbb8f0d6dba8357c55f699a1ae29f;p=mothur.git diff --git a/parsimonycommand.cpp b/parsimonycommand.cpp index ee2125e..c7340c7 100644 --- a/parsimonycommand.cpp +++ b/parsimonycommand.cpp @@ -28,8 +28,8 @@ ParsimonyCommand::ParsimonyCommand() { }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 @@ -226,8 +226,8 @@ void ParsimonyCommand::printParsimonyFile() { 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); @@ -237,11 +237,11 @@ void ParsimonyCommand::printUSummaryFile() { 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' << '\t' << userTreeScores[a][i] << setprecision(globaldata->getIters().length()) << '\t' << UScoreSig[a][i] << endl; + cout << setprecision(6) << i+1 << '\t' << groupComb[a] << '\t' << '\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; } } } @@ -340,6 +340,7 @@ void ParsimonyCommand::setGroups() { allGroups = allGroups.substr(0, allGroups.length()-1); } }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++; @@ -396,7 +397,7 @@ void ParsimonyCommand::initFile(string label){ 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); @@ -404,7 +405,7 @@ void ParsimonyCommand::initFile(string label){ 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; } } @@ -430,16 +431,16 @@ void ParsimonyCommand::output(vector data){ 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; } }