]> git.donarmstrong.com Git - mothur.git/blobdiff - readtreecommand.cpp
fixed bug in read.tree updates help and validparameters strings, added ability for...
[mothur.git] / readtreecommand.cpp
index 6af28ad7788a351e1a320aaf433c800c2c529f1b..19ab67531dc96e8929b258eef2a41b4d24538bc4 100644 (file)
@@ -22,6 +22,9 @@ ReadTreeCommand::ReadTreeCommand(){
                //memory leak prevention
                //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) {