]> git.donarmstrong.com Git - mothur.git/blobdiff - counttable.cpp
fixed subsample name file name issue. added count parameter to cluster command....
[mothur.git] / counttable.cpp
index f632731cd8892da29469b31fdefe80d9557b52a0..a664228b17c35fff4ce48ca0ea5255b5b99bb1f3 100644 (file)
@@ -158,7 +158,41 @@ int CountTable::getNumSeqs(string seqName) {
        }
 }
 /************************************************************/
-//returns names of seqs
+//returns unique index for sequence like get in NameAssignment
+int CountTable::get(string seqName) {
+    try {
+        
+        map<string, int>::iterator it = indexNameMap.find(seqName);
+        if (it == indexNameMap.end()) {
+            m->mothurOut("[ERROR]: " + seqName + " is not in your count table. Please correct.\n"); m->control_pressed = true;
+        }else { return it->second; }
+        
+        return -1;
+    }
+       catch(exception& e) {
+               m->errorOut(e, "CountTable", "get");
+               exit(1);
+       }
+}
+/************************************************************/
+//create ListVector from uniques
+ListVector CountTable::getListVector() {
+    try {
+        ListVector list(indexNameMap.size());
+        for (map<string, int>::iterator it = indexNameMap.begin(); it != indexNameMap.end(); it++) { 
+            if (m->control_pressed) { break; }
+            list.set(it->second, it->first); 
+        }
+        return list;
+    }
+       catch(exception& e) {
+               m->errorOut(e, "CountTable", "getListVector");
+               exit(1);
+       }
+}
+
+/************************************************************/
+//returns the names of all unique sequences in file
 vector<string> CountTable::getNamesOfSeqs() {
     try {
         vector<string> names;