X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=readtreecommand.cpp;h=19ab67531dc96e8929b258eef2a41b4d24538bc4;hb=fb01d5df390a98313ca095a812fc240dc079d084;hp=8124d53415bda6035a3f6686d8ebc50a3ecb1419;hpb=9e07ea7484097a73e0e9ce3e379c12bfa0a4e55d;p=mothur.git diff --git a/readtreecommand.cpp b/readtreecommand.cpp index 8124d53..19ab675 100644 --- a/readtreecommand.cpp +++ b/readtreecommand.cpp @@ -20,8 +20,11 @@ ReadTreeCommand::ReadTreeCommand(){ treeMap->readMap(); //memory leak prevention - if (globaldata->gTreemap != NULL) { delete globaldata->gTreemap; } + //if (globaldata->gTreemap != NULL) { delete globaldata->gTreemap; } globaldata->gTreemap = treeMap; + + //get names in tree + globaldata->parseTreeFile(); read = new ReadNewickTree(filename); @@ -59,6 +62,23 @@ int ReadTreeCommand::execute(){ T[i]->assembleTree(); } + //output any names that are in names file but not in tree + if (globaldata->Treenames.size() < treeMap->getNumSeqs()) { + for (int i = 0; i < treeMap->namesOfSeqs.size(); i++) { + //is that name in the tree? + int count = 0; + for (int j = 0; j < globaldata->Treenames.size(); j++) { + if (treeMap->namesOfSeqs[i] == globaldata->Treenames[j]) { break; } //found it + count++; + } + + //then you did not find it so report it + if (count == globaldata->Treenames.size()) { + cout << treeMap->namesOfSeqs[i] << " is in your namefile and not in your tree. It will be disregarded." << endl; + } + } + } + return 0; } catch(exception& e) {