]> git.donarmstrong.com Git - mothur.git/blobdiff - matrixoutputcommand.cpp
merged pat's trim seqs edits with sarah's major overhaul of global data; also added...
[mothur.git] / matrixoutputcommand.cpp
index 1e4de7597c8dec90d78d48a8cf33e69cea93a086..e848647997c1a522f6a583d2144646ac20f7ac51 100644 (file)
@@ -40,14 +40,14 @@ MatrixOutputCommand::MatrixOutputCommand(string option){
                        string Array[] =  {"line","label","calc","groups"};
                        vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
                        
-                       parser = new OptionParser();
-                       parser->parse(option, parameters);  delete parser;
+                       OptionParser parser(option);
+                       map<string,string> parameters  = parser.getParameters();
                        
-                       ValidParameters* validParameter = new ValidParameters();
+                       ValidParameters validParameter;
                
                        //check to make sure all parameters are valid for command
-                       for (it = parameters.begin(); it != parameters.end(); it++) { 
-                               if (validParameter->isValidParameter(it->first, myArray, it->second) != true) {  abort = true;  }
+                       for (map<string,string>::iterator it = parameters.begin(); it != parameters.end(); it++) { 
+                               if (validParameter.isValidParameter(it->first, myArray, it->second) != true) {  abort = true;  }
                        }
                        
                        //make sure the user has already run the read.otu command
@@ -58,14 +58,14 @@ MatrixOutputCommand::MatrixOutputCommand(string option){
                        
                        //check for optional parameter and set defaults
                        // ...at some point should added some additional type checking...
-                       line = validParameter->validFile(parameters, "line", false);                            
+                       line = validParameter.validFile(parameters, "line", false);                             
                        if (line == "not found") { line = "";  }
                        else { 
                                if(line != "all") {  splitAtDash(line, lines);  allLines = 0;  }
                                else { allLines = 1;  }
                        }
                        
-                       label = validParameter->validFile(parameters, "label", false);                  
+                       label = validParameter.validFile(parameters, "label", false);                   
                        if (label == "not found") { label = ""; }
                        else { 
                                if(label != "all") {  splitAtDash(label, labels);  allLines = 0;  }
@@ -81,23 +81,20 @@ MatrixOutputCommand::MatrixOutputCommand(string option){
                                lines = globaldata->lines;
                        }
                                
-                       groups = validParameter->validFile(parameters, "groups", false);                        
+                       groups = validParameter.validFile(parameters, "groups", false);                 
                        if (groups == "not found") { groups = ""; }
                        else { 
                                splitAtDash(groups, Groups);
                                globaldata->Groups = Groups;
                        }
                                
-                       calc = validParameter->validFile(parameters, "calc", false);                    
+                       calc = validParameter.validFile(parameters, "calc", false);                     
                        if (calc == "not found") { calc = "jclass-thetayc";  }
                        else { 
                                 if (calc == "default")  {  calc = "jclass-thetayc";  }
                        }
                        splitAtDash(calc, Estimators);
 
-                       delete validParameter;
-                       
-                       
                        if (abort == false) {
                        
                                validCalculator = new ValidCalculators();