X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=treemap.cpp;h=75423855a7f583ae5ce62fc10118cf260589df6b;hb=c651c46022761aef61644f78462365d8f767ff0b;hp=b2fc591c0adb24820d6f603bd8016154ad1c626c;hpb=260ae19c36cb11a53ddc5a75b5e507f8dd8b31d6;p=mothur.git diff --git a/treemap.cpp b/treemap.cpp index b2fc591..7542385 100644 --- a/treemap.cpp +++ b/treemap.cpp @@ -44,6 +44,21 @@ void TreeMap::readMap() { 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 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++) {