X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mothur.h;h=f1b13920d0a4c8941214dbf3e42c96ed4ce39486;hb=71c8b7190cf3a4dcedbab0273c938f6f868562bc;hp=c3f61b4268b613da53a567f0fa6239983a19311e;hpb=0c78e45408d8c099bc51579225ebfc227f7523b2;p=mothur.git diff --git a/mothur.h b/mothur.h index c3f61b4..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 @@ -64,6 +66,9 @@ #else #include //allows unbuffered screen capture from stdin #include //get cwd + #include + #include + #endif using namespace std; @@ -657,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 { @@ -783,6 +811,7 @@ inline void splitAtEquals(string& key, string& value){ exit(1); } } + /**************************************************************************************************/ inline bool inUsersGroups(string groupname, vector Groups) { @@ -828,7 +857,13 @@ inline bool anyLabelsToProcess(string label, set& userLabels, string err //unique is the smallest line if (label == "unique") { return false; } - else { convert(label, labelFloat); } + else { + if (convertTestFloat(label, labelFloat)) { + convert(label, labelFloat); + }else { //cant convert + return false; + } + } //go through users set and make them floats for(it = userLabels.begin(); it != userLabels.end(); ++it) { @@ -981,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); @@ -991,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(); @@ -1010,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); @@ -1027,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); } } @@ -1048,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");