]> git.donarmstrong.com Git - mothur.git/blobdiff - weighted.cpp
added logfile feature
[mothur.git] / weighted.cpp
index fa22716e397c4dddb1dd1ab29e2cd04d40b10311..d1bc40ea72b096e6ae8ffce9f5488dec31a85000 100644 (file)
@@ -39,14 +39,14 @@ EstOutput Weighted::getValues(Tree* t) {
                                                        
                                                //if you have a BL
                                                if(t->tree[index].getBranchLength() != -1){
-                                                       sum += t->tree[index].getBranchLength();
+                                                       sum += abs(t->tree[index].getBranchLength());
                                                }
                                                index = t->tree[index].getParent();
                                        }
                                                
                                        //get last breanch length added
                                        if(t->tree[index].getBranchLength() != -1){
-                                               sum += t->tree[index].getBranchLength();
+                                               sum += abs(t->tree[index].getBranchLength());
                                        }
                                                
                                        //is this sum from a sequence which is in one of the users groups
@@ -85,7 +85,7 @@ EstOutput Weighted::getValues(Tree* t) {
                                                u -= (double) t->tree[i].pcount[globaldata->Groups[l]] / (double) tmap->seqsPerGroup[globaldata->Groups[l]];
                                        }
                                                
-                                       u = abs(u) * t->tree[i].getBranchLength();
+                                       u = abs(u * t->tree[i].getBranchLength());
                                        
                                        //save groupcombs u value
                                        WScore[globaldata->Groups[b]+globaldata->Groups[l]] += u;
@@ -109,14 +109,9 @@ EstOutput Weighted::getValues(Tree* t) {
                return data;
        }
        catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the Weighted class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               errorOut(e, "Weighted", "getValues");
                exit(1);
        }
-       catch(...) {
-               cout << "An unknown error has occurred in the Weighted class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-
 }
 
 /**************************************************************************************************/
@@ -142,14 +137,14 @@ EstOutput Weighted::getValues(Tree* t, string groupA, string groupB) {
                                                        
                                //if you have a BL
                                if(t->tree[index].getBranchLength() != -1){
-                                       sum += t->tree[index].getBranchLength();
+                                       sum += abs(t->tree[index].getBranchLength());
                                }
                                index = t->tree[index].getParent();
                        }
                                                
                        //get last breanch length added
                        if(t->tree[index].getBranchLength() != -1){
-                               sum += t->tree[index].getBranchLength();
+                               sum += abs(t->tree[index].getBranchLength());
                        }
                                                
                        if ((t->tree[v].getGroup() == groupA) || (t->tree[v].getGroup() == groupB)) {
@@ -177,7 +172,7 @@ EstOutput Weighted::getValues(Tree* t, string groupA, string groupB) {
                                u -= (double) t->tree[i].pcount[groupB] / (double) tmap->seqsPerGroup[groupB];
                        }
                                                
-                       u = abs(u) * t->tree[i].getBranchLength();
+                       u = abs(u * t->tree[i].getBranchLength());
                                        
                        //save groupcombs u value
                        WScore[(groupA+groupB)] += u;
@@ -195,14 +190,9 @@ EstOutput Weighted::getValues(Tree* t, string groupA, string groupB) {
                return data; 
        }
        catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the Weighted class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               errorOut(e, "Weighted", "getValues");
                exit(1);
        }
-       catch(...) {
-               cout << "An unknown error has occurred in the Weighted class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-
 }