]> git.donarmstrong.com Git - mothur.git/blobdiff - venn.cpp
*** empty log message ***
[mothur.git] / venn.cpp
index 9e75cdb2be63a7f967e08ebe013dd88e1442e8f9..ad74376456f96e09176fa4c97c53e949e7d748b4 100644 (file)
--- a/venn.cpp
+++ b/venn.cpp
@@ -115,7 +115,6 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                delete singleCalc;
                                
                        }
-                       
                /******************* 2 Groups **************************/       
                
                }else if (lookup.size() == 2) {
@@ -183,11 +182,8 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                //close file
                                outsvg << "</g>\n</svg>\n";
                                outsvg.close();
-                               delete sabundA;
-                               delete sabundB;
                                delete singleCalc;
                        }
-                       
                /******************* 3 Groups **************************/
                                                
                }else if (lookup.size() == 3) {
@@ -198,7 +194,7 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                        sA = lookup[0]->getSAbundVector();  sabundA = &sA;
                        sB = lookup[1]->getSAbundVector();  sabundB = &sB;
                        sC = lookup[2]->getSAbundVector();  sabundC = &sC;
-                       
+               
                        //make a file for each calculator
                        for(int i=0;i<vCalcs.size();i++){
                        
@@ -242,9 +238,9 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                vector<double> sharedCwithAB;
                                
                                //find possible sharedABC values
-                               float sharedABC1, sharedABC2, sharedABC3, sharedABC;
+                               float sharedABC1 = 0.0; float sharedABC2 = 0.0; float sharedABC3 = 0.0; float sharedABC = 0.0;
 
-                               if (vCalcs[i]->getName() != "sharedchao") {
+                               if (vCalcs[i]->getMultiple() == false) {
                                        //merge BC and estimate with shared with A
                                        SharedRAbundVector* merge = new SharedRAbundVector();
                                        for (int j = 0; j < lookup[1]->size(); j++) {
@@ -283,9 +279,9 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                        sharedABC3 = sharedAC[0] + sharedBC[0] - sharedCwithAB[0];
  
                                        //if any of the possible m's are - throw them out
-                                       if (sharedABC1 < 0.0) { sharedABC1 = 0; }
-                                       if (sharedABC2 < 0.0) { sharedABC2 = 0; }
-                                       if (sharedABC3 < 0.0) { sharedABC3 = 0; }
+                                       if (sharedABC1 < 0.00001) { sharedABC1 = 0; }
+                                       if (sharedABC2 < 0.00001) { sharedABC2 = 0; }
+                                       if (sharedABC3 < 0.00001) { sharedABC3 = 0; }
                
                                        //sharedABC is the minimum of the 3 possibilities
                                        if ((sharedABC1 < sharedABC2) && (sharedABC1 < sharedABC3)) { sharedABC = sharedABC1; }
@@ -298,7 +294,7 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                        sharedBwithAC.push_back(sharedAB[0] + sharedBC[0] - sharedABC);
                                        sharedCwithAB.push_back(sharedAC[0] + sharedBC[0] - sharedABC);
                                }
-                       
+               
                                //image window
                                outsvg << "<svg width=\"100%\" height=\"100%\" viewBox=\"0 0 800 800\" >\n";
                                outsvg << "<g>\n";
@@ -351,6 +347,7 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                outsvg << "</g>\n</svg>\n";
                                outsvg.close();
                                delete singleCalc;
+
                        }
                        
                /******************* 4 Groups **************************/
@@ -516,7 +513,6 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                        delete singleCalc;
                                }
                        }
-
                }
                
        }