jeetsukumaran / DendroPy

A Python library for phylogenetic scripting, simulation, data processing and manipulation.
https://pypi.org/project/DendroPy/.
BSD 3-Clause "New" or "Revised" License
207 stars 62 forks source link

Bipartition.edge #123

Closed jtfield closed 4 years ago

jtfield commented 4 years ago

Hello!

i am attempting to gather information from bipartitions in trees and it would be handy to get edge information. However, i received this error:

AttributeError: 'Bipartition' object has no attribute 'edge'

Since this is specified as an option in the wiki I figured I'd ask whats happening here. Thanks in advance.

jeetsukumaran commented 4 years ago

Could you post a basic code example?

jtfield commented 4 years ago

Yup! sorry, I was moments from doing so.

`taxa = dendropy.TaxonNamespace()

mle = dendropy.Tree.get(path=args.tree_file, schema='newick', taxon_namespace=taxa)

for split in mle.bipartition_encoding: print(split.edge)`

The tree file is a generic newick tree. I can recreate a string example if that helps.

jeetsukumaran commented 4 years ago

Could you point out the place in the documentation where this is shown as the way to dereference the edge? This has to be fixed.

The correct way to dereference the edge is:

print(mle.bipartition_edge_map[split])
jtfield commented 4 years ago

Here is the pagehere I don't know how to point to a particular position on the page but its in the: 2nd paragraph of the Bipartition Encoding section

Thanks very much!

jeetsukumaran commented 4 years ago

Thanks. I will update the document to reflect the current API. Hope the above works for you in the mean time.