//**********************************************************************************************************************
ChimeraCcodeCommand::ChimeraCcodeCommand(){
try {
+ abort = true; calledHelp = true;
vector<string> tempOutNames;
outputTypes["chimera"] = tempOutNames;
outputTypes["mapinfo"] = tempOutNames;
//***************************************************************************************************************
ChimeraCcodeCommand::ChimeraCcodeCommand(string option) {
try {
- abort = false;
+ abort = false; calledHelp = false;
//allow user to run help
- if(option == "help") { help(); abort = true; }
+ if(option == "help") { help(); abort = true; calledHelp = true; }
else {
//valid paramters for this command
if (m->getDefaultPath() != "") { //default path is set
string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
if (m->getOutputDir() != "") { //default path is set
string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
- ableToOpen = m->openInputFile(tryPath, in, "noerror");
+ ifstream in2;
+ ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+ in2.close();
fastaFileNames[i] = tryPath;
}
}
int ChimeraCcodeCommand::execute(){
try{
- if (abort == true) { return 0; }
+ if (abort == true) { if (calledHelp) { return 0; } return 2; }
for (int s = 0; s < fastaFileNames.size(); s++) {
#ifdef USE_MPI
- int pid, end, numSeqsPerProcessor;
+ int pid, numSeqsPerProcessor;
int tag = 2001;
vector<unsigned long int> MPIPos;
if (m->control_pressed) { delete candidateSeq; return 1; }
//print results
- bool isChimeric = chimera->print(outMPI, outAccMPI);
+ chimera->print(outMPI, outAccMPI);
}
}
delete candidateSeq;
out.close();
exit(0);
- }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); }
+ }else {
+ m->mothurOut("[ERROR]: unable to spawn the necessary processes."); m->mothurOutEndLine();
+ for (int i = 0; i < processIDS.size(); i++) { kill (processIDS[i], SIGINT); }
+ exit(0);
+ }
}
//force parent to wait until all the processes are done