X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=filterseqscommand.cpp;h=a7d42b331bc3044de372c030175da4663f9e3a9c;hb=72e0be6b9c80009d4dbee24e8d690ad9514dc6fb;hp=806ca0d69cabd6056de8ce1870c628e40916e080;hpb=26cf6509c41e1f38fe5a178bf9d22c02d9d97580;p=mothur.git diff --git a/filterseqscommand.cpp b/filterseqscommand.cpp index 806ca0d..a7d42b3 100644 --- a/filterseqscommand.cpp +++ b/filterseqscommand.cpp @@ -125,7 +125,12 @@ FilterSeqsCommand::FilterSeqsCommand(string option) { fasta = validParameter.validFile(parameters, "fasta", false); if (fasta == "not found") { fasta = m->getFastaFile(); - if (fasta != "") { fastafileNames.push_back(fasta); m->mothurOut("Using " + fasta + " as input file for the fasta parameter."); m->mothurOutEndLine(); } + if (fasta != "") { + fastafileNames.push_back(fasta); + m->mothurOut("Using " + fasta + " as input file for the fasta parameter."); m->mothurOutEndLine(); + string simpleName = m->getSimpleName(fasta); + filterFileName += simpleName.substr(0, simpleName.find_first_of('.')); + } else { m->mothurOut("You have no current fastafile and the fasta parameter is required."); m->mothurOutEndLine(); abort = true; } } else { @@ -420,8 +425,21 @@ int FilterSeqsCommand::filterSequences() { MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case #else - vector positions = savedPositions[s]; - #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + + vector positions; + if (savedPositions.size() != 0) { positions = savedPositions[s]; } + else { +#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) + positions = m->divideFile(fastafileNames[s], processors); +#else + if(processors != 1){ + int numFastaSeqs = 0; + positions = m->setFilePosFasta(fastafileNames[s], numFastaSeqs); + if (positions.size() < processors) { processors = positions.size(); } + } +#endif + } + #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) //vector positions = m->divideFile(fastafileNames[s], processors); for (int i = 0; i < (positions.size()-1); i++) { @@ -578,7 +596,7 @@ int FilterSeqsCommand::driverRunFilter(string F, string outputFilename, string i count++; } - #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) unsigned long long pos = in.tellg(); if ((pos == -1) || (pos >= filePos->end)) { break; } #else @@ -611,7 +629,7 @@ int FilterSeqsCommand::createProcessesRunFilter(string F, string filename, strin int num = 0; processIDS.clear(); -#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) +#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) //loop through and create all the processes you want @@ -799,7 +817,7 @@ string FilterSeqsCommand::createFilter() { #else vector positions; - #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) positions = m->divideFile(fastafileNames[s], processors); for (int i = 0; i < (positions.size()-1); i++) { lines.push_back(new linePair(positions[i], positions[(i+1)])); @@ -820,6 +838,7 @@ string FilterSeqsCommand::createFilter() { }else { int numFastaSeqs = 0; positions = m->setFilePosFasta(fastafileNames[s], numFastaSeqs); + if (positions.size() < processors) { processors = positions.size(); } //figure out how many sequences you have to process int numSeqsPerProcessor = numFastaSeqs / processors; @@ -957,7 +976,7 @@ int FilterSeqsCommand::driverCreateFilter(Filters& F, string filename, linePair* count++; } - #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) unsigned long long pos = in.tellg(); if ((pos == -1) || (pos >= filePos->end)) { break; } #else @@ -1033,7 +1052,7 @@ int FilterSeqsCommand::createProcessesCreateFilter(Filters& F, string filename) int num = 0; processIDS.clear(); -#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) +#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) //loop through and create all the processes you want while (process != processors) {