//read in group map info.
treeMap = new TreeMap(globaldata->getGroupFile());
treeMap->readMap();
+
+ //memory leak prevention
+ //if (globaldata->gTreemap != NULL) { delete globaldata->gTreemap; }
globaldata->gTreemap = treeMap;
+
+ //get names in tree
+ globaldata->parseTreeFile();
read = new ReadNewickTree(filename);
int ReadTreeCommand::execute(){
try {
-
- read->read();
+ int readOk;
+
+ readOk = read->read();
+
+ if (readOk != 0) { cout << "Read Terminated." << endl; globaldata->gTree.clear(); delete globaldata->gTreemap; return 0; }
vector<Tree*> T = globaldata->gTree;
for (int i = 0; i < T.size(); i++) {
T[i]->assembleTree();
}
-T[0]->createNewickFile("treeout");
+
+ //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) {