+ abort = false;
+ allLines = 1;
+ lines.clear();
+ labels.clear();
+ Estimators.clear();
+
+ //allow user to run help
+ if(option == "help") { validCalculator = new ValidCalculators(); help(); abort = true; }
+
+ else {
+ //valid paramters for this command
+ string Array[] = {"iters","line","label","calc","groups"};
+ 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 (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
+ if (globaldata->getSharedFile() == "") {
+ if (globaldata->getListFile() == "") { cout << "You must read a list and a group, or a shared before you can use the collect.shared command." << endl; abort = true; }
+ else if (globaldata->getGroupFile() == "") { cout << "You must read a list and a group, or a shared before you can use the collect.shared command." << endl; abort = true; }
+ }
+
+
+ //check for optional parameter and set defaults
+ // ...at some point should added some additional type checking...
+ 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);
+ if (label == "not found") { label = ""; }
+ else {
+ if(label != "all") { splitAtDash(label, labels); allLines = 0; }
+ else { allLines = 1; }
+ }
+
+ //make sure user did not use both the line and label parameters
+ if ((line != "") && (label != "")) { cout << "You cannot use both the line and label parameters at the same time. " << endl; abort = true; }
+ //if the user has not specified any line or labels use the ones from read.otu
+ else if((line == "") && (label == "")) {
+ allLines = globaldata->allLines;
+ labels = globaldata->labels;
+ lines = globaldata->lines;
+ }