+ //check to make sure all parameters are valid for command
+ for (map<string,string>::iterator it = parameters.begin(); it != parameters.end(); it++) {
+ if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; }
+ }
+
+ randomtree = validParameter.validFile(parameters, "random", false); if (randomtree == "not found") { randomtree = ""; }
+
+ //are you trying to use parsimony without reading a tree or saying you want random distribution
+ if (randomtree == "") {
+ if (globaldata->gTree.size() == 0) {
+ mothurOut("You must read a treefile and a groupfile or set the randomtree parameter to the output filename you wish, before you may execute the parsimony command."); mothurOutEndLine(); abort = true; }
+ }
+
+ //check for optional parameter and set defaults
+ // ...at some point should added some additional type checking...
+ groups = validParameter.validFile(parameters, "groups", false);
+ if (groups == "not found") { groups = ""; }
+ else {
+ splitAtDash(groups, Groups);
+ globaldata->Groups = Groups;
+ }
+
+ itersString = validParameter.validFile(parameters, "iters", false); if (itersString == "not found") { itersString = "1000"; }
+ convert(itersString, iters);
+
+ if (abort == false) {
+ //randomtree will tell us if user had their own treefile or if they just want the random distribution
+ //user has entered their own tree
+ if (randomtree == "") {
+ T = globaldata->gTree;
+ tmap = globaldata->gTreemap;
+ output = new ColumnFile(globaldata->getTreeFile() + ".parsimony", itersString);
+ sumFile = globaldata->getTreeFile() + ".psummary";
+ openOutputFile(sumFile, outSum);
+ }else { //user wants random distribution
+ savetmap = globaldata->gTreemap;
+ getUserInput();
+ output = new ColumnFile(randomtree, itersString);
+ }
+
+ //set users groups to analyze
+ util = new SharedUtil();
+ util->setGroups(globaldata->Groups, tmap->namesOfGroups, allGroups, numGroups, "unweighted"); //sets the groups the user wants to analyze
+ util->getCombos(groupComb, globaldata->Groups, numComp);
+
+ if (numGroups == 1) { numComp++; groupComb.push_back(allGroups); }
+
+ pars = new Parsimony(tmap);
+ counter = 0;
+
+ }
+