]> git.donarmstrong.com Git - mothur.git/blobdiff - mothurout.cpp
bugs found while testing
[mothur.git] / mothurout.cpp
index d5f1534f7535052c75888b04d28211fd522a0410..0431d36796dd32cf4ac404dee2843150a4b5b110 100644 (file)
@@ -40,6 +40,7 @@ void MothurOut::printCurrentFiles()  {
                if (taxonomyfile != "")         {  mothurOut("taxonomy=" + taxonomyfile); mothurOutEndLine();           }
                if (treefile != "")                     {  mothurOut("tree=" + treefile); mothurOutEndLine();                           }
                if (flowfile != "")                     {  mothurOut("flow=" + flowfile); mothurOutEndLine();                           }
+        if (biomfile != "")                    {  mothurOut("biom=" + biomfile); mothurOutEndLine();                           }
                if (processors != "1")          {  mothurOut("processors=" + processors); mothurOutEndLine();           }
                
        }
@@ -73,6 +74,7 @@ bool MothurOut::hasCurrentFiles()  {
                if (taxonomyfile != "")         {  return true;                 }
                if (treefile != "")                     {  return true;                 }
                if (flowfile != "")                     {  return true;                 }
+        if (biomfile != "")                    {  return true;                 }
                if (processors != "1")          {  return true;                 }
                
                return hasCurrent;
@@ -107,6 +109,7 @@ void MothurOut::clearCurrentFiles()  {
                accnosfile = "";
                taxonomyfile = "";      
                flowfile = "";
+        biomfile = "";
                processors = "1";
        }
        catch(exception& e) {
@@ -1014,7 +1017,8 @@ int MothurOut::appendFiles(string temp, string filename) {
                
                int numLines = 0;
                if (ableToOpen == 0) { //you opened it
-                       while(char c = input.get()){
+                       while(!input.eof()){
+                char c = input.get();
                                if(input.eof())         {       break;                  }
                                else                            {       output << c;    if (c == '\n') {numLines++;} }
                        }
@@ -1444,7 +1448,8 @@ map<string, int> MothurOut::readNames(string namefile) {
                        if (control_pressed) { break; }
                        
                        string firstCol, secondCol;
-                       in >> firstCol >> secondCol; gobble(in);
+                       in >> firstCol;  gobble(in);
+            in >> secondCol; gobble(in);
                        
                        int num = getNumNames(secondCol);
                        
@@ -1961,6 +1966,25 @@ void MothurOut::splitAtComma(string& estim, vector<string>& container) {
                exit(1);
        }       
 }
+/***********************************************************************/
+//This function splits up the various option parameters
+void MothurOut::splitAtChar(string& prefix, string& suffix, char c){
+       try {
+               prefix = suffix.substr(0,suffix.find_first_of(c));
+               if ((suffix.find_first_of(c)+2) <= suffix.length()) {  //checks to make sure you don't have comma at end of string
+                       suffix = suffix.substr(suffix.find_first_of(c)+1, suffix.length());
+                       string space = " ";
+                       while(suffix.at(0) == ' ')
+                               suffix = suffix.substr(1, suffix.length());
+               }
+        
+       }
+       catch(exception& e) {
+               errorOut(e, "MothurOut", "splitAtComma");
+               exit(1);
+       }       
+}
+
 /***********************************************************************/
 
 //This function splits up the various option parameters