Skip to content

Add ZOMBI2 integration: read zombi2 output, draw gene-family reconciliations#6

Merged
AADavin merged 1 commit into
mainfrom
zombi2-integration
Jul 3, 2026
Merged

Add ZOMBI2 integration: read zombi2 output, draw gene-family reconciliations#6
AADavin merged 1 commit into
mainfrom
zombi2-integration

Conversation

@AADavin

@AADavin AADavin commented Jul 3, 2026

Copy link
Copy Markdown
Owner

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 uses x = 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 a Genomes.write() folder (species_tree.nwk + gene_family_events/*.tsv + Transfers.tsv); the species tree is annotated with time_from_origin per 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

  • New src/phylustrator/zombi2.py, exposed as the phylustrator.zombi2 submodule.
  • tests/tests_zombi2.py — 10 tests, building a minimal ZOMBI2-format fixture in tmp_path (no zombi2 dependency, no committed data).
  • Docs: docs/guide/zombi2.md + docs/api/zombi2.md + mkdocs nav + CHANGELOG.

Purely additive (7 files, +496 lines, 0 deletions); changes no existing behaviour.

Testing

  • Full suite 195 passing (10 new), ruff clean.
  • Verified end-to-end on real ZOMBI2 output — a gene family with two transfers renders with both transfers consistent in time.

🤖 Generated with Claude Code

…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>
@AADavin AADavin merged commit e813190 into main Jul 3, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant