]> git.donarmstrong.com Git - mothur.git/commitdiff
fixed bug in unifrac commands with unrooted trees
authorwestcott <westcott>
Wed, 23 Feb 2011 13:34:08 +0000 (13:34 +0000)
committerwestcott <westcott>
Wed, 23 Feb 2011 13:34:08 +0000 (13:34 +0000)
Mothur.xcodeproj/project.pbxproj
trimseqscommand.cpp
unweighted.cpp
weighted.cpp

index 902e927e15ac79e725a1277fa67e891c237e7576..e4797253008a0057cc5562ddef17f0c4b4a8efa2 100644 (file)
                        attributes = {
                                ORGANIZATIONNAME = "Schloss Lab";
                        };
-                       buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "Mothur" */;
+                       buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "mothur" */;
                        compatibilityVersion = "Xcode 3.1";
                        developmentRegion = English;
                        hasScannedForEncodings = 1;
                        defaultConfigurationIsVisible = 0;
                        defaultConfigurationName = Release;
                };
-               1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "Mothur" */ = {
+               1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "mothur" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                                1DEB928A08733DD80010E9CD /* Debug */,
index 53bdc7e28435d8fbe5b4379fd51f8ce23a909eb6..dd5bf3460debcc3e2fd5b6af736b0e123c7890ae 100644 (file)
@@ -349,7 +349,7 @@ int TrimSeqsCommand::execute(){
                                        createProcessesCreateTrim(fastaFile, qFileName, trimSeqFile, scrapSeqFile, trimQualFile, scrapQualFile, outputGroupFileName, fastaFileNames, qualFileNames); 
                                }       
                #else
-                               driverCreateTrim(fastaFile, qFileName, trimSeqFile, scrapSeqFile, trimQualFile, scrapQualFile, outputGroupFile, fastaFileNames, qualFileNames, lines[0], qLines[0]);
+                               driverCreateTrim(fastaFile, qFileName, trimSeqFile, scrapSeqFile, trimQualFile, scrapQualFile, outputGroupFileName, fastaFileNames, qualFileNames, lines[0], qLines[0]);
                #endif
                
                if (m->control_pressed) {  return 0; }                  
index ea66294a5354c7cab7c265c3213a967a4a5a01f9..fb2f0b22afa3cc2143ad95afe6c45e4e093db222 100644 (file)
@@ -232,7 +232,11 @@ EstOutput Unweighted::driver(Tree* t, vector< vector<string> > namesOfGroupCombo
                                                }
                                        }else if ((nodePcountSize[lc] == 0) && (nodePcountSize[rc] == 0)) { tempTotals[i] = 0.0;  //we don't care about you
                                        }else { //if no, your tempTotal is your childrens temp totals + your branch length
-                                               tempTotals[i] = tempTotals[lc] + tempTotals[rc] + abs(t->tree[i].getBranchLength()); 
+                                               if (t->tree[i].getBranchLength() != -1) {
+                                                       tempTotals[i] = tempTotals[lc] + tempTotals[rc] + abs(t->tree[i].getBranchLength()); 
+                                               }else {
+                                                       tempTotals[i] = tempTotals[lc] + tempTotals[rc];
+                                               }
                                        }
                                        //cout << "temptotal = "<< tempTotals[i] << endl;
                                }
@@ -482,7 +486,11 @@ EstOutput Unweighted::driver(Tree* t, vector< vector<string> > namesOfGroupCombo
                                                }
                                        }else if ((nodePcountSize[lc] == 0) && (nodePcountSize[rc] == 0)) { tempTotals[i] = 0.0;  //we don't care about you
                                        }else { //if no, your tempTotal is your childrens temp totals + your branch length
-                                               tempTotals[i] = tempTotals[lc] + tempTotals[rc] + abs(copyTree->tree[i].getBranchLength()); 
+                                               if (t->tree[i].getBranchLength() != -1) {
+                                                       tempTotals[i] = tempTotals[lc] + tempTotals[rc] + abs(copyTree->tree[i].getBranchLength()); 
+                                               }else {
+                                                       tempTotals[i] = tempTotals[lc] + tempTotals[rc];
+                                               }
                                        }
                                        
                                }
index 30e4a7682dc4ae4ad840fcdf2f7a31921fc8c351..a0d593c803f691821afdb680e79be80f179b0afa 100644 (file)
@@ -231,10 +231,13 @@ EstOutput Weighted::driver(Tree* t, vector< vector<string> > namesOfGroupCombos,
                                
                                //if this is not the root then add it
                                if (rootForGrouping[namesOfGroupCombos[h]].count(i) == 0) {
-                                       u = abs(u * t->tree[i].getBranchLength());
-                                       WScore[(groupA+groupB)] += u; 
+                                       if (t->tree[i].getBranchLength() != -1) {
+                                               u = abs(u * t->tree[i].getBranchLength());
+                                               WScore[(groupA+groupB)] += u; 
+                                       }
                                }
                                
+                               
                        }
                }
                
@@ -244,7 +247,6 @@ EstOutput Weighted::driver(Tree* t, vector< vector<string> > namesOfGroupCombos,
                count = 0;
                for (int h = start; h < (start+num); h++) {
                        UN = (WScore[namesOfGroupCombos[h][0]+namesOfGroupCombos[h][1]] / D[count]);
-               
                        if (isnan(UN) || isinf(UN)) { UN = 0; } 
                        results.push_back(UN);
                        count++;
@@ -319,12 +321,14 @@ EstOutput Weighted::getValues(Tree* t, string groupA, string groupB) {
                        
                        //if this is not the root then add it
                        if (rootForGrouping[groups].count(i) == 0) {
-                               u = abs(u * t->tree[i].getBranchLength());
-                               WScore[(groupA+groupB)] += u; 
+                               if (t->tree[i].getBranchLength() != -1) {
+                                       u = abs(u * t->tree[i].getBranchLength());
+                                       WScore[(groupA+groupB)] += u;
+                               }
                        }
                }               
                /********************************************************/
-               
+        
                //calculate weighted score for the group combination
                double UN;      
                UN = (WScore[(groupA+groupB)] / D);