X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=rarefact.cpp;h=83a6306db7568ac228fb110f1ad1c405cec9c7ec;hb=a89c6295ae9a35fcaaab7fa50dcb68360dd543b0;hp=d8a6b5cc2be05f8022da2c9234a358bb6fa98e8c;hpb=ca9ac1d80c62f57270b0dcd49410ebe08a8aecd6;p=mothur.git diff --git a/rarefact.cpp b/rarefact.cpp index d8a6b5c..83a6306 100644 --- a/rarefact.cpp +++ b/rarefact.cpp @@ -24,7 +24,7 @@ int Rarefact::getCurve(float percentFreq = 0.01, int nIters = 1000){ if (percentFreq < 1.0) { increment = numSeqs * percentFreq; } else { increment = percentFreq; } - #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) if(processors == 1){ driver(rcd, increment, nIters); }else{ @@ -86,12 +86,12 @@ int Rarefact::driver(RarefactionCurveData* rcd, int increment, int nIters = 1000 lookup->set(binNumber, abundance); rank->set(abundance, rank->get(abundance)+1); - if((i == 0) || (i+1) % increment == 0){ + if((i == 0) || ((i+1) % increment == 0) || (ends.count(i+1) != 0)){ rcd->updateRankData(rank); } } - if(numSeqs % increment != 0){ + if((numSeqs % increment != 0) || (ends.count(numSeqs) != 0)){ rcd->updateRankData(rank); } @@ -114,7 +114,7 @@ int Rarefact::driver(RarefactionCurveData* rcd, int increment, int nIters = 1000 int Rarefact::createProcesses(vector& procIters, RarefactionCurveData* rcd, int increment) { try { -#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) +#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) int process = 1; vector processIDS; @@ -123,7 +123,7 @@ int Rarefact::createProcesses(vector& procIters, RarefactionCurveData* rcd, //loop through and create all the processes you want while (process != processors) { - int pid = fork(); + pid_t pid = fork(); if (pid > 0) { processIDS.push_back(pid); //create map from line number to pid so you can append files in correct order later @@ -133,7 +133,7 @@ int Rarefact::createProcesses(vector& procIters, RarefactionCurveData* rcd, //pass numSeqs to parent for(int i=0;imothurGetpid(process) + toString(i) + ".rarefact.temp"; displays[i]->outputTempFiles(tempFile); } exit(0); @@ -157,7 +157,7 @@ int Rarefact::createProcesses(vector& procIters, RarefactionCurveData* rcd, for(int j=0;jinputTempFiles(s); - remove(s.c_str()); + m->mothurRemove(s); } }