I have created a cophenetic distance matrix in dendropy using:
from dendropy.simulate import treesim
tree = treesim.birth_death_tree(birth_rate=1.0, death_rate=0.5, ntax=10)
pdm = tree.phylogenetic_distance_matrix()
However, having read the documentation and trying many things I cannot extract the actual matrix in a usable manner from the object "pdm"
NB there is a method as_data_table
with this class that I am also unable to fathom
as_data_table()
returns an object of typedendropy.utility.container.DataTable
. ThisDataTable
is a custom container class, which implements lots of useful methods you can use to get at your data. You can read the source here to understand it:https://dendropy.org/_modules/dendropy/utility/container.html
You can very quickly see the data in a format you can understand by looking at its
_data
variable:Outputs: