+
+ //break up file
+ #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+ if(processors == 1){
+ ifstream inFASTA;
+ openInputFile(fastafile, inFASTA);
+ numSeqs=count(istreambuf_iterator<char>(inFASTA),istreambuf_iterator<char>(), '>');
+ inFASTA.close();
+
+ lines.push_back(new linePair(0, numSeqs));
+
+ driver(lines[0], outputFileName, fastafile, accnosFileName);
+
+ }else{
+ vector<int> positions;
+ processIDS.resize(0);
+
+ ifstream inFASTA;
+ openInputFile(fastafile, inFASTA);
+
+ string input;
+ while(!inFASTA.eof()){
+ input = getline(inFASTA);
+ if (input.length() != 0) {
+ if(input[0] == '>'){ long int pos = inFASTA.tellg(); positions.push_back(pos - input.length() - 1); }
+ }
+ }
+ inFASTA.close();
+
+ numSeqs = positions.size();
+
+ int numSeqsPerProcessor = numSeqs / processors;
+
+ for (int i = 0; i < processors; i++) {
+ long int startPos = positions[ i * numSeqsPerProcessor ];
+ if(i == processors - 1){
+ numSeqsPerProcessor = numSeqs - i * numSeqsPerProcessor;
+ }
+ lines.push_back(new linePair(startPos, numSeqsPerProcessor));
+ }
+
+
+ createProcesses(outputFileName, fastafile, accnosFileName);
+
+ rename((outputFileName + toString(processIDS[0]) + ".temp").c_str(), outputFileName.c_str());
+ rename((accnosFileName + toString(processIDS[0]) + ".temp").c_str(), accnosFileName.c_str());
+
+ //append alignment and report files
+ for(int i=1;i<processors;i++){
+ appendOutputFiles((outputFileName + toString(processIDS[i]) + ".temp"), outputFileName);
+ remove((outputFileName + toString(processIDS[i]) + ".temp").c_str());
+
+ appendOutputFiles((accnosFileName + toString(processIDS[i]) + ".temp"), accnosFileName);
+ remove((accnosFileName + toString(processIDS[i]) + ".temp").c_str());
+
+ }
+ }
+
+ #else
+ ifstream inFASTA;
+ openInputFile(candidateFileNames[s], inFASTA);
+ numSeqs=count(istreambuf_iterator<char>(inFASTA),istreambuf_iterator<char>(), '>');
+ inFASTA.close();
+ lines.push_back(new linePair(0, numSeqs));
+
+ driver(lines[0], outputFileName, fastafile, accnosFileName);
+ #endif
+
+ //mothurOut("Output File Names: ");
+ //if ((filter) && (method == "bellerophon")) { mothurOut(
+ //if (outputDir == "") { fastafile = getRootName(fastafile) + "filter.fasta"; }
+ // else { fastafile = outputDir + getRootName(getSimpleName(fastafile)) + "filter.fasta"; }
+
+ appendOutputFiles(tempHeader, outputFileName);
+
+ remove(outputFileName.c_str());
+ rename(tempHeader.c_str(), outputFileName.c_str());
+