lczech / genesis

A library for working with phylogenetic and population genetic data.
http://genesis-lib.org/
GNU General Public License v3.0
57 stars 12 forks source link

Parsing multiple trees #2

Closed daviddao closed 9 years ago

daviddao commented 9 years ago

It would be super awesome to be able to parse multiple newick strings in one txt file and also ignoring tree names

Example File: 

Tree_A:
((A:2,B:3):3,D);
Tree_B:
(E:4,(A:3,C:D):3);
lczech commented 9 years ago

Already started with it.

Why is it important to ignore tree names? My approach would be to create something like a map from name to Tree object, so that users who need the names can use them, but the others just iterate over the values of the map.

daviddao commented 9 years ago

Agreed. A map would be a very elegant and also pythonic way in doing things. Forget ignoring tree names, your approach is much better!

lczech commented 9 years ago

TreeSet now has some basic methods to work with multiple trees:

Furthermore, the Newick parser can deal with files containing multiple trees and can:

It compiles, but is not (yet) tested well. Everything that does not work will be fixed as a bug in the future. Also, further methods might be added to TreeSet if needed.