X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mothur.h;h=f1b13920d0a4c8941214dbf3e42c96ed4ce39486;hb=1d18c13c5d71e92ee850a0d8d7cda4f0ef530bf7;hp=93f96df30c73fa91b7119b07eadb27a89dc5109d;hpb=a86aff4f80701bf0d436f02c0095920114e1cba2;p=mothur.git diff --git a/mothur.h b/mothur.h index 93f96df..f1b1392 100644 --- a/mothur.h +++ b/mothur.h @@ -54,6 +54,8 @@ #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) #include + #include + #include #include #ifdef USE_READLINE @@ -660,6 +662,29 @@ inline bool inVector(string member, vector group){ } /***********************************************************************/ +//This function parses the estimator options and puts them in a vector +inline void splitAtChar(string& estim, vector& container, char symbol) { + try { + string individual; + + while (estim.find_first_of(symbol) != -1) { + individual = estim.substr(0,estim.find_first_of(symbol)); + if ((estim.find_first_of(symbol)+1) <= estim.length()) { //checks to make sure you don't have dash at end of string + estim = estim.substr(estim.find_first_of(symbol)+1, estim.length()); + container.push_back(individual); + } + } + //get last one + container.push_back(estim); + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the mothur.h function splitAtDash. Please contact Pat Schloss at mothur.bugs@gmail.com." << "\n"; + exit(1); + } +} + +/***********************************************************************/ + //This function parses the estimator options and puts them in a vector inline void splitAtDash(string& estim, vector& container) { try { @@ -786,6 +811,7 @@ inline void splitAtEquals(string& key, string& value){ exit(1); } } + /**************************************************************************************************/ inline bool inUsersGroups(string groupname, vector Groups) { @@ -990,9 +1016,9 @@ inline string sortFile(string distFile, string outputDir){ } } /**************************************************************************************************/ -inline vector setFilePosFasta(string filename, int& num) { +inline vector setFilePosFasta(string filename, int& num) { - vector positions; + vector positions; ifstream inFASTA; openInputFile(filename, inFASTA); @@ -1000,7 +1026,7 @@ inline vector setFilePosFasta(string filename, int& num) { while(!inFASTA.eof()){ input = getline(inFASTA); gobble(inFASTA); if (input.length() != 0) { - if(input[0] == '>'){ long pos = inFASTA.tellg(); positions.push_back(pos - input.length() - 1); } + if(input[0] == '>'){ unsigned long int pos = inFASTA.tellg(); positions.push_back(pos - input.length() - 1); } } } inFASTA.close(); @@ -1019,7 +1045,7 @@ inline vector setFilePosFasta(string filename, int& num) { fclose (pFile); }*/ - long size = positions[(positions.size()-1)]; + unsigned long int size = positions[(positions.size()-1)]; ifstream in; openInputFile(filename, in); @@ -1036,18 +1062,18 @@ inline vector setFilePosFasta(string filename, int& num) { return positions; } /**************************************************************************************************/ -inline vector setFilePosEachLine(string filename, int& num) { +inline vector setFilePosEachLine(string filename, int& num) { - vector positions; + vector positions; ifstream in; openInputFile(filename, in); string input; while(!in.eof()){ - long lastpos = in.tellg(); + unsigned long int lastpos = in.tellg(); input = getline(in); gobble(in); if (input.length() != 0) { - long pos = in.tellg(); + unsigned long int pos = in.tellg(); if (pos != -1) { positions.push_back(pos - input.length() - 1); } else { positions.push_back(lastpos); } } @@ -1057,7 +1083,7 @@ inline vector setFilePosEachLine(string filename, int& num) { num = positions.size(); FILE * pFile; - long size; + unsigned long int size; //get num bytes in file pFile = fopen (filename.c_str(),"rb");