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
210 stars 61 forks source link

Option to give leaf nodes in polytomies a default order in Tree.ladderize. #186

Closed davipatti closed 3 months ago

davipatti commented 7 months ago

I added this option to reduce unnecessary cross overs in tangle plots of trees that have polytomies.

mmore500 commented 7 months ago

@davipatti thank you for the contribution! I’m hoping to follow up and review it this upcoming week 👍

mmore500 commented 6 months ago

@davipatti — do you think similar functionality could be achieved by sorting the tip polytomies before the ladderization process?

davipatti commented 4 months ago

@davipatti — do you think similar functionality could be achieved by sorting the tip polytomies before the ladderization process?

@mmore500 sorry for being slow to reply. I guess that could also work. This seemed like a more explicit approach.

codecov-commenter commented 3 months ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 88.69%. Comparing base (cbf8ce8) to head (0cc1255).

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #186 +/- ## ======================================= Coverage 88.69% 88.69% ======================================= Files 114 114 Lines 12817 12817 ======================================= Hits 11368 11368 Misses 1449 1449 ``` | [Flag](https://app.codecov.io/gh/jeetsukumaran/DendroPy/pull/186/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jeet+Sukumaran) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/jeetsukumaran/DendroPy/pull/186/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jeet+Sukumaran) | `88.69% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jeet+Sukumaran#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

mmore500 commented 3 months ago

@davipatti I ended up pushing to the wrong branch by accident, so this pull request ended up closing sooner than I intended without being able to run suggestions by.

I implemented a "reorder" function that, by default, sorts by label. I added a note to the documentation suggesting that ladderization sort is stable, so to control order within ladderization, call reorder before ladderizing. Let me know if this covers your use case.