]> git.donarmstrong.com Git - mothur.git/blobdiff - unifracweightedcommand.cpp
fixed memory leak in parsimony calculator and added progress bars to parsimony and...
[mothur.git] / unifracweightedcommand.cpp
index 69b32aa11a84f2c435651e52dec92f400a868a8b..0a4c7facec93938af068ebad350307ab6f5d4c0d 100644 (file)
@@ -36,6 +36,8 @@ UnifracWeightedCommand::UnifracWeightedCommand() {
 /***********************************************************/
 int UnifracWeightedCommand::execute() {
        try {
+               Progress* reading;
+               reading = new Progress("Comparing to random:", iters);
                
                //get weighted for users tree
                userData.resize(numComp,0);  //data[0] = weightedscore AB, data[1] = weightedscore AC...
@@ -81,6 +83,10 @@ int UnifracWeightedCommand::execute() {
                                                count++;
                                        }
                                }
+                               
+                               //update progress bar
+                               reading->update(j);
+
                        }
 
                        //removeValidScoresDuplicates(); 
@@ -109,6 +115,10 @@ int UnifracWeightedCommand::execute() {
                        validScores.clear();
                }
                
+               //finish progress bar
+               reading->finish();
+               delete reading;
+               
                printWSummaryFile();
                
                //clear out users groups
@@ -175,8 +185,8 @@ 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(6) << i+1 << '\t' << '\t' << groupComb[j] << '\t' << '\t'  << utreeScores[count] << '\t' << setprecision(globaldata->getIters().length()) << WScoreSig[count] << endl; 
-                                       cout << setprecision(6) << i+1 << '\t' << '\t' << groupComb[j] << '\t' << '\t'  << utreeScores[count] << '\t' << setprecision(globaldata->getIters().length()) << WScoreSig[count] << endl; 
+                                       outSum << setprecision(6) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << setprecision(globaldata->getIters().length()) << WScoreSig[count] << endl; 
+                                       cout << setprecision(6) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << setprecision(globaldata->getIters().length()) << WScoreSig[count] << endl; 
                                }else{
                                        outSum << setprecision(6) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << setprecision(globaldata->getIters().length()) << "<" << (1/float(iters)) << endl; 
                                        cout << setprecision(6) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << setprecision(globaldata->getIters().length()) << "<" << (1/float(iters)) << endl;