From 219104a887d4725af80487729f4c34a030fe4358 Mon Sep 17 00:00:00 2001 From: westcott Date: Thu, 6 Aug 2009 15:14:39 +0000 Subject: [PATCH] bugs fixes while testing for 1.5 release --- readtreecommand.cpp | 1 + treemap.cpp | 21 +++++++++++++++++++++ treemap.h | 1 + 3 files changed, 23 insertions(+) diff --git a/readtreecommand.cpp b/readtreecommand.cpp index 2a3c5d0..0f07ac2 100644 --- a/readtreecommand.cpp +++ b/readtreecommand.cpp @@ -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]); } } } diff --git a/treemap.cpp b/treemap.cpp index 044e87c..e472570 100644 --- a/treemap.cpp +++ b/treemap.cpp @@ -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() { diff --git a/treemap.h b/treemap.h index 8f744c8..0824ebf 100644 --- 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 namesOfGroups; vector namesOfSeqs; -- 2.39.2