X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=treegroupscommand.cpp;h=fb4887c73da88c0c631895e82f05090e97645761;hb=6c2b1e530a5c0bb87040e58a3e410097acdfcc3d;hp=6633e5160559297c23a542c373ed1b1cc9a3ccdc;hpb=0cefb55a2616975bd4a144fc345693695ffc9bb6;p=mothur.git diff --git a/treegroupscommand.cpp b/treegroupscommand.cpp index 6633e51..fb4887c 100644 --- a/treegroupscommand.cpp +++ b/treegroupscommand.cpp @@ -287,7 +287,7 @@ TreeGroupCommand::~TreeGroupCommand(){ if (abort == false) { if (format == "sharedfile") { delete input; } else { delete list; } - delete tmap; + delete ct; } } @@ -400,8 +400,16 @@ int TreeGroupCommand::execute(){ m->runParse = false; //create treemap class from groupmap for tree class to use - tmap = new TreeMap(); - tmap->makeSim(m->getAllGroups()); + ct = new CountTable(); + set nameMap; + map groupMap; + set gps; + for (int i = 0; i < m->getAllGroups().size(); i++) { + nameMap.insert(m->getAllGroups()[i]); + gps.insert(m->getAllGroups()[i]); + groupMap[m->getAllGroups()[i]] = m->getAllGroups()[i]; + } + ct->createTable(nameMap, groupMap, gps); //clear globaldatas old tree names if any m->Treenames.clear(); @@ -429,22 +437,26 @@ int TreeGroupCommand::execute(){ nameMap = new NameAssignment(namefile); nameMap->readMap(); } - else{ - nameMap = NULL; - } + else{ nameMap = NULL; } readMatrix->read(nameMap); list = readMatrix->getListVector(); SparseDistanceMatrix* dMatrix = readMatrix->getDMatrix(); //make treemap - tmap = new TreeMap(); - - if (m->control_pressed) { return 0; } - - tmap->makeSim(list); + ct = new CountTable(); + set nameMap; + map groupMap; + set gps; + for (int i = 0; i < list->getNumBins(); i++) { + string bin = list->get(i); + nameMap.insert(bin); + gps.insert(bin); + groupMap[bin] = bin; + } + ct->createTable(nameMap, groupMap, gps); - vector namesGroups = tmap->getNamesOfGroups(); + vector namesGroups = ct->getNamesOfGroups(); m->setGroups(namesGroups); //clear globaldatas old tree names if any @@ -505,13 +517,12 @@ int TreeGroupCommand::execute(){ Tree* TreeGroupCommand::createTree(vector< vector >& simMatrix){ try { //create tree - t = new Tree(tmap, simMatrix); + t = new Tree(ct, simMatrix); if (m->control_pressed) { delete t; t = NULL; return t; } //assemble tree - map empty; - t->assembleTree(empty); + t->assembleTree(); return t; }