]> git.donarmstrong.com Git - mothur.git/blobdiff - mothurout.cpp
working of get.mimarkspackage and sra command
[mothur.git] / mothurout.cpp
index 0f24cb2dc362c679dd16ed0eb7c50444f07e7a6e..baa7710eddc63901f570725af70b5d847918cb11 100644 (file)
@@ -1364,8 +1364,8 @@ int MothurOut::appendFiles(string temp, string filename) {
                ifstream input;
        
                //open output file in append mode
-               openOutputFileAppend(filename, output);
-               int ableToOpen = openInputFile(temp, input, "no error");
+               openOutputFileBinaryAppend(filename, output);
+               int ableToOpen = openInputFileBinary(temp, input, "no error");
                //int ableToOpen = openInputFile(temp, input);
                
                int numLines = 0;
@@ -2755,6 +2755,33 @@ string MothurOut::getSimpleLabel(string label){
                exit(1);
        }
 }
+/***********************************************************************/
+string MothurOut::mothurGetpid(int threadID){
+       try {
+        
+        string pid = "";
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
+        
+               pid += toString(getpid()); if(debug) { mothurOut("[DEBUG]: " + pid + "\n"); }
+        //remove any weird chars
+        string pid1 = "";
+        for (int i = 0; i < pid.length(); i++) {
+            if(pid[i]>47 && pid[i]<58) { //is a digit
+                pid1 += pid[i];
+            }
+        }
+        pid = pid1;
+#else
+               pid += toString(threadID);
+#endif
+               return pid;
+       }
+       catch(exception& e) {
+               errorOut(e, "MothurOut", "mothurGetpid");
+               exit(1);
+       }
+}
+
 /***********************************************************************/
 
 bool MothurOut::isLabelEquivalent(string label1,  string label2){
@@ -2796,7 +2823,7 @@ bool MothurOut::isSubset(vector<string> bigset, vector<string> subset) {
         
                if (subset.size() > bigset.size()) { return false;  }
                
-               //check if each guy in suset is also in bigset
+               //check if each guy in subset is also in bigset
                for (int i = 0; i < subset.size(); i++) {
                        bool match = false;
                        for (int j = 0; j < bigset.size(); j++) {
@@ -3572,6 +3599,26 @@ bool MothurOut::inUsersGroups(vector<string> groupnames, vector<string> Groups)
                exit(1);
        }       
 }
+/**************************************************************************************************/
+//removes entries that are only white space
+int MothurOut::removeBlanks(vector<string>& tempVector) {
+       try {
+               vector<string> newVector;
+               for (int i = 0; i < tempVector.size(); i++) {
+            bool isBlank = true;
+            for (int j = 0; j < tempVector[i].length(); j++) {
+                if (!isspace(tempVector[i][j])) { isBlank = false; j+= tempVector[i].length(); } //contains non space chars, break out and save
+            }
+            if (!isBlank) { newVector.push_back(tempVector[i]); }
+        }
+        tempVector = newVector;
+               return 0;
+       }
+       catch(exception& e) {
+               errorOut(e, "MothurOut", "removeBlanks");
+               exit(1);
+       }
+}
 /***********************************************************************/
 //this function determines if the user has given us labels that are smaller than the given label.
 //if so then it returns true so that the calling function can run the previous valid distance.