int pid = fork();
if (pid > 0) {
- processIDS[lines[process]->end] = pid; //create map from line number to pid so you can append files in correct order later
+ processIDS.push_back(pid); //create map from line number to pid so you can append files in correct order later
process++;
}else if (pid == 0){
if (output != "square") { driver(lines[process]->start, lines[process]->end, filename + toString(getpid()) + ".temp", cutoff); }
exit(0);
}else {
m->mothurOut("[ERROR]: unable to spawn the necessary processes. Error code: " + toString(pid)); m->mothurOutEndLine();
- for (map<int, int>::iterator it = processIDS.begin(); it != processIDS.end(); it++) { int temp = it->second; kill (temp, SIGINT); }
+ perror(" : ");
+ for (int i=0;i<processIDS.size();i++) { int temp = processIDS[i]; kill (temp, SIGINT); }
exit(0);
}
}
//force parent to wait until all the processes are done
- for (map<int, int>::iterator it = processIDS.begin(); it != processIDS.end(); it++) {
- int temp = it->second;
+ for (int i=0;i<processIDS.size();i++) {
+ int temp = processIDS[i];
wait(&temp);
}
//append and remove temp files
- for (map<int, int>::iterator it = processIDS.begin(); it != processIDS.end(); it++) {
- m->appendFiles((filename + toString(it->second) + ".temp"), filename);
- remove((filename + toString(it->second) + ".temp").c_str());
+ for (int i=0;i<processIDS.size();i++) {
+ m->appendFiles((filename + toString(processIDS[i]) + ".temp"), filename);
+ remove((filename + toString(processIDS[i]) + ".temp").c_str());
}
#endif
}
int processors, numNewFasta;
float cutoff;
- map<int, int> processIDS; //end line, processid
+ vector<int> processIDS; //end line, processid
vector<linePair*> lines;
bool abort;
fileHandle.open(completeFileName.c_str());
if(!fileHandle) {
+ mothurOut("[ERROR]: Could not open " + completeFileName); mothurOutEndLine();
return 1;
}else {
//check for blank file
//open output file in append mode
openOutputFileAppend(filename, output);
int ableToOpen = openInputFile(temp, input, "no error");
+ //int ableToOpen = openInputFile(temp, input);
if (ableToOpen == 0) { //you opened it
while(char c = input.get()){
//sanity check filePos
for (int i = 0; i < (filePos.size()-1); i++) {
- if (filePos[(i+1)] <= filePos[i]) { cout << "erasing " << (i+1) << endl; filePos.erase(filePos.begin()+(i+1)); i--; }
+ if (filePos[(i+1)] <= filePos[i]) { filePos.erase(filePos.begin()+(i+1)); i--; }
}
proc = (filePos.size() - 1);
#include "splitmatrix.h"
#include "phylotree.h"
#include "distancecommand.h"
+#include "seqsummarycommand.h"
/***********************************************************************/
string options = "fasta=" + (fastafile + "." + toString(i) + ".temp") + ", processors=" + toString(processors) + ", cutoff=" + toString(distCutoff);
Command* command = new DistanceCommand(options);
+
command->execute();
delete command;
//remove old names files just in case
remove((namefile + "." + toString(i) + ".temp").c_str());
}
-
+
singleton = namefile + ".extra.temp";
ofstream remainingNames;
m->openOutputFile(singleton, remainingNames);