- if (format == "list") {
- for (i=0; i<globaldata->Estimators.size(); i++) {
- if (validCalculator->isValidCalculator("vennsingle", globaldata->Estimators[i]) == true) {
- if (globaldata->Estimators[i] == "sobs") {
- vennCalculators.push_back(new Sobs());
- }else if (globaldata->Estimators[i] == "chao") {
- vennCalculators.push_back(new Chao1());
- }else if (globaldata->Estimators[i] == "ace") {
- convert(globaldata->getAbund(), abund);
- if(abund < 5)
- abund = 10;
- vennCalculators.push_back(new Ace(abund));
- //}else if (globaldata->Estimators[i] == "jack") {
- //vennCalculators.push_back(new Jackknife());
- }
+ else {
+ //valid paramters for this command
+ string AlignArray[] = {"groups","line","label","calc", "abund"};
+ vector<string> myArray (AlignArray, AlignArray+(sizeof(AlignArray)/sizeof(string)));
+
+ OptionParser parser(option);
+ map<string,string> parameters = parser.getParameters();
+
+ ValidParameters validParameter;
+
+ //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; }
+ }
+
+ //make sure the user has already run the read.otu command
+ if ((globaldata->getListFile() == "") && (globaldata->getSharedFile() == "")) {
+ cout << "You must read a list, or a list and a group, or a shared before you can use the venn 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;
+ }
+
+ groups = validParameter.validFile(parameters, "groups", false);
+ if (groups == "not found") { groups = ""; }
+ else {
+ splitAtDash(groups, Groups);
+ globaldata->Groups = Groups;
+ }
+
+ format = globaldata->getFormat();
+ calc = validParameter.validFile(parameters, "calc", false);
+ if (calc == "not found") {
+ if(format == "list") { calc = "sobs"; }
+ else { calc = "sharedsobs"; }
+ }
+ else {
+ if (calc == "default") {
+ if(format == "list") { calc = "sobs"; }
+ else { calc = "sharedsobs"; }