]> git.donarmstrong.com Git - mothur.git/commitdiff
pds fixes of heatmap and some other minor stuff
authorpschloss <pschloss>
Mon, 20 Apr 2009 20:37:11 +0000 (20:37 +0000)
committerpschloss <pschloss>
Mon, 20 Apr 2009 20:37:11 +0000 (20:37 +0000)
14 files changed:
ace.h
binsequencecommand.cpp
engine.cpp
heatmap.cpp
heatmap.h
heatmapcommand.cpp
libshuffcommand.cpp
sharedace.h
sharedsobs.h
sharedsobscollectsummary.h
sobs.h
tree.h
venn.cpp
venn.h

diff --git a/ace.h b/ace.h
index b81dd64eef6c0cd24d354416f0dd6e3583b83bd2..c3d156c69729947491a2e5ea86d7a83e5b64ee43 100644 (file)
--- a/ace.h
+++ b/ace.h
@@ -20,7 +20,7 @@ It is a child of the calculator class. */
 class Ace : public Calculator  {
        
 public:
-       Ace(int n) : abund(n), Calculator("ACE", 3) {};
+       Ace(int n) : abund(n), Calculator("ace", 3) {};
        EstOutput getValues(SAbundVector*);
        EstOutput getValues(SharedRAbundVector*, SharedRAbundVector*) {return data;};
 private:
index c3c68abacffd43efaf5768796655e8816da87bd6..7c70604e39f16c20821c620769ee89cd4a71958d 100644 (file)
@@ -105,7 +105,7 @@ int BinSeqCommand::execute(){
                                        //get last name
                                        sequence = fasta->getSequence(binnames);
                                        if (sequence != "not found") {
-                                               name = binnames + "bin" + toString(i+1);
+                                               name = binnames + '|' + toString(i+1);
                                                out << ">" << name << endl;
                                                out << sequence << endl;
                                        }else { 
index 68a75005f1521411227b20fe9ed253ec0b902e1c..b9360a4468a9aedd553675d9d3a2110afa6feab7 100644 (file)
@@ -45,8 +45,8 @@ bool InteractEngine::getInput(){
                bool errorFree;
                ErrorCheck* errorCheckor = new ErrorCheck();
                
-               cout << "mothur v1.0" << endl;
-               cout << "Last updated: 1/29/2009" << endl << endl;
+               cout << "mothur v1.2.0" << endl;
+               cout << "Last updated: 4/14/2009" << endl << endl;
                cout << "by" << endl;
                cout << "Patrick D. Schloss" << endl << endl;
                cout << "Department of Microbiology" << endl;
index 08eb732b22818efee710f647c70646cd1cc7ade2..187c953fcaf49501f9985d669cfd7645d7294355 100644 (file)
@@ -27,80 +27,74 @@ HeatMap::HeatMap(){
                exit(1);
        }
 }
+
 //**********************************************************************************************************************
+
 void HeatMap::getPic(OrderVector* order) {
        try {
-               colorScale.clear();
                
-               rabund = order->getRAbundVector();
+               RAbundVector rabund = order->getRAbundVector();
                
                //get users scaling method
                scaler = globaldata->getScale();
                
-               float maxbin = 0.0;
-               for (int i = 0; i < rabund.size(); i++) {
-                       if (rabund.get(i) != 0) { //don't want log value of 0.
-                                       if (scaler == "log10") {
-                                               colorScale[(log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))] = "";  
-                                               if (maxbin < (log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))) { maxbin = (log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000)); }
-                                       }else if (scaler == "log2") {
-                                               colorScale[(log2((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))] = "";  
-                                               if (maxbin < (log2((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))) { maxbin = (log2((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000)); }
-                                       }else if (scaler == "linear") {
-                                               colorScale[rabund.get(i)] = "";
-                                               if (maxbin < rabund.get(i)) { maxbin = rabund.get(i); }
-                                       }else {  //if user enters invalid scaler option.
-                                               cout << scaler << " is not a valid scaler option. I will use log10." << endl;
-                                               colorScale[(log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))] = ""; 
-                                               if (maxbin < (log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))) { maxbin = (log10((rabund.get(i)) / (float)rabund.getNumSeqs()) * 1000); }  
-                                       } 
-                       }else { colorScale[0] = "00";  }
+               float maxRelAbund = 0.0;                
+               
+               for(int i=0;i<rabund.size();i++){                               
+                       float relAbund = rabund.get(i) / (float)rabund.getNumSeqs();
+                       if(relAbund > maxRelAbund){     maxRelAbund = relAbund; }
                }
                
-               float scalers = 255 / (float) maxbin;
+               scaler = globaldata->getScale();
                
-               //go through map and give each score a color value
-               for (it = colorScale.begin(); it != colorScale.end(); it++) {
-                       it->second = toHex(int(float(it->first) * scalers));
-                       if(it->second.length() == 1) {  it->second = "0" + it->second;  }
+               vector<string> scaleRelAbund(rabund.size(), "");
+               
+               for(int i=0;i<rabund.size();i++){
+                       float relAbund = rabund.get(i) / (float)rabund.getNumSeqs();
+                       
+                       if (rabund.get(i) != 0) { //don't want log value of 0.
+                               if (scaler == "log10") {
+                                       scaleRelAbund[i] = toHex(int(255 * log10(relAbund) / log10(maxRelAbund))) + "0000";  
+                               }else if (scaler == "log2") {
+                                       scaleRelAbund[i] = toHex(int(255 * log2(relAbund) / log2(maxRelAbund))) + "0000";  
+                               }else if (scaler == "linear") {
+                                       scaleRelAbund[i] = toHex(int(255 * relAbund / maxRelAbund)) + "0000";  
+                               }else {  //if user enters invalid scaler option.
+                                       scaleRelAbund[i] = toHex(int(255 * log10(relAbund / log10(maxRelAbund))))  + "0000"; 
+                               } 
+                       }
+                       else { scaleRelAbund[i] = "FFFFFF";  }
                }
-
-               string filenamesvg = getRootName(globaldata->inputFileName) + order->getLabel() + ".heatmap.svg";
+               
+               
+               string filenamesvg = getRootName(globaldata->inputFileName) + rabund.getLabel() + ".heatmap.svg";
                openOutputFile(filenamesvg, outsvg);
                
                //svg image
-               outsvg << "<svg width=\"100%\" height=\"100%\" viewBox=\"0 0 300 " + toString((rabund.getNumBins()*5 + 120))  + "\">\n";
+               outsvg << "<svg width=\"100%\" height=\"100%\" viewBox=\"0 0 " + toString(300) + " " + toString((rabund.getNumBins()*5 + 120))  + "\">\n";
                outsvg << "<g>\n";
                
                //white backround
-               outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"300\" height=\"" + toString((rabund.getNumBins()*5 + 120))  + "\"/>"; 
-               outsvg << "<text fill=\"black\" class=\"seri\" x=\"100\" y=\"25\">Heatmap at distance " + order->getLabel() + "</text>\n";
-               
+               outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"" + toString(300) + "\" height=\"" + toString((rabund.getNumBins()*5 + 120))  + "\"/>"; 
+               outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString((150) - 40) + "\" y=\"25\">Heatmap at distance " + rabund.getLabel() + "</text>\n";
+                               
                //output legend and color labels
                string color;
                int x = 0;
                int y = 103 + (rabund.getNumBins()*5);
-               printLegend(y, maxbin);
+               printLegend(y, maxRelAbund);
                
                y = 70;
-               for (int i = 0; i <= rabund.getNumBins(); i++) {
-                       if (rabund.get(i) != 0) { //don't want log value of 0.
-                               if (scaler == "log10") {
-                                       color = colorScale[(log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))];  
-                               }else if (scaler == "log2") {
-                                       color = colorScale[(log2((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))];  
-                               }else if (scaler == "linear") {
-                                       color = colorScale[rabund.get(i)]; 
-                               }else {  color = colorScale[(log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))];      } 
-                       }else { color = "OO";  }
+               for (int i = 0; i < scaleRelAbund.size(); i++) {
                        
-                       outsvg << "<rect fill=\"#" + color + "0000\" stroke=\"#" + color + "0000\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"300\" height=\"5\"/>\n";
+                       outsvg << "<rect fill=\"#" + scaleRelAbund[i] + "\" stroke=\"#" + scaleRelAbund[i] + "\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"300\" height=\"5\"/>\n";
                        y += 5;
                }
                
                outsvg << "</g>\n</svg>\n";
                outsvg.close();
                
+               
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the HeatMap class Function getPic. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
@@ -111,52 +105,56 @@ void HeatMap::getPic(OrderVector* order) {
                exit(1);
        }
 }
+
 //**********************************************************************************************************************
+
 void HeatMap::getPic(SharedOrderVector* sharedorder) {
        try {
-               colorScale.clear();
                
                //fills vector of sharedsabunds - lookup
-               util->getSharedVectors(globaldata->Groups, lookup, sharedorder);  //fills group vectors from order vector.
+               vector<SharedRAbundVector*> lookup;
 
+               util->getSharedVectors(globaldata->Groups, lookup, sharedorder);  //fills group vectors from order vector.
+               
                //sort lookup so shared bins are on top
-               if (sorted == "T") {  sortSharedVectors();  }
-       
-               //get users scaling method
+               if (sorted == "T") {  sortSharedVectors(lookup);  }
+               
+               vector<vector<string> > scaleRelAbund;
+               vector<float> maxRelAbund(lookup.size(), 0.0);          
+               float superMaxRelAbund = 0;
+               
+               for(int i = 0; i < lookup.size(); i++){
+                       for(int j=0; j<lookup[i]->size(); j++){
+                               
+                               float relAbund = lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs();
+                               if(relAbund > maxRelAbund[i]){  maxRelAbund[i] = relAbund;      }
+                       }
+                       if(maxRelAbund[i] > superMaxRelAbund){  superMaxRelAbund = maxRelAbund[i];      }
+               }
+               
                scaler = globaldata->getScale();
                
-               float maxbin = 0.0;
-               for (int i = 0; i < lookup.size(); i++) {
-                       for (int j = 0; j < lookup[i]->size(); j++) {
+               scaleRelAbund.resize(lookup.size());
+               for(int i=0;i<lookup.size();i++){
+                       scaleRelAbund[i].assign(lookup[i]->size(), "");
+                       for(int j=0;j<lookup[i]->size();j++){
+                               float relAbund = lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs();
+                               
                                if (lookup[i]->getAbundance(j) != 0) { //don't want log value of 0.
                                        if (scaler == "log10") {
-                                               colorScale[(log10((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 1000))] = "";  
-                                               if (maxbin < (log10((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 1000))) { maxbin = (log10((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 1000)); }
+                                               scaleRelAbund[i][j] = toHex(int(255 * log10(relAbund) / log10(maxRelAbund[i]))) + "0000";  
                                        }else if (scaler == "log2") {
-                                               colorScale[(log2((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 1000))] = "";  
-                                               if (maxbin < (log2((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 1000))) { maxbin = (log2((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 1000)); }
+                                               scaleRelAbund[i][j] = toHex(int(255 * log2(relAbund) / log2(maxRelAbund[i]))) + "0000";  
                                        }else if (scaler == "linear") {
-                                               colorScale[lookup[i]->getAbundance(j)] = "";
-                                               if (maxbin < lookup[i]->getAbundance(j)) { maxbin = lookup[i]->getAbundance(j); }
+                                               scaleRelAbund[i][j] = toHex(int(255 * relAbund / maxRelAbund[i])) + "0000";  
                                        }else {  //if user enters invalid scaler option.
-                                               cout << scaler << " is not a valid scaler option. I will use log10." << endl;
-                                               colorScale[(log10((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 1000))] = ""; 
-                                               if (maxbin < (log10((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 1000))) { maxbin = (log10((lookup[i]->getAbundance(j)) / (float)lookup[i]->getNumSeqs()) * 1000); }  
+                                               scaleRelAbund[i][j] = toHex(int(255 * log10(relAbund / log10(maxRelAbund[i]))))  + "0000"; 
                                        } 
-                               }else { colorScale[0] = "00";  }
+                               }else { scaleRelAbund[i][j] = "FFFFFF";  }
+                               
                        }
                }
                
-               //get scaler
-               float scalers = 255 / (float) maxbin;
-               
-               
-               //go through map and give each score a color value
-               for (it = colorScale.begin(); it != colorScale.end(); it++) {
-                       it->second = toHex(int(float(it->first) * scalers));
-                       if(it->second.length() == 1) {  it->second = "0" + it->second;  }
-               }
-               
                string filenamesvg = getRootName(globaldata->inputFileName) + sharedorder->getLabel() + ".heatmap.svg";
                openOutputFile(filenamesvg, outsvg);
                
@@ -177,31 +175,19 @@ void HeatMap::getPic(SharedOrderVector* sharedorder) {
                string color;
                int x = 0;
                int y = 103 + (lookup[0]->getNumBins()*5);
-               printLegend(y, maxbin);
-
+               printLegend(y, superMaxRelAbund);
+               
                y = 70;
-               for (int i = 0; i < lookup[0]->size(); i++) {
-                       for (int j = 0; j < lookup.size(); j++) {
+               for (int i = 0; i < scaleRelAbund[0].size(); i++) {
+                       for (int j = 0; j < scaleRelAbund.size(); j++) {
                                
-                               if (lookup[j]->getAbundance(i) != 0) { //don't want log value of 0.
-                                       if (scaler == "log10") {
-                                               color = colorScale[(log10((lookup[j]->getAbundance(i) / (float)lookup[j]->getNumSeqs()) * 1000))];  
-                                       }else if (scaler == "log2") {
-                                               color = colorScale[(log2((lookup[j]->getAbundance(i) / (float)lookup[j]->getNumSeqs()) * 1000))];  
-                                       }else if (scaler == "linear") {
-                                               color = colorScale[lookup[j]->getAbundance(i)]; 
-                                       }else {  color = colorScale[(log10((lookup[j]->getAbundance(i) / (float)lookup[j]->getNumSeqs()) * 1000))];     } 
-                               }else { color = "OO";  }
-
-                               
-                               outsvg << "<rect fill=\"#" + color + "0000\" stroke=\"#" + color + "0000\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"300\" height=\"5\"/>\n";
+                               outsvg << "<rect fill=\"#" + scaleRelAbund[j][i] + "\" stroke=\"#" + scaleRelAbund[j][i] + "\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"300\" height=\"5\"/>\n";
                                x += 300;
                        }
                        x = 0;
                        y += 5;
                }
                
-               
                outsvg << "</g>\n</svg>\n";
                outsvg.close();
                
@@ -217,7 +203,7 @@ void HeatMap::getPic(SharedOrderVector* sharedorder) {
 }
 
 //**********************************************************************************************************************
-void HeatMap::sortSharedVectors(){
+void HeatMap::sortSharedVectors(vector<SharedRAbundVector*>& lookup){
        try {
                //copy lookup and then clear it to refill with sorted.
                //loop though lookup and determine if they are shared
@@ -295,49 +281,44 @@ void HeatMap::sortSharedVectors(){
                cout << "An unknown error has occurred in the HeatMap class function sortSharedVectors. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
                exit(1);
        }
-
+       
 }
 
 //**********************************************************************************************************************
+
 void HeatMap::printLegend(int y, float maxbin) {
        try {
-       
+               
                //output legend and color labels
                //go through map and give each score a color value
                string color;
-               int x = 0;
-               if (maxbin != 0) {
-                       //convert maxbin to relative abundance again
-                       if (scaler == "log10") {
-                               maxbin = pow(10, maxbin) / 1000;
-                       }else if (scaler == "log2") {
-                               maxbin = pow(2, maxbin) / 1000;
-                       }else {  maxbin = pow(10, maxbin) / 1000;       } 
-               }else { maxbin = 0.00; }
-               
-               //5 is the number of boxes in the legend
-               float maxbinScaler = maxbin / 10;
-               float colorScaler = 255 / 10;
+               int x = 10;
                
                //prints legend
-               for (int i = 0; i < 10; i++) {
-                       color = toHex(int((float)(i+1) * colorScaler));
-                       outsvg << "<rect fill=\"#" + color + "0000\" stroke=\"#" + color + "0000\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"30\" height=\"10\"/>\n";
-                       x += 30;
+               for (int i = 1; i < 255; i++) {
+                       color = toHex(int((float)(i)));
+                       outsvg << "<rect fill=\"#" + color + "0000\" stroke=\"#" + color + "0000\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"1\" height=\"10\"/>\n";
+                       x += 1;
                }
                
                //prints legend labels
-               x -= 30;
-               for (int i = 10; i > 0; i = i-2) {
-                       string label = toString((i * maxbinScaler));
-                       //set precision of relative abundance to 3
-                       int pos = label.find_first_of('.');
-                       label = label.substr(0,pos+4);
+               x = 10;
+               for (int i = 1; i<=5; i++) {
+                       float label;
+                       if(scaler== "log10")            {       label = maxbin * log10(51*i) / log10(255);      }
+                       else if(scaler== "log2")        {       label = maxbin * log2(51*i) / log2(255);        }
+                       else if(scaler== "linear")      {       label = maxbin * 51 * i / 255;                          }
+                       else                                            {       label = maxbin * log10(51*i) / log10(255);      }
                        
-                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(x) + "\" y=\"" + toString(y-3) + "\">" + label + "</text>\n";
-                       x -= 60;
+                       label = int(label * 1000 + 0.5);
+                       label /= 1000.0;
+                       string text = toString(label, 3);
+                       
+                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(x) + "\" y=\"" + toString(y-3) + "\">" + text + "</text>\n";
+                       x += 60;
                }
        }
+       
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the HeatMap class Function printLegend. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
                exit(1);
@@ -346,7 +327,7 @@ void HeatMap::printLegend(int y, float maxbin) {
                cout << "An unknown error has occurred in the HeatMap class function printLegend. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
                exit(1);
        }
-
+       
 }
 
 
index 54035f0cb4aba4e595183d3f8b6ae9e0ce256bc9..528c96416211a223e710467dd6baeb4cdb063c8f 100644 (file)
--- a/heatmap.h
+++ b/heatmap.h
@@ -31,20 +31,16 @@ class HeatMap {
                void getPic(SharedOrderVector*);
 
        private:
-               void sortSharedVectors();
+               void sortSharedVectors(vector<SharedRAbundVector*>& );
                void printLegend(int, float);
-               
+
                GlobalData* globaldata;
                SharedUtil* util;
-               vector<SharedRAbundVector*> lookup;
-               RAbundVector rabund;
                string format, sorted, groupComb, scaler;
                ofstream outsvg;
-               map<float, string> colorScale;
-               map<float, string>::iterator it;
-
                        
 };
+
 /***********************************************************************/
 
 #endif
index 82aa12ce66821443c9cedce4628fad3e43d01674..bbda2b34f30265115b82d3522e858a6b3cd7d29d 100644 (file)
@@ -63,12 +63,11 @@ int HeatMapCommand::execute(){
                        //you are using just a list file and have only one group
                        read = new ReadPhilFile(globaldata->inputFileName);     
                        read->read(&*globaldata); 
-               
+                       
                        ordersingle = globaldata->gorder;
                        input = globaldata->ginput;
                }
                
-                               
                if (format != "list") { 
                
                        util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups, "heat");
index 1e382261383605de66ce0f6a2742841e282f651b..49a87674d17a743e533c1bd010f6a48518e19537 100644 (file)
@@ -57,7 +57,7 @@ int LibShuffCommand::execute(){
                savedDXYValues = form->evaluateAll();
                savedMinValues = form->getSavedMins();
                
-               pValueCounts.assign(numGroups, 0);
+               pValueCounts.resize(numGroups);
                for(int i=0;i<numGroups;i++){
                        pValueCounts[i].assign(numGroups, 0);
                }
index c73f153fc501e2a005a276012f9cc172434e477a..f30e196b7fbd7b690d73d3e68f11299c801c7a8f 100644 (file)
@@ -19,7 +19,7 @@ It is a child of the calculator class. */
 class SharedAce : public Calculator  {
        
 public:
-       SharedAce(int n=10) : abund(n),  Calculator("SharedAce", 3) {};
+       SharedAce(int n=10) : abund(n),  Calculator("sharedace", 3) {};
        EstOutput getValues(SAbundVector*) {return data;};
        EstOutput getValues(SharedRAbundVector*, SharedRAbundVector*);
 private:
index 51662015ab7c7bd5ea1209e24b34fc92a06d22f7..b49119b7c18590f141292c5c91432967422b6de2 100644 (file)
@@ -19,7 +19,7 @@ It is a child of the calculator class. */
 class SharedSobs : public Calculator {
 
 public:
-       SharedSobs() : Calculator("SharedSobs", 1) {};
+       SharedSobs() : Calculator("sharedsobs", 1) {};
        EstOutput getValues(SAbundVector* rank){ return data; };
        EstOutput getValues(SharedRAbundVector* shared1, SharedRAbundVector* shared2);
 };
index 97d938c484fe5029b7ce7c9d88f087feb76047d7..016fb6a81f44e447bf5ef1efd8f3efa5b52dc6dd 100644 (file)
@@ -18,7 +18,7 @@
 class SharedSobsCS : public Calculator {
 
 public:
-       SharedSobsCS() : Calculator("SharedSobs", 1) {};
+       SharedSobsCS() : Calculator("sharedsobs", 1) {};
        EstOutput getValues(SAbundVector* rank){ return data; };
        EstOutput getValues(SharedRAbundVector* shared1, SharedRAbundVector* shared2);
 };
diff --git a/sobs.h b/sobs.h
index c2136b5e493dc7b81d5b1d2dd4564e0bad9c6b7a..528289eb257cabfeeff67eb632c032538377c9a3 100644 (file)
--- a/sobs.h
+++ b/sobs.h
@@ -21,7 +21,7 @@ It is a child of the calculator class. */
 class Sobs : public Calculator {
 
 public:
-       Sobs() : Calculator("Sobs", 1) {};
+       Sobs() : Calculator("sobs", 1) {};
        EstOutput getValues(SAbundVector* rank){
                data.resize(1,0);
                data[0] = (double)rank->getNumBins();
diff --git a/tree.h b/tree.h
index 58f3a792e9fbb22547765d9d238ffcabc1a77a01..cbbad667cbe1c27842ef088f8538efc9b084bc66 100644 (file)
--- a/tree.h
+++ b/tree.h
@@ -49,7 +49,7 @@ private:
        map<string, int>::iterator it, it2;
        map<string, int> mergeGroups(int);  //returns a map with a groupname and the number of times that group was seen in the children
        
-       map<string,int> Tree::mergeGcounts(int);
+       map<string,int> mergeGcounts(int);
        void randomTopology();
        void randomBlengths();
        void randomLabels(vector<string>);
index 9b3d760f66f702512553ddd140a20b4671e2e6ef..bcc475171fe7b35ee8697a5adb7a29af8033f3c5 100644 (file)
--- a/venn.cpp
+++ b/venn.cpp
@@ -87,13 +87,13 @@ void Venn::getPic(SharedOrderVector* sharedorder, vector<Calculator*> vCalcs) {
                                openOutputFile(filenamesvg, outsvg);
                        
                                //in essence you want to run it like a single 
-                               if (vCalcs[i]->getName() == "SharedSobs") {
+                               if (vCalcs[i]->getName() == "sharedsobs") {
                                        delete vCalcs[i];
                                        vCalcs[i] = new Sobs();
-                               }else if (vCalcs[i]->getName() == "SharedChao") {
+                               }else if (vCalcs[i]->getName() == "sharedchao") {
                                        delete vCalcs[i];
                                        vCalcs[i] = new Chao1();
-                               }else if (vCalcs[i]->getName() == "SharedAce") {
+                               }else if (vCalcs[i]->getName() == "sharedace") {
                                        delete vCalcs[i];
                                        vCalcs[i] = new Ace(10);
                                }
@@ -126,8 +126,8 @@ void Venn::getPic(SharedOrderVector* sharedorder, vector<Calculator*> vCalcs) {
                        //one for each group
                        SAbundVector sA, sB;
                        SAbundVector* sabundA; SAbundVector* sabundB;
-                       sA = lookup[0]->getSAbundVector();  sabundA = &sA;
-                       sB = lookup[1]->getSAbundVector();  sabundB = &sB;
+                       sabundA = new SAbundVector(lookup[0]->getSAbundVector());//  sabundA = &sA;
+                       sabundB = new SAbundVector(lookup[1]->getSAbundVector());//  sabundB = &sB;
                        
                        //make a file for each calculator
                        for(int i=0;i<vCalcs.size();i++){
@@ -138,23 +138,23 @@ void Venn::getPic(SharedOrderVector* sharedorder, vector<Calculator*> vCalcs) {
                                vector<double> shared = vCalcs[i]->getValues(lookup[0], lookup[1]);
                                
                                //in essence you want to run it like a single 
-                               if (vCalcs[i]->getName() == "SharedSobs") {
+                               if (vCalcs[i]->getName() == "sharedsobs") {
                                        delete vCalcs[i];
                                        vCalcs[i] = new Sobs();
-                               }else if (vCalcs[i]->getName() == "SharedChao") {
+                               }else if (vCalcs[i]->getName() == "sharedchao") {
                                        delete vCalcs[i];
                                        vCalcs[i] = new Chao1();
-                               }else if (vCalcs[i]->getName() == "SharedAce") {
+                               }else if (vCalcs[i]->getName() == "sharedace") {
                                        delete vCalcs[i];
                                        vCalcs[i] = new Ace(10);
                                }
                                
                                //get estimates for numA
                                vector<double> numA = vCalcs[i]->getValues(sabundA);
-                               
+
                                //get estimates for numB
                                vector<double> numB = vCalcs[i]->getValues(sabundB);
-                               
+                               cout << numA[0] << '\t' << numB[0] << '\t' << shared[0] << endl;                                
                                                
                                //image window
                                outsvg << "<svg width=\"100%\" height=\"100%\" viewBox=\"0 0 700 700\" >\n";
@@ -187,7 +187,8 @@ void Venn::getPic(SharedOrderVector* sharedorder, vector<Calculator*> vCalcs) {
                                //close file
                                outsvg << "</g>\n</svg>\n";
                                outsvg.close();
-
+                               delete sabundA;
+                               delete sabundB;
                        }
                        
                /******************* 3 Groups **************************/
@@ -239,13 +240,13 @@ void Venn::getPic(SharedOrderVector* sharedorder, vector<Calculator*> vCalcs) {
                                
                                
                                //in essence you want to run it like a single 
-                               if (vCalcs[i]->getName() == "SharedSobs") {
+                               if (vCalcs[i]->getName() == "sharedsobs") {
                                        delete vCalcs[i];
                                        vCalcs[i] = new Sobs();
-                               }else if (vCalcs[i]->getName() == "SharedChao") {
+                               }else if (vCalcs[i]->getName() == "sharedchao") {
                                        delete vCalcs[i];
                                        vCalcs[i] = new Chao1();
-                               }else if (vCalcs[i]->getName() == "SharedAce") {
+                               }else if (vCalcs[i]->getName() == "sharedace") {
                                        delete vCalcs[i];
                                        vCalcs[i] = new Ace(10);
                                }
@@ -338,7 +339,7 @@ void Venn::getPic(SharedOrderVector* sharedorder, vector<Calculator*> vCalcs) {
                        
                        //A = red, B = green, C = blue, D = yellow
                        
-                       if ((vCalcs.size() > 1) || (vCalcs[0]->getName() != "SharedSobs")) { cout << "The only calculator able to be used with 4 groups is sharedsobs. I will run that for you. " << endl; }
+                       if ((vCalcs.size() > 1) || (vCalcs[0]->getName() != "sharedsobs")) { cout << "The only calculator able to be used with 4 groups is sharedsobs. I will run that for you. " << endl; }
                        
                        //for each bin
                        for (int i = 0; i < lookup[0]->size(); i++) {
@@ -363,7 +364,7 @@ void Venn::getPic(SharedOrderVector* sharedorder, vector<Calculator*> vCalcs) {
                                if ((lookup[0]->getAbundance(i) != 0) && (lookup[1]->getAbundance(i) != 0) && (lookup[2]->getAbundance(i) != 0) && (lookup[3]->getAbundance(i) != 0)) { sharedABCD++; }
                        }
                                
-                       string filenamesvg = getRootName(globaldata->inputFileName) + sharedorder->getLabel() + ".venn.SharedSobs.svg";
+                       string filenamesvg = getRootName(globaldata->inputFileName) + sharedorder->getLabel() + ".venn.sharedsobs.svg";
                        openOutputFile(filenamesvg, outsvg);
                
                        //image window
diff --git a/venn.h b/venn.h
index 398f20bb1872832aed6ab89240ce120a0405f623..ae73dc235bdb266d1d833131012bc293bbe795f5 100644 (file)
--- a/venn.h
+++ b/venn.h
@@ -12,7 +12,7 @@
 using namespace std;
 
 #include "ordervector.hpp"
-#include "Sabundvector.hpp"
+#include "sabundvector.hpp"
 #include "sharedrabundvector.h"
 #include "sharedordervector.h"
 #include "datavector.hpp"