+ //allow user to run help
+ if(option == "help") { help(); abort = true; }
+
+ else {
+ //valid paramters for this command
+ string Array[] = {"fasta", "phylip", "calc", "countends", "cutoff", "processors"};
+ 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 (it2 = parameters.begin(); it2 != parameters.end(); it2++) {
+ if (validParameter->isValidParameter(it2->first, myArray, it2->second) != true) { abort = true; }
+ }
+
+ //check for required parameters
+ fastafile = validParameter->validFile(parameters, "fasta", true);
+ if (fastafile == "not found") { cout << "fasta is a required parameter for the dist.seqs command." << endl; abort = true; }
+ else if (fastafile == "not open") { abort = true; }
+ else {
+ globaldata->setFastaFile(fastafile);
+ openInputFile(fastafile, in);
+ }
+
+ //check for optional parameter and set defaults
+ // ...at some point should added some additional type checking...
+ calc = validParameter->validFile(parameters, "calc", false);
+ if (calc == "not found") { calc = "onegap"; }
+ else {
+ if (calc == "default") { calc = "onegap"; }
+ }
+ splitAtDash(calc, Estimators);
+
+ string temp;
+ temp = validParameter->validFile(parameters, "countends", false); if (temp == "not found") { temp = "T"; }
+ convert(temp, countends);
+
+ temp = validParameter->validFile(parameters, "cutoff", false); if (temp == "not found") { temp = "1.0"; }
+ convert(temp, cutoff);
+
+ temp = validParameter->validFile(parameters, "processors", false); if (temp == "not found") { temp = "1"; }
+ convert(temp, processors);
+
+ phylip = validParameter->validFile(parameters, "phylip", false); if (phylip == "not found") { phylip = "F"; }
+
+ delete validParameter;
+
+ validCalculator = new ValidCalculators();
+
+ int i;
+ if (isTrue(countends) == true) {
+ for (i=0; i<Estimators.size(); i++) {
+ if (validCalculator->isValidCalculator("distance", Estimators[i]) == true) {
+ if (Estimators[i] == "nogaps") {
+ distCalculator = new ignoreGaps();
+ }else if (Estimators[i] == "eachgap") {
+ distCalculator = new eachGapDist();
+ }else if (Estimators[i] == "onegap") {