2 * chimeracheckcommand.cpp
5 * Created by westcott on 3/31/10.
6 * Copyright 2010 Schloss Lab. All rights reserved.
10 #include "chimeracheckcommand.h"
11 #include "referencedb.h"
13 //**********************************************************************************************************************
14 vector<string> ChimeraCheckCommand::setParameters(){
16 CommandParameter ptemplate("reference", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(ptemplate);
17 CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pfasta);
18 CommandParameter pname("name", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pname);
19 CommandParameter psvg("svg", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(psvg);
20 CommandParameter pincrement("increment", "Number", "", "10", "", "", "",false,false); parameters.push_back(pincrement);
21 CommandParameter pksize("ksize", "Number", "", "7", "", "", "",false,false); parameters.push_back(pksize);
22 CommandParameter pprocessors("processors", "Number", "", "1", "", "", "",false,false); parameters.push_back(pprocessors);
23 CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
24 CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
25 CommandParameter psave("save", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(psave);
27 vector<string> myArray;
28 for (int i = 0; i < parameters.size(); i++) { myArray.push_back(parameters[i].name); }
32 m->errorOut(e, "ChimeraCheckCommand", "setParameters");
36 //**********************************************************************************************************************
37 string ChimeraCheckCommand::getHelpString(){
39 string helpString = "";
40 helpString += "The chimera.check command reads a fastafile and referencefile and outputs potentially chimeric sequences.\n";
41 helpString += "This command was created using the algorythms described in CHIMERA_CHECK version 2.7 written by Niels Larsen. \n";
42 helpString += "The chimera.check command parameters are fasta, reference, processors, ksize, increment, svg and name.\n";
43 helpString += "The fasta parameter allows you to enter the fasta file containing your potentially chimeric sequences, and is required unless you have a valid current fasta file. \n";
44 helpString += "You may enter multiple fasta files by separating their names with dashes. ie. fasta=abrecovery.fasta-amzon.fasta \n";
45 helpString += "The reference parameter allows you to enter a reference file containing known non-chimeric sequences, and is required. \n";
46 helpString += "The processors parameter allows you to specify how many processors you would like to use. The default is 1. \n";
48 helpString += "When using MPI, the processors parameter is set to the number of MPI processes running. \n";
50 helpString += "The increment parameter allows you to specify how far you move each window while finding chimeric sequences, default is 10.\n";
51 helpString += "The ksize parameter allows you to input kmersize, default is 7. \n";
52 helpString += "The svg parameter allows you to specify whether or not you would like a svg file outputted for each query sequence, default is False.\n";
53 helpString += "The name parameter allows you to enter a file containing names of sequences you would like .svg files for.\n";
54 helpString += "You may enter multiple name files by separating their names with dashes. ie. fasta=abrecovery.svg.names-amzon.svg.names \n";
55 helpString += "If the save parameter is set to true the reference sequences will be saved in memory, to clear them later you can use the clear.memory command. Default=f.";
56 helpString += "The chimera.check command should be in the following format: \n";
57 helpString += "chimera.check(fasta=yourFastaFile, reference=yourTemplateFile, processors=yourProcessors, ksize=yourKmerSize) \n";
58 helpString += "Example: chimera.check(fasta=AD.fasta, reference=core_set_aligned,imputed.fasta, processors=4, ksize=8) \n";
59 helpString += "Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFastaFile).\n";
63 m->errorOut(e, "ChimeraCheckCommand", "getHelpString");
67 //**********************************************************************************************************************
68 string ChimeraCheckCommand::getOutputFileNameTag(string type, string inputName=""){
70 string outputFileName = "";
71 map<string, vector<string> >::iterator it;
73 //is this a type this command creates
74 it = outputTypes.find(type);
75 if (it == outputTypes.end()) { m->mothurOut("[ERROR]: this command doesn't create a " + type + " output file.\n"); }
77 if (type == "chimera") { outputFileName = "chimeracheck.chimeras"; }
78 else { m->mothurOut("[ERROR]: No definition for type " + type + " output file tag.\n"); m->control_pressed = true; }
80 return outputFileName;
83 m->errorOut(e, "ChimeraCcodeCommand", "getOutputFileNameTag");
87 //**********************************************************************************************************************
88 ChimeraCheckCommand::ChimeraCheckCommand(){
90 abort = true; calledHelp = true;
92 vector<string> tempOutNames;
93 outputTypes["chimera"] = tempOutNames;
96 m->errorOut(e, "ChimeraCheckCommand", "ChimeraCheckCommand");
100 //***************************************************************************************************************
101 ChimeraCheckCommand::ChimeraCheckCommand(string option) {
103 abort = false; calledHelp = false;
104 ReferenceDB* rdb = ReferenceDB::getInstance();
106 //allow user to run help
107 if(option == "help") { help(); abort = true; calledHelp = true; }
108 else if(option == "citation") { citation(); abort = true; calledHelp = true;}
111 vector<string> myArray = setParameters();
113 OptionParser parser(option);
114 map<string,string> parameters = parser.getParameters();
116 ValidParameters validParameter("chimera.check");
117 map<string,string>::iterator it;
119 //check to make sure all parameters are valid for command
120 for (it = parameters.begin(); it != parameters.end(); it++) {
121 if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; }
124 vector<string> tempOutNames;
125 outputTypes["chimera"] = tempOutNames;
127 //if the user changes the input directory command factory will send this info to us in the output parameter
128 string inputDir = validParameter.validFile(parameters, "inputdir", false);
129 if (inputDir == "not found"){ inputDir = ""; }
131 it = parameters.find("reference");
132 //user has given a template file
133 if(it != parameters.end()){
134 string path = m->hasPath(it->second);
135 //if the user has not given a path then, add inputdir. else leave path alone.
136 if (path == "") { parameters["reference"] = inputDir + it->second; }
140 //check for required parameters
141 fastafile = validParameter.validFile(parameters, "fasta", false);
142 if (fastafile == "not found") {
143 //if there is a current fasta file, use it
144 string filename = m->getFastaFile();
145 if (filename != "") { fastaFileNames.push_back(filename); m->mothurOut("Using " + filename + " as input file for the fasta parameter."); m->mothurOutEndLine(); }
146 else { m->mothurOut("You have no current fastafile and the fasta parameter is required."); m->mothurOutEndLine(); abort = true; }
148 m->splitAtDash(fastafile, fastaFileNames);
150 //go through files and make sure they are good, if not, then disregard them
151 for (int i = 0; i < fastaFileNames.size(); i++) {
154 if (fastaFileNames[i] == "current") {
155 fastaFileNames[i] = m->getFastaFile();
156 if (fastaFileNames[i] != "") { m->mothurOut("Using " + fastaFileNames[i] + " as input file for the fasta parameter where you had given current."); m->mothurOutEndLine(); }
158 m->mothurOut("You have no current fastafile, ignoring current."); m->mothurOutEndLine(); ignore=true;
159 //erase from file list
160 fastaFileNames.erase(fastaFileNames.begin()+i);
168 if (inputDir != "") {
169 string path = m->hasPath(fastaFileNames[i]);
170 //if the user has not given a path then, add inputdir. else leave path alone.
171 if (path == "") { fastaFileNames[i] = inputDir + fastaFileNames[i]; }
177 ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
179 //if you can't open it, try default location
180 if (ableToOpen == 1) {
181 if (m->getDefaultPath() != "") { //default path is set
182 string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
183 m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
185 ableToOpen = m->openInputFile(tryPath, in2, "noerror");
187 fastaFileNames[i] = tryPath;
191 //if you can't open it, try default location
192 if (ableToOpen == 1) {
193 if (m->getOutputDir() != "") { //default path is set
194 string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
195 m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
197 ableToOpen = m->openInputFile(tryPath, in2, "noerror");
199 fastaFileNames[i] = tryPath;
205 if (ableToOpen == 1) {
206 m->mothurOut("Unable to open " + fastaFileNames[i] +". It will be disregarded."); m->mothurOutEndLine();
207 //erase from file list
208 fastaFileNames.erase(fastaFileNames.begin()+i);
211 m->setFastaFile(fastaFileNames[i]);
216 //make sure there is at least one valid file left
217 if (fastaFileNames.size() == 0) { m->mothurOut("no valid files."); m->mothurOutEndLine(); abort = true; }
220 //if the user changes the output directory command factory will send this info to us in the output parameter
221 outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = ""; }
223 namefile = validParameter.validFile(parameters, "name", false);
224 if (namefile == "not found") { namefile = ""; }
226 m->splitAtDash(namefile, nameFileNames);
228 //go through files and make sure they are good, if not, then disregard them
229 for (int i = 0; i < nameFileNames.size(); i++) {
232 if (nameFileNames[i] == "current") {
233 nameFileNames[i] = m->getNameFile();
234 if (nameFileNames[i] != "") { m->mothurOut("Using " + nameFileNames[i] + " as input file for the name parameter where you had given current."); m->mothurOutEndLine(); }
236 m->mothurOut("You have no current namefile, ignoring current."); m->mothurOutEndLine(); ignore=true;
237 //erase from file list
238 nameFileNames.erase(nameFileNames.begin()+i);
245 if (inputDir != "") {
246 string path = m->hasPath(nameFileNames[i]);
247 //if the user has not given a path then, add inputdir. else leave path alone.
248 if (path == "") { nameFileNames[i] = inputDir + nameFileNames[i]; }
254 ableToOpen = m->openInputFile(nameFileNames[i], in, "noerror");
256 //if you can't open it, try default location
257 if (ableToOpen == 1) {
258 if (m->getDefaultPath() != "") { //default path is set
259 string tryPath = m->getDefaultPath() + m->getSimpleName(nameFileNames[i]);
260 m->mothurOut("Unable to open " + nameFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
262 ableToOpen = m->openInputFile(tryPath, in2, "noerror");
264 nameFileNames[i] = tryPath;
268 //if you can't open it, try default location
269 if (ableToOpen == 1) {
270 if (m->getOutputDir() != "") { //default path is set
271 string tryPath = m->getOutputDir() + m->getSimpleName(nameFileNames[i]);
272 m->mothurOut("Unable to open " + nameFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
274 ableToOpen = m->openInputFile(tryPath, in2, "noerror");
276 nameFileNames[i] = tryPath;
282 if (ableToOpen == 1) {
283 m->mothurOut("Unable to open " + nameFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine();
284 //erase from file list
285 nameFileNames.erase(nameFileNames.begin()+i);
288 m->setNameFile(nameFileNames[i]);
293 //make sure there is at least one valid file left
294 if (nameFileNames.size() != 0) {
295 if (nameFileNames.size() != fastaFileNames.size()) {
296 m->mothurOut("Different number of valid name files and fasta files, aborting command."); m->mothurOutEndLine();
302 string temp = validParameter.validFile(parameters, "processors", false); if (temp == "not found"){ temp = m->getProcessors(); }
303 m->setProcessors(temp);
304 m->mothurConvert(temp, processors);
306 temp = validParameter.validFile(parameters, "save", false); if (temp == "not found"){ temp = "f"; }
307 save = m->isTrue(temp);
309 if (save) { //clear out old references
313 //this has to go after save so that if the user sets save=t and provides no reference we abort
314 templatefile = validParameter.validFile(parameters, "reference", true);
315 if (templatefile == "not found") {
316 //check for saved reference sequences
317 if (rdb->referenceSeqs.size() != 0) {
318 templatefile = "saved";
320 m->mothurOut("[ERROR]: You don't have any saved reference sequences and the reference parameter is a required.");
321 m->mothurOutEndLine();
324 }else if (templatefile == "not open") { abort = true; }
325 else { if (save) { rdb->setSavedReference(templatefile); } }
328 temp = validParameter.validFile(parameters, "ksize", false); if (temp == "not found") { temp = "7"; }
329 m->mothurConvert(temp, ksize);
331 temp = validParameter.validFile(parameters, "svg", false); if (temp == "not found") { temp = "F"; }
332 svg = m->isTrue(temp);
333 if (nameFileNames.size() != 0) { svg = true; }
335 temp = validParameter.validFile(parameters, "increment", false); if (temp == "not found") { temp = "10"; }
336 m->mothurConvert(temp, increment);
339 catch(exception& e) {
340 m->errorOut(e, "ChimeraCheckCommand", "ChimeraCheckCommand");
344 //***************************************************************************************************************
346 int ChimeraCheckCommand::execute(){
349 if (abort == true) { if (calledHelp) { return 0; } return 2; }
351 for (int i = 0; i < fastaFileNames.size(); i++) {
353 m->mothurOut("Checking sequences from " + fastaFileNames[i] + " ..." ); m->mothurOutEndLine();
355 int start = time(NULL);
357 string thisNameFile = "";
358 if (nameFileNames.size() != 0) { thisNameFile = nameFileNames[i]; }
360 chimera = new ChimeraCheckRDP(fastaFileNames[i], templatefile, thisNameFile, svg, increment, ksize, outputDir);
362 if (m->control_pressed) { delete chimera; return 0; }
364 if (outputDir == "") { outputDir = m->hasPath(fastaFileNames[i]); }//if user entered a file with a path then preserve it
365 string outputFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[i])) + getOutputFileNameTag("chimera");
366 outputNames.push_back(outputFileName); outputTypes["chimera"].push_back(outputFileName);
370 int pid, numSeqsPerProcessor;
372 vector<unsigned long long> MPIPos;
375 MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
376 MPI_Comm_size(MPI_COMM_WORLD, &processors);
381 int outMode=MPI_MODE_CREATE|MPI_MODE_WRONLY;
382 int inMode=MPI_MODE_RDONLY;
384 char outFilename[1024];
385 strcpy(outFilename, outputFileName.c_str());
387 char inFileName[1024];
388 strcpy(inFileName, fastaFileNames[i].c_str());
390 MPI_File_open(MPI_COMM_WORLD, inFileName, inMode, MPI_INFO_NULL, &inMPI); //comm, filename, mode, info, filepointer
391 MPI_File_open(MPI_COMM_WORLD, outFilename, outMode, MPI_INFO_NULL, &outMPI);
393 if (m->control_pressed) { MPI_File_close(&inMPI); MPI_File_close(&outMPI); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } outputTypes.clear(); delete chimera; return 0; }
395 if (pid == 0) { //you are the root process
396 MPIPos = m->setFilePosFasta(fastaFileNames[i], numSeqs); //fills MPIPos, returns numSeqs
398 //send file positions to all processes
399 for(int j = 1; j < processors; j++) {
400 MPI_Send(&numSeqs, 1, MPI_INT, j, tag, MPI_COMM_WORLD);
401 MPI_Send(&MPIPos[0], (numSeqs+1), MPI_LONG, j, tag, MPI_COMM_WORLD);
404 //figure out how many sequences you have to align
405 numSeqsPerProcessor = numSeqs / processors;
406 int startIndex = pid * numSeqsPerProcessor;
407 if(pid == (processors - 1)){ numSeqsPerProcessor = numSeqs - pid * numSeqsPerProcessor; }
411 driverMPI(startIndex, numSeqsPerProcessor, inMPI, outMPI, MPIPos);
413 if (m->control_pressed) { MPI_File_close(&inMPI); MPI_File_close(&outMPI); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } outputTypes.clear(); delete chimera; return 0; }
416 for(int j = 1; j < processors; j++) {
418 MPI_Recv(buf, 5, MPI_CHAR, j, tag, MPI_COMM_WORLD, &status);
420 }else{ //you are a child process
421 MPI_Recv(&numSeqs, 1, MPI_INT, 0, tag, MPI_COMM_WORLD, &status);
422 MPIPos.resize(numSeqs+1);
423 MPI_Recv(&MPIPos[0], (numSeqs+1), MPI_LONG, 0, tag, MPI_COMM_WORLD, &status);
425 //figure out how many sequences you have to align
426 numSeqsPerProcessor = numSeqs / processors;
427 int startIndex = pid * numSeqsPerProcessor;
428 if(pid == (processors - 1)){ numSeqsPerProcessor = numSeqs - pid * numSeqsPerProcessor; }
431 driverMPI(startIndex, numSeqsPerProcessor, inMPI, outMPI, MPIPos);
433 if (m->control_pressed) { MPI_File_close(&inMPI); MPI_File_close(&outMPI); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } outputTypes.clear(); delete chimera; return 0; }
435 //tell parent you are done.
438 MPI_Send(buf, 5, MPI_CHAR, 0, tag, MPI_COMM_WORLD);
442 MPI_File_close(&inMPI);
443 MPI_File_close(&outMPI);
444 MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case
450 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
451 vector<unsigned long long> positions = m->divideFile(fastaFileNames[i], processors);
453 for (int s = 0; s < (positions.size()-1); s++) {
454 lines.push_back(new linePair(positions[s], positions[(s+1)]));
458 numSeqs = driver(lines[0], outputFileName, fastaFileNames[i]);
460 if (m->control_pressed) { for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } for (int j = 0; j < lines.size(); j++) { delete lines[j]; } outputTypes.clear(); lines.clear(); delete chimera; return 0; }
463 processIDS.resize(0);
465 numSeqs = createProcesses(outputFileName, fastaFileNames[i]);
467 rename((outputFileName + toString(processIDS[0]) + ".temp").c_str(), outputFileName.c_str());
469 //append output files
470 for(int j=1;j<processors;j++){
471 m->appendFiles((outputFileName + toString(processIDS[j]) + ".temp"), outputFileName);
472 m->mothurRemove((outputFileName + toString(processIDS[j]) + ".temp"));
475 if (m->control_pressed) {
476 for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } outputTypes.clear();
477 for (int j = 0; j < lines.size(); j++) { delete lines[j]; } lines.clear();
484 lines.push_back(new linePair(0, 1000));
485 numSeqs = driver(lines[0], outputFileName, fastaFileNames[i]);
487 if (m->control_pressed) { for (int j = 0; j < lines.size(); j++) { delete lines[j]; } lines.clear(); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } outputTypes.clear(); delete chimera; return 0; }
491 for (int j = 0; j < lines.size(); j++) { delete lines[j]; } lines.clear();
493 m->mothurOutEndLine(); m->mothurOut("This method does not determine if a sequence is chimeric, but allows you to make that determination based on the IS values."); m->mothurOutEndLine();
494 m->mothurOutEndLine(); m->mothurOut("It took " + toString(time(NULL) - start) + " secs to check " + toString(numSeqs) + " sequences."); m->mothurOutEndLine(); m->mothurOutEndLine();
498 m->mothurOutEndLine();
499 m->mothurOut("Output File Names: "); m->mothurOutEndLine();
500 for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
501 m->mothurOutEndLine();
506 catch(exception& e) {
507 m->errorOut(e, "ChimeraCheckCommand", "execute");
511 //**********************************************************************************************************************
513 int ChimeraCheckCommand::driver(linePair* filePos, string outputFName, string filename){
516 m->openOutputFile(outputFName, out);
521 m->openInputFile(filename, inFASTA);
523 inFASTA.seekg(filePos->start);
530 if (m->control_pressed) { return 1; }
532 Sequence* candidateSeq = new Sequence(inFASTA); m->gobble(inFASTA);
534 if (candidateSeq->getName() != "") { //incase there is a commented sequence at the end of a file
536 chimera->getChimeras(candidateSeq);
538 if (m->control_pressed) { delete candidateSeq; return 1; }
541 chimera->print(out, out2);
545 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
546 unsigned long long pos = inFASTA.tellg();
547 if ((pos == -1) || (pos >= filePos->end)) { break; }
549 if (inFASTA.eof()) { break; }
553 if((count) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); }
557 if((count) % 100 != 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); }
564 catch(exception& e) {
565 m->errorOut(e, "ChimeraCheckCommand", "driver");
569 //**********************************************************************************************************************
571 int ChimeraCheckCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File& outMPI, vector<unsigned long long>& MPIPos){
576 MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
578 for(int i=0;i<num;i++){
580 if (m->control_pressed) { return 0; }
583 int length = MPIPos[start+i+1] - MPIPos[start+i];
585 char* buf4 = new char[length];
586 MPI_File_read_at(inMPI, MPIPos[start+i], buf4, length, MPI_CHAR, &status);
588 string tempBuf = buf4;
589 if (tempBuf.length() > length) { tempBuf = tempBuf.substr(0, length); }
590 istringstream iss (tempBuf,istringstream::in);
593 Sequence* candidateSeq = new Sequence(iss); m->gobble(iss);
595 if (candidateSeq->getName() != "") { //incase there is a commented sequence at the end of a file
597 chimera->getChimeras(candidateSeq);
600 chimera->print(outMPI, outAccMPI);
605 if((i+1) % 100 == 0){ cout << "Processing sequence: " << (i+1) << endl; m->mothurOutJustToLog("Processing sequence: " + toString(i+1) + "\n"); }
608 if(num % 100 != 0){ cout << "Processing sequence: " << num << endl; m->mothurOutJustToLog("Processing sequence: " + toString(num) + "\n"); }
612 catch(exception& e) {
613 m->errorOut(e, "ChimeraCheckCommand", "driverMPI");
619 /**************************************************************************************************/
621 int ChimeraCheckCommand::createProcesses(string outputFileName, string filename) {
623 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
627 //loop through and create all the processes you want
628 while (process != processors) {
632 processIDS.push_back(pid); //create map from line number to pid so you can append files in correct order later
635 num = driver(lines[process], outputFileName + toString(getpid()) + ".temp", filename);
637 //pass numSeqs to parent
639 string tempFile = outputFileName + toString(getpid()) + ".num.temp";
640 m->openOutputFile(tempFile, out);
646 m->mothurOut("[ERROR]: unable to spawn the necessary processes."); m->mothurOutEndLine();
647 for (int i = 0; i < processIDS.size(); i++) { kill (processIDS[i], SIGINT); }
652 //force parent to wait until all the processes are done
653 for (int i=0;i<processors;i++) {
654 int temp = processIDS[i];
658 for (int i = 0; i < processIDS.size(); i++) {
660 string tempFile = outputFileName + toString(processIDS[i]) + ".num.temp";
661 m->openInputFile(tempFile, in);
662 if (!in.eof()) { int tempNum = 0; in >> tempNum; num += tempNum; }
663 in.close(); m->mothurRemove(tempFile);
669 catch(exception& e) {
670 m->errorOut(e, "ChimeraCheckCommand", "createProcesses");
674 /**************************************************************************************************/