]> git.donarmstrong.com Git - mothur.git/blobdiff - unifracunweightedcommand.cpp
fixed bug in read.tree updates help and validparameters strings, added ability for...
[mothur.git] / unifracunweightedcommand.cpp
index cf1cbce05dfce301409d3b80d861f0fb9dc0a0bd..2b93df782bccc4d2dbc8533e7cdc38169059d6a7 100644 (file)
@@ -36,7 +36,7 @@ UnifracUnweightedCommand::UnifracUnweightedCommand() {
 /***********************************************************/
 int UnifracUnweightedCommand::execute() {
        try {
-       
+
                userData.resize(numComp,0);  //data[0] = unweightedscore 
                randomData.resize(numComp,0); //data[0] = unweightedscore
                //create new tree with same num nodes and leaves as users
@@ -85,6 +85,7 @@ int UnifracUnweightedCommand::execute() {
                                        //add randoms score to validscores
                                        validScores[randomData[k]] = randomData[k];
                                }
+                               
                        }
                
                for(int a = 0; a < numComp; a++) {
@@ -101,6 +102,8 @@ int UnifracUnweightedCommand::execute() {
                        UWScoreSig[a].push_back(rCumul[a][userData[a]]);
                }
                
+               
+               
                printUnweightedFile();
                printUWSummaryFile();
                
@@ -168,11 +171,11 @@ void UnifracUnweightedCommand::printUWSummaryFile() {
 
                for(int a = 0; a < numComp; a++) {
                        if (UWScoreSig[a][0] > (1/(float)iters)) {
-                               outSum << setprecision(6) << groupComb[a] << '\t' << '\t' << utreeScores[a][0] << '\t' << setprecision(globaldata->getIters().length()) << UWScoreSig[a][0] << endl;
-                               cout << setprecision(6)  << groupComb[a] << '\t' << '\t' << utreeScores[a][0] << '\t' << setprecision(globaldata->getIters().length()) << UWScoreSig[a][0] << endl; 
+                               outSum << setprecision(6) << groupComb[a]  << '\t' << utreeScores[a][0] << '\t' << setprecision(globaldata->getIters().length()) << UWScoreSig[a][0] << endl;
+                               cout << setprecision(6)  << groupComb[a]  << '\t' << utreeScores[a][0] << '\t' << setprecision(globaldata->getIters().length()) << UWScoreSig[a][0] << endl; 
                        }else {
-                               outSum << setprecision(6) << groupComb[a] << '\t' << '\t' << utreeScores[a][0] << '\t' << setprecision(globaldata->getIters().length()) << "<" << (1/float(iters)) << endl;
-                               cout << setprecision(6)  << groupComb[a] << '\t' << '\t' << utreeScores[a][0] << '\t' << setprecision(globaldata->getIters().length()) << "<" << (1/float(iters)) << endl; 
+                               outSum << setprecision(6) << groupComb[a]  << '\t' << utreeScores[a][0] << '\t' << setprecision(globaldata->getIters().length()) << "<" << (1/float(iters)) << endl;
+                               cout << setprecision(6)  << groupComb[a]  << '\t' << utreeScores[a][0] << '\t' << setprecision(globaldata->getIters().length()) << "<" << (1/float(iters)) << endl; 
                        }
                }
                
@@ -208,9 +211,11 @@ void UnifracUnweightedCommand::setGroups() {
                                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") {
+                                                       globaldata->Groups.push_back(tmap->namesOfGroups[i]);
+                                                       numGroups++;
+                                                       allGroups += tmap->namesOfGroups[i] + "-";
+                                               }
                                        }
                                        allGroups = allGroups.substr(0, allGroups.length()-1);
                                }else {
@@ -223,16 +228,20 @@ void UnifracUnweightedCommand::setGroups() {
                        }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;