- else if(processors == 4){
- int pid1 = fork();
- if(pid1 > 0){
- int pid2 = fork();
- if(pid2 > 0){
- driver(distCalculator, seqDB, 0, numSeqs / 2, distFile + "tempa", cutoff);
- appendFiles(distFile+"tempa", distFile);
- remove((distFile + "tempa").c_str());
- }
- else{
- driver(distCalculator, seqDB, numSeqs / 2, (numSeqs/sqrt(2)), distFile + "tempb", cutoff);
- appendFiles(distFile+"tempb", distFile);
- remove((distFile + "tempb").c_str());
- }
- wait(NULL);
- }
- else{
- int pid3 = fork();
- if(pid3 > 0){
- driver(distCalculator, seqDB, (numSeqs/sqrt(2)), (sqrt(3) * numSeqs / 2), distFile + "tempc", cutoff);
- appendFiles(distFile+"tempc", distFile);
- remove((distFile + "tempc").c_str());
- }
- else{
- driver(distCalculator, seqDB, (sqrt(3) * numSeqs / 2), numSeqs, distFile + "tempd", cutoff);
- appendFiles(distFile+"tempd", distFile);
- remove((distFile + "tempd").c_str());
- }
- wait(NULL);
+ //give the last one any extra line
+ lines[lines.size()-1]->end += remainder;
+
+ createProcesses(distFile, phylipFile);
+
+ //append and remove temp files
+ for (it = processIDS.begin(); it != processIDS.end(); it++) {
+ appendFiles((distFile + toString(it->second) + ".temp"), distFile);
+ remove((distFile + toString(it->second) + ".temp").c_str());
+
+ if (isTrue(phylip) == true) {
+ appendFiles((phylipFile + toString(it->second) + ".temp"), phylipFile);
+ remove((phylipFile + toString(it->second) + ".temp").c_str());