]> git.donarmstrong.com Git - mothur.git/commitdiff
mucked around some with the output in the unifrac.weighted, unifrac.unweighted, and...
authorpschloss <pschloss>
Sat, 7 Mar 2009 18:02:15 +0000 (18:02 +0000)
committerpschloss <pschloss>
Sat, 7 Mar 2009 18:02:15 +0000 (18:02 +0000)
parsimonycommand.cpp
readtreecommand.cpp
unifracunweightedcommand.cpp
unifracweightedcommand.cpp

index 4b3435e7e465535d8b93ffe370645cd6e936c2fb..f718653e718a9918d25fd647f5df7984745c554d 100644 (file)
@@ -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(globaldata->getIters().length()) << i+1 << '\t' << groupComb[a] << '\t' << userTreeScores[a][i] << '\t' << UScoreSig[a][i] << endl;
+                                       cout << setprecision(globaldata->getIters().length()) << i+1 << '\t' << groupComb[a] << '\t' << userTreeScores[a][i] << '\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(globaldata->getIters().length()) << i+1 << '\t' << groupComb[a] << '\t' << userTreeScores[a][i] << '\t' << "<" << (1/float(iters)) << endl;
+                                       cout << setprecision(globaldata->getIters().length()) << i+1 << '\t' << groupComb[a] << '\t' << userTreeScores[a][i] << '\t' << "<" << (1/float(iters)) << endl;
                                }
                        }
                }
@@ -397,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);
@@ -405,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;
                        }
                }
 
