]> git.donarmstrong.com Git - mothur.git/blobdiff - heatmap.cpp
changed raredisplay to use vectors instead of files
[mothur.git] / heatmap.cpp
index 3aceef1613205f41925e810ac35c979f225168db..6fd68614ce5e9ed4a28bcdc7c679e2f6d3d5f939 100644 (file)
 #include "heatmap.h"
 
 //**********************************************************************************************************************
-HeatMap::HeatMap(){
+HeatMap::HeatMap(string sort, string scale){
        try {
                globaldata = GlobalData::getInstance();
-               format = globaldata->getFormat();
-               sorted = globaldata->getSorted();
+//             format = globaldata->getFormat();
+               sorted = sort;
+               scaler = scale;
        }
        catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the HeatMap class Function HeatMap. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the HeatMap class function HeatMap. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               errorOut(e, "HeatMap", "HeatMap");
                exit(1);
        }
 }
@@ -30,8 +27,7 @@ HeatMap::HeatMap(){
 
 void HeatMap::getPic(RAbundVector* rabund) {
        try {
-               //get users scaling method
-               scaler = globaldata->getScale();
+               
                
                float maxRelAbund = 0.0;                
                
@@ -40,7 +36,6 @@ void HeatMap::getPic(RAbundVector* rabund) {
                        if(relAbund > maxRelAbund){     maxRelAbund = relAbund; }
                }
                
-               scaler = globaldata->getScale();
                
                vector<string> scaleRelAbund(rabund->size(), "");
                
@@ -62,7 +57,7 @@ void HeatMap::getPic(RAbundVector* rabund) {
                }
                
                
-               string filenamesvg = getRootName(globaldata->inputFileName) + rabund->getLabel() + ".heatmap.svg";
+               string filenamesvg = getRootName(globaldata->inputFileName) + rabund->getLabel() + ".heatmap.bin.svg";
                openOutputFile(filenamesvg, outsvg);
                
                //svg image
@@ -92,11 +87,7 @@ void HeatMap::getPic(RAbundVector* rabund) {
                
        }
        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";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the HeatMap class function getPic. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               errorOut(e, "HeatMap", "getPic");
                exit(1);
        }
 }
@@ -121,8 +112,6 @@ void HeatMap::getPic(vector<SharedRAbundVector*> lookup) {
                        if(maxRelAbund[i] > superMaxRelAbund){  superMaxRelAbund = maxRelAbund[i];      }
                }
                
-               scaler = globaldata->getScale();
-               
                scaleRelAbund.resize(lookup.size());
                for(int i=0;i<lookup.size();i++){
                        scaleRelAbund[i].assign(lookup[i]->size(), "");
@@ -144,7 +133,7 @@ void HeatMap::getPic(vector<SharedRAbundVector*> lookup) {
                        }
                }
 
-               string filenamesvg = getRootName(globaldata->inputFileName) + lookup[0]->getLabel() + ".heatmap.svg";
+               string filenamesvg = getRootName(globaldata->inputFileName) + lookup[0]->getLabel() + ".heatmap.bin.svg";
                openOutputFile(filenamesvg, outsvg);
                
                //svg image
@@ -182,11 +171,7 @@ void HeatMap::getPic(vector<SharedRAbundVector*> lookup) {
 
        }
        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";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the HeatMap class function getPic. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               errorOut(e, "HeatMap", "getPic");
                exit(1);
        }
 }
@@ -266,14 +251,9 @@ void HeatMap::sortSharedVectors(vector<SharedRAbundVector*>& lookup){
                
        }
        catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the HeatMap class Function sortSharedVectors. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the HeatMap class function sortSharedVectors. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               errorOut(e, "HeatMap", "sortSharedVectors");
                exit(1);
        }
-       
 }
 
 //**********************************************************************************************************************
@@ -311,14 +291,9 @@ void HeatMap::printLegend(int y, float maxbin) {
        }
        
        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";
+               errorOut(e, "HeatMap", "printLegend");
                exit(1);
        }
-       catch(...) {
-               cout << "An unknown error has occurred in the HeatMap class function printLegend. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       
 }