Add ZOMBI2 integration: read zombi2 output, draw gene-family reconciliations#6
Merged
Conversation
…iations New phylustrator.zombi2 module reads a ZOMBI2 (github.com/AADavin/zombi2) Genomes.write() output folder and draws a gene family's history on the time-calibrated species tree. Because the layout uses x = time, transfers are placed at their true time on both branches (plot_transfers mode="time") and so render horizontal in time; originations/duplications/losses become branch markers at the exact time they occurred. API (file-based; Phylustrator never imports zombi2): - load(output_dir) -> Zombi2Data(species_tree, events, transfers); the species tree is annotated with time_from_origin per node. - draw_reconciliation(data_or_path, family, ...) -> VerticalTreeDrawer. - event_markers() / transfer_records() lower-level helpers. Exposed as the phylustrator.zombi2 submodule. Tests build a minimal ZOMBI2-format fixture in tmp_path (self-contained, no zombi2 dependency): 10 tests, full suite 195 passing, ruff clean. Docs: guide/zombi2.md + api/zombi2.md + nav + changelog. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
phylustrator.zombi2, a file-based adapter that reads ZOMBI2 output and draws a gene family's reconciliation on the time-calibrated species tree. Because the layout usesx = time, transfers are placed at their true time on both branches (plot_transfers(mode="time")) and render horizontal in time; originations / duplications / losses become branch markers at the exact time they happened.Phylustrator never imports ZOMBI2 — it only reads the files ZOMBI2 writes, so the two stay decoupled.
API
zombi2.load(output_dir) -> Zombi2Data(species_tree, events, transfers)— parses aGenomes.write()folder (species_tree.nwk+gene_family_events/*.tsv+Transfers.tsv); the species tree is annotated withtime_from_originper node.zombi2.draw_reconciliation(data_or_path, family, ...) -> VerticalTreeDrawer— overlays O/D/L markers + time-placed transfer arcs; returns the drawer for further customisation /save_svg/save_png.zombi2.event_markers()/zombi2.transfer_records()— lower-level helpers.Changes
src/phylustrator/zombi2.py, exposed as thephylustrator.zombi2submodule.tests/tests_zombi2.py— 10 tests, building a minimal ZOMBI2-format fixture intmp_path(no zombi2 dependency, no committed data).docs/guide/zombi2.md+docs/api/zombi2.md+ mkdocs nav + CHANGELOG.Purely additive (7 files, +496 lines, 0 deletions); changes no existing behaviour.
Testing
🤖 Generated with Claude Code