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, processors;
+ MPI_Status status;
+ MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
+ MPI_Comm_size(MPI_COMM_WORLD, &processors);
+
+ if (pid == 0) {
+ #endif
+
ableToOpen = openInputFile(it->second, in);
- if (ableToOpen == 1) { return "not open"; }
in.close();
+
+ #ifdef USE_MPI
+ for(int i = 1; i < processors; i++) {
+ MPI_Send(&ableToOpen, 1, MPI_INT, i, 2001, MPI_COMM_WORLD);
+ }
+ }else {
+ MPI_Recv(&ableToOpen, 1, MPI_INT, 0, 2001, MPI_COMM_WORLD, &status);
+ }
+
+ MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case
+ #endif
+
+ if (ableToOpen == 1) { return "not open"; }
}
}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);
}
}
string itersArray[] = {">=","10", "<","NA", "between"};
parameterRanges["iters"] = addParameters(itersArray, rangeSize);
- string freqArray[] = {">=","1", "<","NA", "between"};
- parameterRanges["freq"] = addParameters(freqArray, rangeSize);
-
- //string lineArray[] = {">=","1", "<","NA", "between"};
- //parameterRanges["line"] = addParameters(lineArray, rangeSize);
-
string abundArray[] = {">=","5", "<","NA", "between"};
parameterRanges["abund"] = addParameters(abundArray, rangeSize);
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);
}
}