ValidParameters::ValidParameters() {
try {
+ m = MothurOut::getInstance();
initParameterRanges();
}
catch(exception& e) {
- cout << "Standard Error: " << e.what() << " has occurred in the ValidParameters class Function ValidParameters. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ m->errorOut(e, "ValidParameters", "ValidParameters");
exit(1);
}
- catch(...) {
- cout << "An unknown error has occurred in the ValidParameters class function ValidParameters. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
}
/***********************************************************************/
}
}
if(!valid) {
- cout << "'" << parameter << "' is not a valid parameter." << endl;
- cout << "The valid parameters are: ";
+ m->mothurOut(parameter + " is not a valid parameter."); m->mothurOutEndLine();
+ m->mothurOut("The valid parameters are: ");
for(int i = 0; i < numParams-1; i++)
- cout << cParams.at(i) << ", ";
- cout << "and " << cParams.at(numParams-1) << ".\n";
+ m->mothurOut(cParams.at(i) + ", ");
+ m->mothurOut("and " + cParams.at(numParams-1) + ".\n");
return false;
}
double logNum = log10((double)pVal);
double diff = (double)((int)logNum - logNum);
if(diff != 0) {
- cout << "The precision parameter can only take powers of 10 as a value (e.g. 10,1000,1000, etc.)\n";
+ m->mothurOut("The precision parameter can only take powers of 10 as a value (e.g. 10,1000,1000, etc.)\n");
return false;
}
}
else if(range.at(4).compare("only") == 0)
c = 1;
else {
- cout << "The range can only be 'between' or 'only' the bounding numbers.\n";
+ m->mothurOut("The range can only be 'between' or 'only' the bounding numbers.\n");
return false;
}
else if(range.at(0).compare(">=") == 0 || range[3].compare("=>") == 0)
d = 1;
else {
- cout << "The parameter value can only be '>', '>=', or '=>' the lower bounding number.\n";
+ m->mothurOut("The parameter value can only be '>', '>=', or '=>' the lower bounding number.\n");
return false;
}
else if(range.at(2).compare("<=") == 0 || range[4].compare("=<") == 0)
e = 1;
else {
- cout << "The parameter value can only be '<', '<=', or '=<' the upper bounding number.\n";
+ m->mothurOut("The parameter value can only be '<', '<=', or '=<' the upper bounding number.\n");
return false;
}
if(!valid) {
- cout << "The '" << parameter << "' parameter needs to be ";
+ m->mothurOut("The '" + parameter + "' parameter needs to be ");
if(c == 1)
- cout << "either '" << a << "' or '" << b << "'.\n";
+ m->mothurOut("either '" + toString(a) + "' or '" + toString(b) + "'.\n");
else {
if(a != piSentinel) {
- cout << ">";
+ m->mothurOut(">");
if(d != 0)
- cout << "=";
- cout << " '" << a << "'";
+ m->mothurOut("=");
+ m->mothurOut(" '" + toString(a) + "'");
}
if(b == piSentinel)
- cout << "'.\n";
+ m->mothurOut( "'.\n");
else if(a != piSentinel)
- cout << " and ";
+ m->mothurOut(" and ");
if(b != piSentinel) {
- cout << "<";
+ m->mothurOut("<");
if(e != 0)
- cout << "=";
- cout << " '" << b << "'.\n";
+ m->mothurOut("=");
+ m->mothurOut(" '" + toString(b) + "'.\n");
}
}
return false;
return true;
}
catch(exception& e) {
- cout << "Standard Error: " << e.what() << " has occurred in the ValidParameters class Function isValidParameter. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
- catch(...) {
- cout << "An unknown error has occurred in the ValidParameters class function isValidParameter. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ m->errorOut(e, "ValidParameters", "isValidParameters");
exit(1);
}
}
it = container.find(parameter);
if(it != container.end()){ //no parameter given
+
if(isFile == true) {
+
+ #ifdef USE_MPI
+ int pid;
+ MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
+
+ if (pid == 0) {
+ #endif
+
ableToOpen = openInputFile(it->second, in);
+
if (ableToOpen == 1) { return "not open"; }
in.close();
+
+ #ifdef USE_MPI
+ }
+ #endif
+
}
}else { return "not found"; }
}
catch(exception& e) {
- cout << "Standard Error: " << e.what() << " has occurred in the ValidParameters class Function validFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
- catch(...) {
- cout << "An unknown error has occurred in the ValidParameters class function validFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ m->errorOut(e, "ValidParameters", "validFile");
exit(1);
}
}
parameterRanges["size"] = addParameters(sizeArray, rangeSize);
}
catch(exception& e) {
- cout << "Standard Error: " << e.what() << " has occurred in the ValidParameters class Function isValidParameter. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
- catch(...) {
- cout << "An unknown error has occurred in the ValidParameters class function isValidParameter. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ m->errorOut(e, "ValidParameters", "initParameterRanges");
exit(1);
}
}
return pVector;
}
catch(exception& e) {
- cout << "Standard Error: " << e.what() << " has occurred in the ValidParameters class Function isValidParameter. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
- catch(...) {
- cout << "An unknown error has occurred in the ValidParameters class function isValidParameter. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ m->errorOut(e, "ValidParameters", "addParameters");
exit(1);
}
}