]> git.donarmstrong.com Git - mothur.git/commitdiff
fixed bug in venn command
authorwestcott <westcott>
Thu, 14 May 2009 13:22:38 +0000 (13:22 +0000)
committerwestcott <westcott>
Thu, 14 May 2009 13:22:38 +0000 (13:22 +0000)
commandfactory.cpp
distancecommand.cpp
eachgapdist.h
eachgapignore.h
errorchecking.cpp
globaldata.cpp
helpcommand.cpp
ignoregaps.h
onegapdist.h
onegapignore.h
venn.cpp

index c03751518e3e9a2ab54da2e38be693e08a3d6c34..2e8aca7823a76b6656e091b48aeda4a23813aaa1 100644 (file)
@@ -92,7 +92,7 @@ Command* CommandFactory::getCommand(string commandName){
                else if(commandName == "tree.shared")                   {   command = new TreeGroupCommand();                   }
                else if(commandName == "bootstrap.shared")              {   command = new BootSharedCommand();                  }
                else if(commandName == "concensus")                             {   command = new ConcensusCommand();                   }
-               else if(commandName == "dist.seq")                              {   command = new DistanceCommand();                    }
+               else if(commandName == "dist.seqs")                             {   command = new DistanceCommand();                    }
                else                                                                                    {       command = new NoCommand();                                      }
 
                return command;
index 90ffb8df31d5aff2a47ee0f29ce9df33397d39b7..140aa6085b4007a3998ffc6a769b266464b16e6a 100644 (file)
@@ -88,81 +88,87 @@ int DistanceCommand::execute(){
                
                remove(distFile.c_str());
                
-               if(processors == 1){
-                       driver(distCalculator, seqDB, 0, numSeqs, distFile, cutoff);    
-               }       
-               else if(processors == 2){
+       //      #       if defined (WIN_VERSION)
+               //      driver(distCalculator, seqDB, 0, numSeqs, distFile, cutoff);
+       //      #       endif
                
-                       int pid = fork();
-                       if(pid > 0){
-                               driver(distCalculator, seqDB, 0, (numSeqs/sqrt(2)), distFile + "tempa", cutoff);        
-                               appendFiles((distFile+"tempa"), distFile);
-                               remove((distFile + "tempa").c_str());   
-                       }
-                       else{
-                               driver(distCalculator, seqDB, (numSeqs/sqrt(2)), numSeqs, distFile + "tempb", cutoff);  
-                               appendFiles((distFile+"tempb"), distFile);
-                               remove((distFile + "tempb").c_str());   
-                       }
-                       wait(NULL);
-
-               }
-               else if(processors == 3){
-                       int pid1 = fork();
-                       if(pid1 > 0){
-                               int pid2 = fork();
-                               if(pid2 > 0){
-                                       driver(distCalculator, seqDB, 0, sqrt(3) * numSeqs / 3, distFile + "tempa", cutoff);
-                                       appendFiles(distFile+"tempa", distFile);
+       //      #       if defined (LINUX_VERSION)
+                       if(processors == 1){
+                               driver(distCalculator, seqDB, 0, numSeqs, distFile, cutoff);    
+                       }       
+                       else if(processors == 2){
+               
+                               int pid = fork();
+                               if(pid > 0){
+                                       driver(distCalculator, seqDB, 0, (numSeqs/sqrt(2)), distFile + "tempa", cutoff);        
+                                       appendFiles((distFile+"tempa"), distFile);
                                        remove((distFile + "tempa").c_str());   
                                }
                                else{
-                                       driver(distCalculator, seqDB, sqrt(3) * numSeqs / 3, sqrt(6) * numSeqs / 3, distFile + "tempb", cutoff);        
-                                       appendFiles(distFile+"tempb", distFile);
-                                       remove((distFile + "tempb").c_str());                           
+                                       driver(distCalculator, seqDB, (numSeqs/sqrt(2)), numSeqs, distFile + "tempb", cutoff);  
+                                       appendFiles((distFile+"tempb"), distFile);
+                                       remove((distFile + "tempb").c_str());   
                                }
                                wait(NULL);
+
                        }
-                       else{
-                               driver(distCalculator, seqDB, sqrt(6) * numSeqs / 3, numSeqs, distFile + "tempc", cutoff);      
-                               appendFiles(distFile+"tempc", distFile);
-                               remove((distFile + "tempc").c_str());                   
-                       }
-                       wait(NULL);
-               }
-               else if(processors == 4){
-                       int pid1 = fork();
-                       if(pid1 > 0){
-                               int pid2 = fork();
-                               if(pid2 > 0){
-                                       driver(distCalculator, seqDB, 0, numSeqs / 2, distFile + "tempa", cutoff);      
-                                       appendFiles(distFile+"tempa", distFile);
-                                       remove((distFile + "tempa").c_str());                   
+                       else if(processors == 3){
+                               int pid1 = fork();
+                               if(pid1 > 0){
+                                       int pid2 = fork();
+                                       if(pid2 > 0){
+                                               driver(distCalculator, seqDB, 0, sqrt(3) * numSeqs / 3, distFile + "tempa", cutoff);
+                                               appendFiles(distFile+"tempa", distFile);
+                                               remove((distFile + "tempa").c_str());   
+                                       }
+                                       else{
+                                               driver(distCalculator, seqDB, sqrt(3) * numSeqs / 3, sqrt(6) * numSeqs / 3, distFile + "tempb", cutoff);        
+                                               appendFiles(distFile+"tempb", distFile);
+                                               remove((distFile + "tempb").c_str());                           
+                                       }
+                                       wait(NULL);
                                }
                                else{
-                                       driver(distCalculator, seqDB, numSeqs / 2, (numSeqs/sqrt(2)), distFile + "tempb", cutoff);      
-                                       appendFiles(distFile+"tempb", distFile);
-                                       remove((distFile + "tempb").c_str());                           
+                                       driver(distCalculator, seqDB, sqrt(6) * numSeqs / 3, numSeqs, distFile + "tempc", cutoff);      
+                                       appendFiles(distFile+"tempc", distFile);
+                                       remove((distFile + "tempc").c_str());                   
                                }
                                wait(NULL);
                        }
-                       else{
-                               int pid3 = fork();
-                               if(pid3 > 0){
-                                       driver(distCalculator, seqDB, (numSeqs/sqrt(2)), (sqrt(3) * numSeqs / 2), distFile + "tempc", cutoff);  
-                                       appendFiles(distFile+"tempc", distFile);
-                                       remove((distFile + "tempc").c_str());                           
+                       else if(processors == 4){
+                               int pid1 = fork();
+                               if(pid1 > 0){
+                                       int pid2 = fork();
+                                       if(pid2 > 0){
+                                               driver(distCalculator, seqDB, 0, numSeqs / 2, distFile + "tempa", cutoff);      
+                                               appendFiles(distFile+"tempa", distFile);
+                                               remove((distFile + "tempa").c_str());                   
+                                       }
+                                       else{
+                                               driver(distCalculator, seqDB, numSeqs / 2, (numSeqs/sqrt(2)), distFile + "tempb", cutoff);      
+                                               appendFiles(distFile+"tempb", distFile);
+                                               remove((distFile + "tempb").c_str());                           
+                                       }
+                                       wait(NULL);
                                }
                                else{
-                                       driver(distCalculator, seqDB, (sqrt(3) * numSeqs / 2), numSeqs, distFile + "tempd", cutoff);    
-                                       appendFiles(distFile+"tempd", distFile);
-                                       remove((distFile + "tempd").c_str());                           
+                                       int pid3 = fork();
+                                       if(pid3 > 0){
+                                               driver(distCalculator, seqDB, (numSeqs/sqrt(2)), (sqrt(3) * numSeqs / 2), distFile + "tempc", cutoff);  
+                                               appendFiles(distFile+"tempc", distFile);
+                                               remove((distFile + "tempc").c_str());                           
+                                       }
+                                       else{
+                                               driver(distCalculator, seqDB, (sqrt(3) * numSeqs / 2), numSeqs, distFile + "tempd", cutoff);    
+                                               appendFiles(distFile+"tempd", distFile);
+                                               remove((distFile + "tempd").c_str());                           
+                                       }
+                                       wait(NULL);
                                }
                                wait(NULL);
                        }
                        wait(NULL);
-               }
-               wait(NULL);
+               //#     endif
        
                delete distCalculator;
        
@@ -191,7 +197,11 @@ int DistanceCommand::driver(Dist* distCalculator, SequenceDB* align, int startLi
        
                for(int i=startLine;i<endLine;i++){
                
-                       for(int j=0;j<i;j++){   
+                       for(int j=0;j<i;j++){
+//cout << "unaligned" << endl;
+//cout << align->get(i).getUnaligned() << "  " << align->get(j).getUnaligned() << endl;
+//cout << "aligned" << endl;
+//cout << align->get(i).getAligned() << "  " << align->get(j).getAligned() << endl;
                                distCalculator->calcDist(align->get(i), align->get(j));
                                double dist = distCalculator->getDist();
 
index f4f00c16d4b41632f2c435d921ddc5bb3554edad..767c4bf819aa25f2bee0c4f40a99374a30bb35e5 100644 (file)
@@ -22,24 +22,24 @@ public:
                int start = 0;
                
                for(int i=0; i<A.getLength(); i++){
-                       if(A.getUnaligned()[i] != '.' || B.getUnaligned()[i] != '.'){
+                       if(A.getAligned()[i] != '.' || B.getAligned()[i] != '.'){
                                start = i;
                                break;
                        }
                }
                
                for(int i=start;i<A.getLength();i++){
-                       if((A.getUnaligned()[i] == '-' || B.getUnaligned()[i] == '-') && (A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.')){}
-                       else if(A.getUnaligned()[i] == '.' && B.getUnaligned()[i] == '.'){
+                       if((A.getAligned()[i] == '-' || B.getAligned()[i] == '-') && (A.getAligned()[i] == '.' || B.getAligned()[i] == '.')){}
+                       else if(A.getAligned()[i] == '.' && B.getAligned()[i] == '.'){
                                break;  
                        }
-                       else if(A.getUnaligned()[i] != '-' && B.getUnaligned()[i] != '-'){
-                               if(A.getUnaligned()[i] != B.getUnaligned()[i]){
+                       else if(A.getAligned()[i] != '-' && B.getAligned()[i] != '-'){
+                               if(A.getAligned()[i] != B.getAligned()[i]){
                                        diff++;
                                }
                                length++;
                        }
-                       else if(A.getUnaligned()[i] != '-' || B.getUnaligned()[i] != '-'){
+                       else if(A.getAligned()[i] != '-' || B.getAligned()[i] != '-'){
                                diff++;
                                length++;
                        }
index edc1cab3e4a1bbaf006df491ce1cd79da69db046..9b9d1673249d454bf1a7ce19f41d9b568568ccb6 100644 (file)
@@ -25,7 +25,7 @@ public:
                int end = 0;
                
                for(int i=0;i<A.getLength();i++){
-                       if(A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.' || A.getUnaligned()[i] == '-' || B.getUnaligned()[i] == '-'){
+                       if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.' || A.getAligned()[i] == '-' || B.getAligned()[i] == '-'){
                        }
                        else{
                                start = i;
@@ -33,7 +33,7 @@ public:
                        }
                }
                for(int i=A.getLength()-1;i>=0;i--){
-                       if(A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.' || A.getUnaligned()[i] == '-' || B.getUnaligned()[i] == '-'){
+                       if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.' || A.getAligned()[i] == '-' || B.getAligned()[i] == '-'){
                        }
                        else{
                                end = i;
@@ -42,17 +42,17 @@ public:
                }
                
                for(int i=start;i<=end;i++){
-                       if(A.getUnaligned()[i] == '-' && B.getUnaligned()[i] == '-'){}
-                       else if(A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.'){
+                       if(A.getAligned()[i] == '-' && B.getAligned()[i] == '-'){}
+                       else if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.'){
                                break;  
                        }
-                       else if(A.getUnaligned()[i] != '-' && B.getUnaligned()[i] != '-'){
-                               if(A.getUnaligned()[i] != B.getUnaligned()[i]){
+                       else if(A.getAligned()[i] != '-' && B.getAligned()[i] != '-'){
+                               if(A.getAligned()[i] != B.getAligned()[i]){
                                        diff++;
                                }
                                length++;
                        }
-                       else if(A.getUnaligned()[i] != '-' || B.getUnaligned()[i] != '-'){
+                       else if(A.getAligned()[i] != '-' || B.getAligned()[i] != '-'){
                                diff++;
                                length++;
                        }
index c866ca0060960ab20f50f53ffbd774c066ffc628..8aaa8b04fbeeb80b4c727396bab06f9899840a7e 100644 (file)
@@ -246,7 +246,7 @@ bool ErrorCheck::checkInput(string input) {
                        }
                }
                
-               if ((commandName == "filter.seqs") || (commandName == "dist.seq")) { 
+               if ((commandName == "filter.seqs") || (commandName == "dist.seqs")) { 
                        if ((fastafile == "") && (nexusfile == "") && (clustalfile == "") && (phylipfile == "")) {
                                 cout << "You must read either a fasta, nexus, clustal, or phylip file before you can use the filter.seqs command." << endl; return false; 
                        }
index fddb5c9caadb3e2e7fcaf7f940718eacb6c39e30..4dfcbc1cf7129a6a9044b74f3ffb76671a0fd059 100644 (file)
@@ -43,7 +43,7 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                }
                
                //set default value for cutoff
-               if (commandName == "dist.seq") {        cutoff = "1.0";         }
+               if (commandName == "dist.seqs") {       cutoff = "1.0";         }
 
                string key, value;              
                //reads in parameters and values
@@ -215,7 +215,7 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                        Estimators.clear();
                        splitAtDash(calc, Estimators); 
                }
-               if (commandName == "dist.seq") {
+               if (commandName == "dist.seqs") {
                        if ((calc == "default") || (calc == "")) {  calc = "onegap";  }
                        Estimators.clear();
                        splitAtDash(calc, Estimators); 
index 9d7f5c8e27fb95ba9cd404e484ef96f20ddc8594..c259e1f065c5861c5fe337715bf5879e9709e1f9 100644 (file)
@@ -70,17 +70,17 @@ int HelpCommand::execute(){
                cout << "The deconvolute command parameter is fasta and it is required." << "\n";
                cout << "The deconvolute command should be in the following format: " << "\n";
                cout << "deconvolute(fasta=yourFastaFile) " << "\n";
-       }else if (globaldata->helpRequest == "dist.seq") {
-               cout << "The dist.seq command reads a file containing sequences and creates a distance file." << "\n";
-               cout << "The dist.seq command parameters are fasta, phylip, clustal, nexus, calc, ends, cutoff and processors.  " << "\n";
+       }else if (globaldata->helpRequest == "dist.seqs") {
+               cout << "The dist.seqs command reads a file containing sequences and creates a distance file." << "\n";
+               cout << "The dist.seqs command parameters are fasta, phylip, clustal, nexus, calc, ends, cutoff and processors.  " << "\n";
                cout << "You must use one of the following parameters for your filename: fasta, phylip, clustal or nexus. " << "\n";
                cout << "The calc parameter allows you to specify the method of calculating the distances.  Your options are: nogaps, onegap or eachgap. The default is onegap." << "\n";
                cout << "The ends parameter allows you to specify whether to include terminal gaps in distance.  Your options are: T or F. The default is T." << "\n";
                cout << "The cutoff parameter allows you to specify maximum distance to keep. The default is 1.0." << "\n";
                cout << "The processors parameter allows you to specify number of processors to use.  The default is 1, but you can use up to 4 processors." << "\n";
-               cout << "The dist.seq command should be in the following format: " << "\n";
-               cout << "dist.seq(fasta=yourFastaFile, calc=yourCalc, ends=yourEnds, cutoff= yourCutOff, processors=yourProcessors) " << "\n";
-               cout << "Example dist.seq(fasta=amazon.fasta, calc=eachgap, ends=F, cutoff= 2.0, processors=3)." << "\n";
+               cout << "The dist.seqs command should be in the following format: " << "\n";
+               cout << "dist.seqs(fasta=yourFastaFile, calc=yourCalc, ends=yourEnds, cutoff= yourCutOff, processors=yourProcessors) " << "\n";
+               cout << "Example dist.seqs(fasta=amazon.fasta, calc=eachgap, ends=F, cutoff= 2.0, processors=3)." << "\n";
                cout << "Note: No spaces between parameter labels (i.e. calc), '=' and parameters (i.e.yourCalc)." << "\n" << "\n";
        }else if (globaldata->helpRequest == "collect.single") {
                cout << "The collect.single command can only be executed after a successful read.otu command. WITH ONE EXECEPTION. " << "\n";
index aa106c9b1bbc6bcc1cde4be9dd02fb5876b3ef85..8127b6205e42d18516561565e8a4eb29ccd56ab6 100644 (file)
@@ -27,7 +27,7 @@ public:
                int end = 0;
                
                for(int i=0;i<A.getLength();i++){
-                       if(A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.' || A.getUnaligned()[i] == '-' || B.getUnaligned()[i] == '-'){
+                       if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.' || A.getAligned()[i] == '-' || B.getAligned()[i] == '-'){
                        }
                        else{
                                start = i;
@@ -35,7 +35,7 @@ public:
                        }
                }
                for(int i=A.getLength()-1;i>=0;i--){
-                       if(A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.' || A.getUnaligned()[i] == '-' || B.getUnaligned()[i] == '-'){
+                       if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.' || A.getAligned()[i] == '-' || B.getAligned()[i] == '-'){
                        }
                        else{
                                end = i;
@@ -44,11 +44,11 @@ public:
                }
                
                for(int i=start; i<=end; i++){
-                       if(A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.'){
+                       if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.'){
                                break;
                        }
-                       else if((A.getUnaligned()[i] != '-' && B.getUnaligned()[i] != '-')){
-                               if(A.getUnaligned()[i] != B.getUnaligned()[i]){
+                       else if((A.getAligned()[i] != '-' && B.getAligned()[i] != '-')){
+                               if(A.getAligned()[i] != B.getAligned()[i]){
                                        diff++;
                                }
                                length++;
index ef290fe22b91f0ac1e1fbc9a29bc86e86eea8511..b6b257cb2f452027f19ff06e199f432076a2ef5b 100644 (file)
@@ -26,7 +26,7 @@ public:
                int start = 0;
                
                for(int i=0;i<A.getLength();i++){
-                       if(A.getUnaligned()[i] == '.' && B.getUnaligned()[i] == '.'){
+                       if(A.getAligned()[i] == '.' && B.getAligned()[i] == '.'){
                        }
                        else{
                                start = i;
@@ -34,8 +34,8 @@ public:
                        }
                }
                for(int i=start;i<A.getLength();i++){
-                       if((A.getUnaligned()[i] == '-' || B.getUnaligned()[i] == '-') && (A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.')){}
-                       else if(A.getUnaligned()[i] == '-' && B.getUnaligned()[i] != '-' && B.getUnaligned()[i] != '.'){
+                       if((A.getAligned()[i] == '-' || B.getAligned()[i] == '-') && (A.getAligned()[i] == '.' || B.getAligned()[i] == '.')){}
+                       else if(A.getAligned()[i] == '-' && B.getAligned()[i] != '-' && B.getAligned()[i] != '.'){
                                if(openGapA == 0){
                                        difference++;
                                        minLength++;
@@ -43,7 +43,7 @@ public:
                                        openGapB = 0;
                                }
                        }
-                       else if(A.getUnaligned()[i] != '-' && B.getUnaligned()[i] == '-' && A.getUnaligned()[i] != '.'){
+                       else if(A.getAligned()[i] != '-' && B.getAligned()[i] == '-' && A.getAligned()[i] != '.'){
                                if(openGapB == 0){
                                        difference++;
                                        minLength++;
@@ -51,8 +51,8 @@ public:
                                        openGapB = 1;
                                }
                        }
-                       else if(A.getUnaligned()[i] != '-' && B.getUnaligned()[i] != '-'){
-                               if(A.getUnaligned()[i] != B.getUnaligned()[i]){
+                       else if(A.getAligned()[i] != '-' && B.getAligned()[i] != '-'){
+                               if(A.getAligned()[i] != B.getAligned()[i]){
                                        difference++;
                                        minLength++;
                                        openGapA = 0;
@@ -64,7 +64,7 @@ public:
                                        openGapB = 0;
                                }
                        }
-                       else if(A.getUnaligned()[i] == '.' && B.getUnaligned()[i] == '.'){
+                       else if(A.getAligned()[i] == '.' && B.getAligned()[i] == '.'){
                                break;
                        }
                }
index e280ce0ea45e3c828205a5d8872a47cacf8fcc02..ee6cc5267931816a654c99f4e748d19bb2940901 100644 (file)
@@ -26,7 +26,7 @@ public:
                int end = 0;
                
                for(int i=0;i<A.getLength();i++){
-                       if(A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.' || A.getUnaligned()[i] == '-' || B.getUnaligned()[i] == '-'){
+                       if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.' || A.getAligned()[i] == '-' || B.getAligned()[i] == '-'){
                        }
                        else{
                                start = i;
@@ -34,7 +34,7 @@ public:
                        }
                }
                for(int i=A.getLength()-1;i>=0;i--){
-                       if(A.getUnaligned()[i] == '.' || B.getUnaligned()[i] == '.' || A.getUnaligned()[i] == '-' || B.getUnaligned()[i] == '-'){
+                       if(A.getAligned()[i] == '.' || B.getAligned()[i] == '.' || A.getAligned()[i] == '-' || B.getAligned()[i] == '-'){
                        }
                        else{
                                end = i;
@@ -44,8 +44,8 @@ public:
                
                
                for(int i=start;i<=end;i++){
-                       if(A.getUnaligned()[i] == '-' && B.getUnaligned()[i] == '-'){}
-                       else if(A.getUnaligned()[i] == '-' && B.getUnaligned()[i] != '-'){
+                       if(A.getAligned()[i] == '-' && B.getAligned()[i] == '-'){}
+                       else if(A.getAligned()[i] == '-' && B.getAligned()[i] != '-'){
                                if(openGapA == 0){
                                        difference++;
                                        minLength++;
@@ -53,7 +53,7 @@ public:
                                        openGapB = 0;
                                }
                        }
-                       else if(A.getUnaligned()[i] != '-' && B.getUnaligned()[i] == '-'){
+                       else if(A.getAligned()[i] != '-' && B.getAligned()[i] == '-'){
                                if(openGapB == 0){
                                        difference++;
                                        minLength++;
@@ -61,8 +61,8 @@ public:
                                        openGapB = 1;
                                }
                        }
-                       else if(A.getUnaligned()[i] != '-' && B.getUnaligned()[i] != '-'){
-                               if(A.getUnaligned()[i] != B.getUnaligned()[i]){
+                       else if(A.getAligned()[i] != '-' && B.getAligned()[i] != '-'){
+                               if(A.getAligned()[i] != B.getAligned()[i]){
                                        difference++;
                                        minLength++;
                                        openGapA = 0;
index 9e75cdb2be63a7f967e08ebe013dd88e1442e8f9..2c579604ae7d57044ebe2a793f03ce2dce5f414c 100644 (file)
--- a/venn.cpp
+++ b/venn.cpp
@@ -115,7 +115,7 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                delete singleCalc;
                                
                        }
-                       
+                       delete sabund;
                /******************* 2 Groups **************************/       
                
                }else if (lookup.size() == 2) {
@@ -183,11 +183,10 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                //close file
                                outsvg << "</g>\n</svg>\n";
                                outsvg.close();
-                               delete sabundA;
-                               delete sabundB;
                                delete singleCalc;
                        }
-                       
+                       delete sabundA;
+                       delete sabundB;
                /******************* 3 Groups **************************/
                                                
                }else if (lookup.size() == 3) {
@@ -352,7 +351,9 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                outsvg.close();
                                delete singleCalc;
                        }
-                       
+                       delete sabundA;
+                       delete sabundB;
+                       delete sabundC;
                /******************* 4 Groups **************************/
                
                }else if (lookup.size() == 4) {
@@ -516,7 +517,10 @@ void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs
                                        delete singleCalc;
                                }
                        }
-
+                       delete sabundA;
+                       delete sabundB;
+                       delete sabundC;
+                       delete sabundD;
                }
                
        }