index 68f1f928bc52d5c920ac4126bb4fa67fd6ca3783..63c62265455ad6b2348d5496a278245f75fe5f71 100644 (file)
@@ -52,7 +52,6 @@ int ReadTreeCommand::execute(){
                for (int i = 0; i < T.size(); i++) {
                        T[i]->assembleTree();
                }
-T[0]->createNewickFile("treeout");             
                return 0;
        }
        catch(exception& e) {
index 6e217c8a71d37f22c3401a2dccc10aa23000fb26..6fd986fc6022d6642179d58ed3b497c4f2166439 100644 (file)
@@ -48,10 +48,10 @@ int UnifracUnweightedCommand::execute() {
                        unweightedFileout = globaldata->getTreeFile() + "temp." + toString(i+1) + ".unweighted";
                        
                        //column headers
-                       outSum << "Tree# " << i+1 << endl;
-                       outSum << "Comb" << '\t'  <<  "UWScore" << '\t' << '\t' << "UWSig" <<  endl;
-                       cout << "Tree# " << i+1 << endl;
-                       cout << "Comb" << '\t'  <<  "UWScore" << '\t' << '\t' << "UWSig" <<  endl;
+//                     outSum << "Tree# " << i+1 << endl;
+                       outSum << "Tree#" << '\t' << "Groups" << '\t'  <<  "UWScore" <<'\t' << "UWSig" <<  endl;
+//                     cout << "Tree# " << i+1 << endl;
+                       cout << "Tree#" << '\t' << "Groups" << '\t'  <<  "UWScore" << '\t' << "UWSig" <<  endl;
 
 
                        //get unweighted for users tree
@@ -163,15 +163,17 @@ void UnifracUnweightedCommand::printUWSummaryFile() {
                                
                //format output
                outSum.setf(ios::fixed, ios::floatfield); outSum.setf(ios::showpoint);
-               
+                       
                //print each line
-               for(int a = 0; a < numComp; a++) {
-                       if (UWScoreSig[a][0] > (1/(float)iters)) {
-                               outSum << setprecision(globaldata->getIters().length()) << groupComb[a] << '\t' << '\t' << utreeScores[a][0] << '\t' << UWScoreSig[a][0] << endl;
-                               cout << setprecision(globaldata->getIters().length())  << groupComb[a] << '\t' << '\t' << utreeScores[a][0] << '\t' << UWScoreSig[a][0] << endl; 
-                       }else {
-                               outSum << setprecision(globaldata->getIters().length()) << groupComb[a] << '\t' << '\t' << utreeScores[a][0] << '\t' << "<" << (1/float(iters)) << endl;
-                               cout << setprecision(globaldata->getIters().length())  << groupComb[a] << '\t' << '\t' << utreeScores[a][0] << '\t' << "<" << (1/float(iters)) << endl; 
+               for (int i = 0; i< T.size(); i++) {
+                       for(int a = 0; a < numComp; a++) {
+                               if (UWScoreSig[a][i] > (1/(float)iters)) {
+                                       outSum << setprecision(globaldata->getIters().length()) << i+1 << '\t' << groupComb[a] << '\t' << utreeScores[a][i] << '\t' << UWScoreSig[a][i] << endl;
+                                       cout << setprecision(globaldata->getIters().length()) << i+1 << '\t' << groupComb[a] << '\t' << utreeScores[a][i] << '\t' << UWScoreSig[a][i] << endl;
+                               }else {
+                                       outSum << setprecision(globaldata->getIters().length()) << i+1 << '\t' << groupComb[a] << '\t' << utreeScores[a][i] << '\t' << "<" << (1/float(iters)) << endl;
+                                       cout << setprecision(globaldata->getIters().length()) << i+1 << '\t' << groupComb[a] << '\t' << utreeScores[a][i] << '\t' << "<" << (1/float(iters)) << endl;
+                               }
                        }
                }
                
@@ -273,7 +275,7 @@ void UnifracUnweightedCommand::initFile(string label){
                        string inputBuffer;
                        getline(inFile, inputBuffer);
                
-                       out     <<  inputBuffer << '\t' << label + "Score" << '\t' << label + "RandFreq" << '\t' << label + "RandCumul" << endl;                
+                       out     <<  inputBuffer << '\t' << label + "RandFreq" << '\t' << label + "RandCumul" << endl;           
                }else{
                        openOutputFile(unweightedFileout, out);
                        out     << label + "Score" << '\t' << label + "RandFreq" << '\t' << label + "RandCumul" << endl;
@@ -299,11 +301,12 @@ void UnifracUnweightedCommand::output(vector<double> data){
                if(counter != 0){               
                        string inputBuffer;
                        getline(inFile, inputBuffer);
+//                     out     <<  inputBuffer << setprecision(6) << '\t' << data[0] << setprecision(globaldata->getIters().length()) << '\t' << data[1] << '\t' << data[2] << endl;
                
-                       out     <<  inputBuffer << setprecision(globaldata->getIters().length()) << '\t' << data[0] << '\t' << data[1] << '\t' << data[2] << endl;
+                       out     <<  inputBuffer << setprecision(globaldata->getIters().length()-1) << '\t' << data[1] << '\t' << data[2] << 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()-1) << '\t' << data[1] << '\t' << data[2] << endl;
                }
 
        }
index 6d8f75ba9dc3a4edeca6a4430937cc476b886090..49f6631b4ef0822defad95a1ce81372fa455d9e6 100644 (file)
@@ -164,8 +164,8 @@ void UnifracWeightedCommand::printWeightedFile() {
 void UnifracWeightedCommand::printWSummaryFile() {
        try {
                //column headers
-               outSum << "Tree#" << '\t' << "Groups" << '\t' << '\t' << "WScore" << '\t' << '\t' << "WSig" <<  endl;
-               cout << "Tree#" << '\t' << "Groups" << '\t' << '\t' << "WScore" << '\t' << '\t' << "WSig" <<  endl;
+               outSum << "Tree#" << '\t' << "Groups" << '\t' << "WScore" << '\t' << "WSig" <<  endl;
+               cout << "Tree#" << '\t' << "Groups" << '\t' << "WScore" << '\t' << "WSig" <<  endl;
                
                //format output
                outSum.setf(ios::fixed, ios::floatfield); outSum.setf(ios::showpoint);
@@ -175,11 +175,11 @@ void UnifracWeightedCommand::printWSummaryFile() {
                for (int i = 0; i < T.size(); i++) { 
                        for (int j = 0; j < numComp; j++) {
                                if (WScoreSig[count] > (1/(float)iters)) {
-                                       outSum << setprecision(globaldata->getIters().length()) << i+1 << '\t' << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << WScoreSig[count] << endl; 
-                                       cout << setprecision(globaldata->getIters().length()) << i+1 << '\t' << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << WScoreSig[count] << endl; 
+                                       outSum << setprecision(globaldata->getIters().length()) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << WScoreSig[count] << endl; 
+                                       cout << setprecision(globaldata->getIters().length()) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << WScoreSig[count] << endl; 
                                }else{
-                                       outSum << setprecision(globaldata->getIters().length()) << i+1 << '\t' << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << "<" << (1/float(iters)) << endl; 
-                                       cout << setprecision(globaldata->getIters().length()) << i+1 << '\t' << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << "<" << (1/float(iters)) << endl; 
+                                       outSum << setprecision(globaldata->getIters().length()) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << "<" << (1/float(iters)) << endl; 
+                                       cout << setprecision(globaldata->getIters().length()) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << "<" << (1/float(iters)) << endl; 
                                }
                                count++;
                        }
@@ -340,7 +340,7 @@ void UnifracWeightedCommand::initFile(string label){
                        string inputBuffer;
                        getline(inFile, inputBuffer);
                
-                       out     <<  inputBuffer << '\t' << label + "Score" << '\t' << label + "RandFreq" << '\t' << label + "RandCumul" << endl;                
+                       out     <<  inputBuffer << '\t' << label + "RandFreq" << '\t' << label + "RandCumul" << endl;           
                }else{
                        openOutputFile(weightedFileout, out);
                        out     << label + "Score" << '\t' << label + "RandFreq" << '\t' << label + "RandCumul" << endl;
@@ -366,13 +366,13 @@ void UnifracWeightedCommand::output(vector<double> data){
                if(counter != 0){               
                        string inputBuffer;
                        getline(inFile, inputBuffer);
-               
-                       out     <<  inputBuffer << setprecision(globaldata->getIters().length()) << '\t' << data[0] << '\t' << data[1] << '\t' << data[2] << endl;
+                       
+                       out     <<  inputBuffer << setprecision(globaldata->getIters().length()-1) << '\t' << data[1] << '\t' << data[2] << 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()-1) << '\t' << data[1] << '\t' << data[2] << endl;
                }
-
+               
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the UnifracWeightedCommand class Function output. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";