X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mothurout.cpp;h=9dcdc80e761f1483059297dbcd996a0a06b43e5b;hb=0ca63a8165baa0afa459e644ebe140ba496d5ba0;hp=bc5e24efffc6d79291112870d74ac4686c39d42b;hpb=88fbc534a92cb91900e98a3288dfa1f68828b69b;p=mothur.git diff --git a/mothurout.cpp b/mothurout.cpp index bc5e24e..9dcdc80 100644 --- a/mothurout.cpp +++ b/mothurout.cpp @@ -1182,7 +1182,6 @@ vector MothurOut::setFilePosEachLine(string filename, int& n vector MothurOut::divideFile(string filename, int& proc) { try{ - vector filePos; filePos.push_back(0); @@ -1190,7 +1189,7 @@ vector MothurOut::divideFile(string filename, int& proc) { unsigned long long size; filename = getFullPathName(filename); - + //get num bytes in file pFile = fopen (filename.c_str(),"rb"); if (pFile==NULL) perror ("Error opening file"); @@ -1199,7 +1198,9 @@ vector MothurOut::divideFile(string filename, int& proc) { size=ftell (pFile); fclose (pFile); } - + + #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + //estimate file breaks unsigned long long chunkSize = 0; chunkSize = size / proc; @@ -1219,7 +1220,10 @@ vector MothurOut::divideFile(string filename, int& proc) { unsigned long long newSpot = spot; while (!in.eof()) { char c = in.get(); + if (c == '>') { in.putback(c); newSpot = in.tellg(); break; } + else if (int(c) == -1) { break; } + } //there was not another sequence before the end of the file @@ -1240,7 +1244,11 @@ vector MothurOut::divideFile(string filename, int& proc) { } proc = (filePos.size() - 1); - +#else + mothurOut("[ERROR]: Windows version should not be calling the divideFile function."); mothurOutEndLine(); + proc=1; + filePos.push_back(size); +#endif return filePos; } catch(exception& e) { @@ -1469,6 +1477,26 @@ int MothurOut::getNumNames(string names){ } /***********************************************************************/ +int MothurOut::getNumChar(string line, char c){ + try { + int count = 0; + + if(line != ""){ + for(int i=0;i > MothurOut::binomial(int maxOrder){