]> git.donarmstrong.com Git - mothur.git/blobdiff - treemap.cpp
added getCommandInfoCommand for gui
[mothur.git] / treemap.cpp
index dcef7f7c19174f1aaf6a1435931c9005f986f638..75423855a7f583ae5ce62fc10118cf260589df6b 100644 (file)
@@ -13,7 +13,7 @@
 
  TreeMap::TreeMap(string filename) {
        groupFileName = filename;
-       openInputFile(filename, fileHandle);
+       m->openInputFile(filename, fileHandle);
 }
 
 /************************************************************/
@@ -39,11 +39,26 @@ void TreeMap::readMap() {
                                seqsPerGroup[seqGroup]++;
                        }
 
-                       gobble(fileHandle);
+                       m->gobble(fileHandle);
                }
                fileHandle.close();
 }
 /************************************************************/
+void TreeMap::addSeq(string seqName, string seqGroup) {
+       
+               namesOfSeqs.push_back(seqName);
+               setNamesOfGroups(seqGroup);
+                                       
+               treemap[seqName].groupname = seqGroup;  //store data in map
+                       
+               it2 = seqsPerGroup.find(seqGroup);
+               if (it2 == seqsPerGroup.end()) { //if it's a new group
+                       seqsPerGroup[seqGroup] = 1;
+               }else {//it's a group we already have
+                       seqsPerGroup[seqGroup]++;
+               }
+}
+/************************************************************/
 void TreeMap::removeSeq(string seqName) {
        
        //erase name from namesOfSeqs
@@ -155,13 +170,13 @@ void TreeMap::print(ostream& output){
 }
 
 /************************************************************/
-void TreeMap::makeSim(GroupMap* groupmap) {
+void TreeMap::makeSim(vector<string> ThisnamesOfGroups) {
        try {
                //set names of groups
-               namesOfGroups = groupmap->namesOfGroups;
+               namesOfGroups = ThisnamesOfGroups;
                
                //set names of seqs to names of groups
-               namesOfSeqs = groupmap->namesOfGroups;
+               namesOfSeqs = ThisnamesOfGroups;
                
                // make map where key and value are both the group name since that what the tree.shared command wants
                for (int i = 0; i < namesOfGroups.size(); i++) {