X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mothur.h;h=f839328cd2c304330fb18f31fb97eea531ef625a;hb=a5afca18544555fba2d9c3670ad1f8574916b0a0;hp=ba88f71fabffced9509deed545cecde7228b2b63;hpb=7b3c9ca940891c1b20b3b7ec13e05d7e7b316b63;p=mothur.git diff --git a/mothur.h b/mothur.h index ba88f71..f839328 100644 --- a/mothur.h +++ b/mothur.h @@ -21,6 +21,7 @@ #include #include #include +#include //exception #include @@ -45,10 +46,21 @@ #include #include +/***********************************************************************/ #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) #include #include + + #ifdef USE_READLINE + #include + #include + #endif + + //#include + //#include +#else + #include //allows unbuffered screen capture from stdin #endif using namespace std; @@ -189,7 +201,6 @@ inline void gobble(istream& f){ f.putback(d); } - /***********************************************************************/ inline string getline(ifstream& fileHandle) { @@ -283,9 +294,6 @@ inline void errorOut(exception& e, string object, string function) { } - - - /***********************************************************************/ inline bool isTrue(string f){ @@ -425,7 +433,21 @@ inline string getExtension(string longName){ return extension; } - +/***********************************************************************/ +inline bool isBlank(string fileName){ + + ifstream fileHandle; + fileHandle.open(fileName.c_str()); + if(!fileHandle) { + mothurOut("Error: Could not open " + fileName); mothurOutEndLine(); + return false; + }else { + //check for blank file + gobble(fileHandle); + if (fileHandle.eof()) { fileHandle.close(); return true; } + } + return false; +} /***********************************************************************/ inline int openInputFile(string fileName, ifstream& fileHandle){ @@ -469,7 +491,16 @@ inline int getNumSeqs(ifstream& file){ return numSeqs; } +/***********************************************************************/ +inline bool inVector(string member, vector group){ + + for (int i = 0; i < group.size(); i++) { + if (group[i] == member) { return true; } + } + + return false; +} /***********************************************************************/ //This function parses the estimator options and puts them in a vector