- T = globaldata->gTree;
- tmap = globaldata->gTreemap;
- weightedFile = globaldata->getTreeFile() + ".weighted";
- openOutputFile(weightedFile, out);
- //column headers
- out << "Group" << '\t' << "Score" << '\t' << "UserFreq" << '\t' << "UserCumul" << '\t' << "RandFreq" << '\t' << "RandCumul" << endl;
-
- sumFile = globaldata->getTreeFile() + ".wsummary";
- openOutputFile(sumFile, outSum);
+ //allow user to run help
+ if(option == "help") { help(); abort = true; }
+
+ else {
+ //valid paramters for this command
+ string Array[] = {"groups","iters"};
+ vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+
+ parser = new OptionParser();
+ parser->parse(option, parameters); delete parser;
+
+ ValidParameters* validParameter = new ValidParameters();
+
+ //check to make sure all parameters are valid for command
+ for (it4 = parameters.begin(); it4 != parameters.end(); it4++) {
+ if (validParameter->isValidParameter(it4->first, myArray, it4->second) != true) { abort = true; }
+ }
+
+ if (globaldata->gTree.size() == 0) {//no trees were read
+ cout << "You must execute the read.tree command, before you may execute the unifrac.weighted command." << endl; 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;
+ }