+/******************************************************/
+//This function checks to make sure the user entered appropriate
+// format parameters on a distfile read
+void ErrorCheck::validateSeqsFiles() {
+ try {
+ ifstream filehandle;
+ int ableToOpen;
+
+ //checks to make sure only one file type is given
+ if (phylipfile != "") {
+ if ((nexusfile != "") || (fastafile != "") || (clustalfile != "")) {
+ cout << "You may enter ONLY ONE of the following: phylip, fasta, nexus or clustal." << endl; errorFree = false; }
+ else {
+ ableToOpen = openInputFile(phylipfile, filehandle);
+ filehandle.close();
+ if (ableToOpen == 1) { //unable to open
+ errorFree = false;
+ }
+ }
+ }else if (nexusfile != "") {
+ if ((phylipfile != "") || (fastafile != "") || (clustalfile != "")) {
+ cout << "You may enter ONLY ONE of the following: phylip, fasta, nexus or clustal." << endl; errorFree = false; }
+ else {
+ ableToOpen = openInputFile(nexusfile, filehandle);
+ filehandle.close();
+ if (ableToOpen == 1) { //unable to open
+ errorFree = false;
+ }
+ }
+ }else if (fastafile != "") {
+ if ((phylipfile != "") || (nexusfile != "") || (clustalfile != "")) {
+ cout << "You may enter ONLY ONE of the following: phylip, fasta, nexus or clustal." << endl; errorFree = false; }
+ else {
+ ableToOpen = openInputFile(fastafile, filehandle);
+ filehandle.close();
+ if (ableToOpen == 1) { //unable to open
+ errorFree = false;
+ }
+ }
+ }else if (clustalfile != "") {
+ if ((phylipfile != "") || (nexusfile != "") || (fastafile != "")) {
+ cout << "You may enter ONLY ONE of the following: phylip, fasta, nexus or clustal." << endl; errorFree = false; }
+ else {
+ ableToOpen = openInputFile(clustalfile, filehandle);
+ filehandle.close();
+ if (ableToOpen == 1) { //unable to open
+ errorFree = false;
+ }
+ }
+
+ }
+
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the ErrorCheck class Function validateSeqsFiles. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the ErrorCheck class function validateSeqsFiles. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+/*******************************************************/
+
+/******************************************************/
+//This function checks to make sure the user entered appropriate
+// format parameters on a bin.seq command
+void ErrorCheck::validateBinFiles() {
+ try {
+ ifstream filehandle;
+ int ableToOpen;
+
+ if (fastafile == "") {
+ cout << "fasta is a required parameter for bin.seqs and get.oturep commands." << endl; errorFree = false;
+ }else if (fastafile != "") {
+ //is it a valid filename'
+ ableToOpen = openInputFile(fastafile, filehandle);
+ filehandle.close();
+ //unable to open
+ if (ableToOpen == 1) { errorFree = false; }
+ }else if (listfile != "") {
+ //is it a valid filename'
+ ableToOpen = openInputFile(listfile, filehandle);
+ filehandle.close();
+ //unable to open
+ if (ableToOpen == 1) { errorFree = false; }
+ }else if (globaldata->getNameFile() != "") {
+ //is it a valid filename'
+ ifstream filehandle;
+ int ableToOpen = openInputFile(globaldata->getNameFile(), filehandle);
+ filehandle.close();
+ //unable to open
+ if (ableToOpen == 1) { errorFree = false; }
+ }else if (namefile != "") {
+ //is it a valid filename'
+ ifstream filehandle;
+ int ableToOpen = openInputFile(namefile, filehandle);
+ filehandle.close();
+ //unable to open
+ if (ableToOpen == 1) { errorFree = false; }
+ }
+
+
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the ErrorCheck class Function validateBinFiles. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the ErrorCheck class function validateBinFiles. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+/*******************************************************/
+