- globaldata = GlobalData::getInstance();
- candidateFileName = globaldata->inputFileName;
- templateFileName = globaldata->getTemplateFile();
- openInputFile(candidateFileName, in);
- convert(globaldata->getKSize(), kmerSize);
- convert(globaldata->getMatch(), match);
- convert(globaldata->getMismatch(), misMatch);
- convert(globaldata->getGapopen(), gapOpen);
- convert(globaldata->getGapextend(), gapExtend);
- distanceFileName = "????";
+ // globaldata = GlobalData::getInstance();
+ abort = false;
+
+ //allow user to run help
+ if(option == "help") { help(); abort = true; }
+
+ else {
+
+ //valid paramters for this command
+ string AlignArray[] = {"template","candidate","search","ksize","align","match","mismatch","gapopen","gapextend", "processors"};
+ 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; }
+ }
+
+ //check for required parameters
+ templateFileName = validParameter.validFile(parameters, "template", true);
+ if (templateFileName == "not found") { cout << "template is a required parameter for the align.seqs command." << endl; abort = true; }
+ else if (templateFileName == "not open") { abort = true; }
+
+ candidateFileName = validParameter.validFile(parameters, "candidate", true);
+ if (candidateFileName == "not found") { cout << "candidate is a required parameter for the align.seqs command." << endl; abort = true; }
+ else if (candidateFileName == "not open") { abort = true; }
+
+ //check for optional parameter and set defaults
+ // ...at some point should added some additional type checking...
+ string temp;
+ temp = validParameter.validFile(parameters, "ksize", false); if (temp == "not found"){ temp = "8"; }
+ convert(temp, kmerSize);
+
+ temp = validParameter.validFile(parameters, "match", false); if (temp == "not found"){ temp = "1.0"; }
+ convert(temp, match);
+
+ temp = validParameter.validFile(parameters, "mismatch", false); if (temp == "not found"){ temp = "-1.0"; }
+ convert(temp, misMatch);
+
+ temp = validParameter.validFile(parameters, "gapopen", false); if (temp == "not found"){ temp = "-2.0"; }
+ convert(temp, gapOpen);
+
+ temp = validParameter.validFile(parameters, "gapextend", false); if (temp == "not found"){ temp = "-1.0"; }
+ convert(temp, gapExtend);
+
+ temp = validParameter.validFile(parameters, "processors", false); if (temp == "not found"){ temp = "1"; }
+ convert(temp, processors);
+
+ search = validParameter.validFile(parameters, "search", false); if (search == "not found"){ search = "kmer"; }
+
+ align = validParameter.validFile(parameters, "align", false); if (align == "not found"){ align = "needleman"; }
+ }
+