popsim-consortium / demes-python

Tools for describing and manipulating demographic models.
https://popsim-consortium.github.io/demes-docs/
ISC License
19 stars 6 forks source link

read newick format #82

Open mufernando opened 4 years ago

mufernando commented 4 years ago

It would be cool to be able to import a Newick tree (with or without node ages) to form a base Deme object that can then be annotated with other details (split times, population sizes, etc).

Similar to msprimes feature: https://msprime.readthedocs.io/en/latest/tutorial.html#parsing-species-trees

I can definitely lend a hand if needed.

great work so far btw!!

grahamgower commented 4 years ago

Thanks @mufernando, that seems very doable!

jeromekelleher commented 4 years ago

Good idea. One downside though is that we start adding dependencies. We're using the newick package in msprime which is pretty lightweight, but it doesn't support extended newick, which would ultimately be needed to do this properly.

Still, it seems worth it, and we can mostly just copy the code from msprime I think.

grahamgower commented 4 years ago

For any GPL code we want to copy from msprime, we'll have to explicitly contact the original authors to check they're happy to have their code modified and more permissively licensed for inclusion in demes.

$ git blame species_trees.py -c | cut -f2 | sed 's/(//' | sort -u
Ben Jeffery
Jerome Kelleher
Michael Matschiner
jeromekelleher commented 4 years ago

I'm confident that we can get this approval.