]> git.donarmstrong.com Git - mothur.git/commitdiff
made sorting optional but sort by default, in case the user wants to see the heatmap...
authorwestcott <westcott>
Mon, 30 Mar 2009 13:58:26 +0000 (13:58 +0000)
committerwestcott <westcott>
Mon, 30 Mar 2009 13:58:26 +0000 (13:58 +0000)
errorchecking.cpp
errorchecking.h
globaldata.cpp
globaldata.hpp
heatmap.cpp
heatmap.h
validparameter.cpp

index 59095f76e3bf46c652361e7b270f1c9ca8ebc7a1..a057e5d1b396d69af85142d3695d326176b8fd0c 100644 (file)
@@ -110,6 +110,7 @@ bool ErrorCheck::checkInput(string input) {
                                if (parameter == "label" )                      { label = value; }
                                if (parameter == "abund" )          { abund = value; }
                                if (parameter == "random" )                     { randomtree = value;   }
+                               if (parameter == "sorted" )                     { sorted = value;       }
                        }
                        
                        //gets the last parameter and value
@@ -142,6 +143,7 @@ bool ErrorCheck::checkInput(string input) {
                                if (parameter == "label" )                      { label = value; }
                                if (parameter == "random" )                     { randomtree = value;   }
                                if (parameter == "abund" )          { abund = value; }
+                               if (parameter == "sorted" )                     { sorted = value;       }
                        }
                }
                
index 4c9fe8615c0819f0ec6dfad5b743d737ee365e4e..42188c06f18f2eaeec08fbc4fc3f855e95d87cb2 100644 (file)
@@ -33,7 +33,7 @@ class ErrorCheck {
                void clear();
                void refresh();
                string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, fastafile, treefile, sharedfile, cutoff, format; 
-               string precision, method, fileroot, label, line, iters, jumble, freq, single, rarefaction, shared, summary, randomtree, abund;
+               string precision, method, fileroot, label, line, iters, jumble, freq, single, rarefaction, shared, summary, randomtree, abund, sorted;
                string commandName, optionText;
                bool errorFree;
 
index 2848860d41c35db65029a26409b8b9d3f5201685..64a7c93ac0a7c5067cf102250d3efd9cf8ab7380 100644 (file)
@@ -74,6 +74,7 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                                if (key == "calc")                      { calc = value;                 }
                                if (key == "step")                      { step = value;                 }
                                if (key == "form")                      { form = value;                 }
+                               if (key == "sorted")            { sorted = value;               }
                                
 
                                
@@ -125,9 +126,10 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                        if (key == "fileroot" )         { fileroot = value;             }
                        if (key == "abund" )        { abund = value;        }
                        if (key == "random" )           { randomtree = value;   }
-                       if (key == "calc")                      { calc = value;         }
+                       if (key == "calc")                      { calc = value;                 }
                        if (key == "step")                      { step = value;                 }
                        if (key == "form")                      { form = value;                 }
+                       if (key == "sorted")            { sorted = value;               }
 
                        if (key == "line") {//stores lines to be used in a vector
                                lines.clear();
@@ -233,6 +235,7 @@ string GlobalData::getRandomTree()          {       return randomtree;      }
 string GlobalData::getGroups()                 {       return groups;          }
 string GlobalData::getStep()                   {       return step;            }
 string GlobalData::getForm()                   {       return form;            }
+string GlobalData::getSorted()                 {       return sorted;          }
 void GlobalData::setListFile(string file)      {       listfile = file;        inputFileName = file;}
 void GlobalData::setRabundFile(string file)    {       rabundfile = file;      inputFileName = file;}
 void GlobalData::setSabundFile(string file)    {       sabundfile = file;      inputFileName = file;}
@@ -283,6 +286,7 @@ void GlobalData::clear() {
        abund           =   "10";
        step                    =       "0.01";
        form                    =       "integral";
+       sorted                  =       "1";  //0 means don't sort, 1 means sort.
 }
 
 //*******************************************************/
@@ -294,6 +298,7 @@ void GlobalData::reset() {
        iters                   =       "1000"; 
        groups                  =       "";
        jumble                  =       "1";    //0 means don't jumble, 1 means jumble.
+       sorted                  =       "1";  //0 means don't sort, 1 means sort.
        randomtree              =       "";  //"" means user will enter some user trees, "outputfile" means they just want the random tree distribution to be outputted to outputfile.
        freq                    =       "100";
        method                  =       "furthest";
index 16bc8d32b6bc75c2b4cbabfdb4ef6dfb78890d4c..f74619e29c792d28486447c919281f88b5d03ba0 100644 (file)
@@ -62,6 +62,7 @@ public:
        string getGroups();
        string getStep();
        string getForm();
+       string getSorted();
 
        void setListFile(string);
        void setPhylipFile(string);
@@ -82,7 +83,7 @@ public:
                
 private:
        string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, fastafile, treefile, sharedfile, line, label, randomtree, groups;
-       string cutoff, format, precision, method, fileroot, iters, jumble, freq, calc, abund, step, form;
+       string cutoff, format, precision, method, fileroot, iters, jumble, freq, calc, abund, step, form, sorted;
 
        static GlobalData* _uniqueInstance;
        GlobalData( const GlobalData& ); // Disable copy constructor
index 86786e7e309dd718a4c4476d8745c9a0a0cd6f20..4ce6f2c2e6cc01a376cb4c56d9a222d33e55de50 100644 (file)
@@ -14,6 +14,7 @@ HeatMap::HeatMap(){
        try {
                globaldata = GlobalData::getInstance();
                format = globaldata->getFormat();
+               sorted = globaldata->getSorted();
                
        }
        catch(exception& e) {
@@ -88,7 +89,7 @@ void HeatMap::getPic(SharedOrderVector* sharedorder) {
                getSharedVectors(sharedorder);
                
                //sort lookup so shared bins are on top
-               sortSharedVectors();
+               if (sorted == "1") {  sortSharedVectors();  }
                
                //get maxBin
                for (int i = 0; i < lookup.size(); i++) {
index c26684e3cd832b3c57d0671cb0bb11e8983e247c..e236ce389795e00e20fce97cd645377e83657c1b 100644 (file)
--- a/heatmap.h
+++ b/heatmap.h
@@ -36,11 +36,10 @@ class HeatMap {
                GlobalData* globaldata;
                vector<SharedRAbundVector*> lookup;
                RAbundVector rabund;
-               string format;
+               string format, sorted, groupComb;
                ofstream outsvg;
                map<int, string> colorScale;
                map<int, string>::iterator it;
-               string groupComb;
 
                        
 };
index 6af6c15e313975ade4d17d6bd91141defbf205fc..51fefd837203aea8c3774d1581e9e579cf66fd55 100644 (file)
@@ -277,7 +277,7 @@ void ValidParameters::initCommandParameters() {
                string unifracUnweightedArray[] =  {"group","iters"};
                commandParameters["unifrac.unweighted"] = addParameters(unifracUnweightedArray, sizeof(unifracUnweightedArray)/sizeof(string));
 
-               string heatmapArray[] =  {"group","line","label"};
+               string heatmapArray[] =  {"group","line","label","sorted"};
                commandParameters["heatmap"] = addParameters(heatmapArray, sizeof(heatmapArray)/sizeof(string));
 
                string quitArray[] = {};