]> git.donarmstrong.com Git - mothur.git/blobdiff - mothur.h
added sorted parameter to get.oturep, added error checking to chimera classes in...
[mothur.git] / mothur.h
index ba88f71fabffced9509deed545cecde7228b2b63..f839328cd2c304330fb18f31fb97eea531ef625a 100644 (file)
--- a/mothur.h
+++ b/mothur.h
@@ -21,6 +21,7 @@
 #include <iomanip>
 #include <fstream>
 #include <sstream>
+#include <signal.h>
 
 //exception
 #include <stdexcept>
 #include <ctime>
 #include <limits>
 
+/***********************************************************************/
 
 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
        #include <sys/wait.h>
        #include <unistd.h>
+       
+       #ifdef USE_READLINE
+               #include <readline/readline.h>
+               #include <readline/history.h>
+       #endif
+
+       //#include <readline/readline.h>
+       //#include <readline/history.h>
+#else
+       #include <conio.h> //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<string> 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