]> git.donarmstrong.com Git - mothur.git/blobdiff - mothurout.cpp
added kruskal.wallis command. added worked on make.lefse. working of lefse command...
[mothur.git] / mothurout.cpp
index 96c7305b6a1fb50f42f9c2a650d0c854ccbb6f2c..1f1c96b6f203e4f1fa8b1dca2e018c735caa6b9f 100644 (file)
@@ -796,6 +796,39 @@ bool MothurOut::dirCheck(string& dirName){
        }       
     
 }
+//**********************************************************************************************************************
+
+map<string, vector<string> > MothurOut::parseClasses(string classes){
+       try {
+        map<string, vector<string> > parts;
+        
+        //treatment<Early|Late>-age<young|old>
+        vector<string> pieces; splitAtDash(classes, pieces); // -> treatment<Early|Late>, age<young|old>
+        
+        for (int i = 0; i < pieces.size(); i++) {
+            string category = ""; string value = "";
+            bool foundOpen = false;
+            for (int j = 0; j < pieces[i].length(); j++) {
+                if (control_pressed) { return parts; }
+                
+                if (pieces[i][j] == '<')        { foundOpen = true;         }
+                else if (pieces[i][j] == '>')   { j += pieces[i].length();  }
+                else {
+                    if (!foundOpen) { category += pieces[i][j]; }
+                    else { value += pieces[i][j]; }
+                }
+            }
+            vector<string> values; splitAtChar(value, values, '|');
+            parts[category] = values;
+        }
+        
+        return parts;
+    }
+       catch(exception& e) {
+               errorOut(e, "MothurOut", "parseClasses");
+               exit(1);
+       }
+}
 /***********************************************************************/
 
 string MothurOut::hasPath(string longName){