]> git.donarmstrong.com Git - mothur.git/blobdiff - globaldata.cpp
working on libshuff
[mothur.git] / globaldata.cpp
index 3ddd02e5c24dc03cd8ff7549b6b03a32982562e9..a0ccdcb690eda34efb4fe9964b375b47b0e71d2f 100644 (file)
@@ -20,7 +20,6 @@ GlobalData* GlobalData::getInstance() {
 //This function parses through the option string of the command to remove its parameters
 void GlobalData::parseGlobalData(string commandString, string optionText){
        try {
-               allLines = 1;
                commandName = commandString; //save command name to be used by other classes
                
                //set all non filename paramters to default
@@ -32,6 +31,7 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                        gGroupmap = NULL;
                        gTree.clear();
                        labels.clear(); lines.clear(); groups.clear();
+                       allLines = 1;
                }
                
                //saves help request
@@ -39,6 +39,11 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                        helpRequest = optionText;
                }
                
+               if (commandName == "libshuff") {
+                       iters = "10000";
+                       cutoff = "1.0";
+               }
+               
                string key, value;              
                //reads in parameters and values
                if((optionText != "") && (commandName != "help")){
@@ -66,7 +71,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 == "line") {//stores lines to be used in a set
@@ -116,22 +124,24 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                        if (key == "abund" )        { abund = value;        }
                        if (key == "random" )           { randomtree = value;   }
                        if (key == "calc")                      { calc = value;         }
-
+                       if (key == "step")                      { step = value;                 }
+                       if (key == "form")                      { form = value;                 }
 
                        if (key == "line") {//stores lines to be used in a vector
                                lines.clear();
                                line = value;
                                label = "";
-                               splitAtDash(value, lines);
-                               allLines = 0;
+                               if (line != "all") {  splitAtDash(value, lines);  allLines = 0;  }
+                               else { allLines = 1;  }
                        }
                        if (key == "label") {//stores lines to be used in a vector
                                labels.clear();
                                label = value;
                                line = "";
-                               splitAtDash(value, labels);
-                               allLines = 0;
+                               if (label != "all") {  splitAtDash(value, labels);  allLines = 0;  }
+                               else { allLines = 1;  }
                        }
+                       
                        if (key == "groups") {//stores groups to be used in a vector
                                        Groups.clear();
                                        groups = value;
@@ -217,6 +227,8 @@ string GlobalData::getFreq()                        {       return freq;            }
 string GlobalData::getAbund()           {   return abund;       }
 string GlobalData::getRandomTree()             {       return randomtree;      }
 string GlobalData::getGroups()                 {       return groups;          }
+string GlobalData::getStep()                   {       return step;            }
+string GlobalData::getForm()                   {       return form;            }
 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;}
@@ -265,6 +277,8 @@ void GlobalData::clear() {
        method                  =       "furthest";
        fileroot                =       "";
        abund           =   "10";
+       step                    =       "0.01";
+       form                    =       "integral";
 }
 
 //*******************************************************/
@@ -274,15 +288,15 @@ void GlobalData::reset() {
        cutoff                  =       "10.00";
        precision               =       "100";
        iters                   =       "1000"; 
-       line                    =   "";
-       label                   =       "";
        groups                  =       "";
        jumble                  =       "1";    //0 means don't jumble, 1 means jumble.
        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";
        calc                    =       "";
-       abund = "10";
+       abund                   =   "10";
+       step                    =       "0.01";
+       form                    =       "integral";
 }
 /*******************************************************/