]> git.donarmstrong.com Git - mothur.git/blobdiff - globaldata.cpp
deconvolute command
[mothur.git] / globaldata.cpp
index c28321d5a74879492975f2c0e4ed0e019f67b8e6..6d67d0da0fd41c2978a073a5f377746331b0d9a6 100644 (file)
@@ -79,8 +79,10 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                allLines = 1;
                commandName = commandString; //save command name to be used by other classes
                
-               //clears out data from previous read and sets format
-               setReadFormat(commandName);
+               //clears out data from previous read
+               if ((commandName == "read.dist") || (commandName == "read.otu") || (commandName == "read.list")) { 
+                       clear();
+               }
                
                //saves help request
                if (commandName =="help") {
@@ -94,10 +96,12 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                                splitAtComma(value, optionText);
                                splitAtEquals(key, value);
                                
-                               if (key == "distfile" )         { distfile = value; inputFileName = value; fileroot = value;}
-                               if (key == "listfile" )         { listfile = value; inputFileName = value; fileroot = value;}
-                               if (key == "rabundfile" )       { rabundfile = value; inputFileName = value; fileroot = value;}
-                               if (key == "sabundfile" )       { sabundfile = value; inputFileName = value; fileroot = value;}
+                               if (key == "phylipfile" )       { phylipfile = value; inputFileName = value; fileroot = value; format = "phylip";}
+                               if (key == "columnfile" )       { columnfile = value; inputFileName = value; fileroot = value; format = "column";}
+                               if (key == "listfile" )         { listfile = value; inputFileName = value; fileroot = value; format = "list"; }
+                               if (key == "rabundfile" )       { rabundfile = value; inputFileName = value; fileroot = value; format = "rabund"; }
+                               if (key == "sabundfile" )       { sabundfile = value; inputFileName = value; fileroot = value; format = "sabund"; } 
+                               if (key == "fastafile" )        { fastafile = value; inputFileName = value; fileroot = value; format = "fasta"; } 
                                if (key == "namefile" )         { namefile = value; }
                                if (key == "orderfile" )        { orderfile = value; }
                                if (key == "groupfile" )        { groupfile = value; }
@@ -156,10 +160,12 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                        //saves the last parameter
                        value = optionText;
                        splitAtEquals(key, value);
-                       if (key == "distfile" )         { distfile = value; inputFileName = value; fileroot = value; }
-                       if (key == "listfile" )         { listfile = value; inputFileName = value; fileroot = value; }
-                       if (key == "rabundfile" )       { rabundfile = value; inputFileName = value; fileroot = value; }
-                       if (key == "sabundfile" )       { sabundfile = value; inputFileName = value; fileroot = value; }
+                       if (key == "phylipfile" )       { phylipfile = value; inputFileName = value; fileroot = value; format = "phylip"; }
+                       if (key == "columnfile" )       { columnfile = value; inputFileName = value; fileroot = value; format = "column"; }
+                       if (key == "listfile" )         { listfile = value; inputFileName = value; fileroot = value; format = "list"; }
+                       if (key == "rabundfile" )       { rabundfile = value; inputFileName = value; fileroot = value; format = "rabund"; }
+                       if (key == "sabundfile" )       { sabundfile = value; inputFileName = value; fileroot = value; format = "sabund"; }
+                       if (key == "fastafile" )        { fastafile = value; inputFileName = value; fileroot = value; format = "fasta"; } 
                        if (key == "namefile" )         { namefile = value; }
                        if (key == "orderfile" )        { orderfile = value; }
                        if (key == "groupfile" )        { groupfile = value; }
@@ -251,50 +257,17 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
 }
 /*******************************************************/
 
-/******************************************************/
-void GlobalData::setReadFormat(string command){
-       try {
-               if (command == "read.phylip") { 
-                       clear();
-                       format = "phylip";
-               }else if (command == "read.column") { 
-                       clear();
-                       format = "column";
-               }else if (command == "read.list") { 
-                       clear();
-                       format = "list";
-               }else if (command == "read.rabund") { 
-                       clear();
-                       format = "rabund";
-               }else if (command == "read.sabund") { 
-                       clear();
-                       format = "sabund";
-               }else if (command == "read.shared") { 
-                       clear();
-                       format = "shared";
-               }else if (command == "parselist") { format = "list"; }
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the GlobalData class Function setReadFormat. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the GlobalData class function setReadFormat. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-}
-
-/*******************************************************/
-
 /******************************************************/
 // These functions give you the option parameters of the commands
-string GlobalData::getDistFile()               {       return distfile;        }
+string GlobalData::getPhylipFile()             {       return phylipfile;      }
+string GlobalData::getColumnFile()             {       return columnfile;      }
 string GlobalData::getListFile()               {       return listfile;        }
 string GlobalData::getRabundFile()             {       return rabundfile;      }
 string GlobalData::getSabundFile()             {       return sabundfile;      }
 string GlobalData::getNameFile()               {       return namefile;        }
 string GlobalData::getGroupFile()              {       return groupfile;       }
 string GlobalData::getOrderFile()              {       return orderfile;       }
+string GlobalData::getFastaFile()              {       return fastafile;       }
 string GlobalData::getCutOff()                 {       return cutoff;          }
 string GlobalData::getFormat()                 {       return format;          }
 string GlobalData::getPrecision()              {       return precision;       }
@@ -306,7 +279,9 @@ string GlobalData::getFreq()                        {       return freq;            }
 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;}
-void GlobalData::setDistFile(string file)      {       distfile = file;    inputFileName = file;}
+void GlobalData::setPhylipFile(string file)    {       phylipfile = file;    inputFileName = file;}
+void GlobalData::setColumnFile(string file)    {       columnfile = file;    inputFileName = file;}
+//void GlobalData::setGroupFile(string file)   {       groupfile = file;       }
 void GlobalData::setNameFile(string file)      {       namefile = file;        }
 void GlobalData::setFormat(string Format)      {       format = Format;        }
 
@@ -326,13 +301,15 @@ GlobalData::GlobalData() {
 
 void GlobalData::clear() {
        //option definitions should go here...
-       distfile                =       "";
-       listfile                =       "";///users/westcott/desktop/s.list
+       phylipfile              =       "";
+       columnfile              =       "";
+       listfile                =       "";
        rabundfile              =       "";
        sabundfile              =       "";
        namefile                =       "";
-       groupfile               =       ""; ///users/westcott/desktop/s.names
+       groupfile               =       ""; 
        orderfile               =       "";
+       fastafile               =   "";
        cutoff                  =       "10.00";
        format                  =       "";
        precision               =       "100";