]> git.donarmstrong.com Git - mothur.git/commitdiff
bugs fixes while testing for 1.5 release
authorwestcott <westcott>
Thu, 6 Aug 2009 15:14:39 +0000 (15:14 +0000)
committerwestcott <westcott>
Thu, 6 Aug 2009 15:14:39 +0000 (15:14 +0000)
readtreecommand.cpp
treemap.cpp
treemap.h

index 2a3c5d0cdf264ce0c4ecf614b4c3fd46d0ffe51c..0f07ac2f6d66bb1e68c322f74ddfc326b9d3f47e 100644 (file)
@@ -119,6 +119,7 @@ int ReadTreeCommand::execute(){
                                //then you did not find it so report it 
                                if (count == globaldata->Treenames.size()) { 
                                        mothurOut(treeMap->namesOfSeqs[i] + " is in your namefile and not in your tree. It will be disregarded."); mothurOutEndLine();
+                                       treeMap->removeSeq(treeMap->namesOfSeqs[i]);
                                }
                        }
                }
index 044e87ca6c603f8762edc863e5adf827ede73bad..e472570895414a4ec535e10c5f02bee10dfea982 100644 (file)
@@ -44,6 +44,27 @@ void TreeMap::readMap() {
                fileHandle.close();
 }
 /************************************************************/
+void TreeMap::removeSeq(string seqName) {
+       
+       //erase name from namesOfSeqs
+       for (int i = 0; i < namesOfSeqs.size(); i++) {
+               if (namesOfSeqs[i] == seqName)  {
+                       namesOfSeqs.erase (namesOfSeqs.begin()+i);
+                       break;
+               }
+       }
+       
+       //decrement sequences in this group
+       string group = treemap[seqName].groupname;
+       seqsPerGroup[group]--;
+       
+       //remove seq from treemap
+       it = treemap.find(seqName);
+       treemap.erase(it);
+       
+
+}
+/************************************************************/
 
 int TreeMap::getNumGroups() {
                        
index 8f744c80a3e92873699aca320032cedeea59a007..0824ebf7f7e6cd109db4d3adb344c46d09738b21 100644 (file)
--- a/treemap.h
+++ b/treemap.h
@@ -34,6 +34,7 @@ public:
        void setIndex(string, int);  //sequencename, index
        int getIndex(string);           //returns vector index of sequence
        bool isValidGroup(string);  //return true if string is a valid group
+       void removeSeq(string);  //removes a sequence, this is to accomadate trees that do not contain all the seqs in your groupfile
        string getGroup(string);
        vector<string> namesOfGroups;
        vector<string> namesOfSeqs;