Anchor-mode HIV rendering, palette/NT-ruler/V1V2 extensions, row labels, multi-panel fixes#1
Conversation
…margin - render_panels now stacks panels with patchworklib instead of overwriting - Derive shared inches-per-data-unit scale from tallest panel so chrome (regions, markers, ref rows) is identical physical size across panels - Only last panel draws the legend (show_footer parameter) - Set patchworklib margin to 0 for flush panel stacking - Fix panel_figsize to account for extra_ref_rows - Add _data_height helper mirroring _draw_panel coordinate system - Add figsize/show_footer params to to_patchwork for composition control
Extend Panel with optional secondary_ref_row + heterologous_color so the renderer can flag cells where a sample matches a secondary reference (e.g. another lineage's parental) but differs from the primary reference. Useful for visualizing heterologous-recombination evidence in pixel panels. - models.Panel: secondary_ref_row + heterologous_color (default #FF6F00) - hiv.hiv_panel: secondary_ref_path param; reads single-record FASTA, asserts length matches alignment columns - renderer._draw_panel: three-way comparison before mismatch coloring, legend gains "Heterologous" entry when secondary ref is present - 7 new tests covering match/pure-mismatch/heterologous classification, short-secondary fallback, end-to-end hiv_panel integration, and length-mismatch error path
…ny round 1) resolves: scrutiny-m2 blocker #2 (ruler below region bar)
… (scrutiny round 1)
resolves: scrutiny-m2 blocker #3
Adds a row_label_mode field to Panel with three modes:
- group_rollup (default; preserves existing '{name} ({count})' labels)
- per_row_numbered ('{N}. {short_seqid}' with N monotonic per panel)
- raw_seqid ('{short_seqid}' only)
Reference rows (extra_ref_rows and the primary ref labelled by
panel.label) are ALWAYS drawn with their logical label and never
numbered, regardless of mode. short_seqid truncates to
row_label_max_chars (default 30).
Threads row_label_mode + row_label_max_chars through hiv_panel().
Adds compute_row_labels() helper exposing the label list in render
order for tests. Adds TestRowLabelMode suite in
tests/test_hiv_panel_extensions.py (9 new tests, 85/85 total).
Adds tpixel.anchors with bundled lineage→HxB2 maps (CH505, SF162p3, T250-4) so hiv_panel can place the region bar even when the alignment lacks an HxB2 row. New CLI/API surface: * hiv_panel: anchor_id, anchor_lineage, show_variant_labels, show_markers * CLI: --anchor-id, --anchor-lineage, --variant-labels, --markers/--no-markers * hxb2_variant_labels(): K169E-style mutation labels vs HxB2 * hxb2_col_labels(): always include first mapped column tick * hxb2_regions(): absorb gap columns instead of fragmenting bar * renderer: uuid-suffixed brick labels (fixes patchworklib reuse error across multiple render_panels calls in one process); footer height bump for legend clearance; font-size tweaks Package data: anchor reference fastas shipped via setuptools package-data declaration. Tests fixtures trimmed to 10 records each (full alignment width preserved) — repo no longer carries large sequence sets. .gitignore: add refs/, restore tests/output/, drop dead prototype entries.
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
hiv_paneland CLI now render HIV Env alignments without anHxB2row by mapping a known lineage_ref(CH505 / SF162p3 / T250-4) onto bundled per-lineage HxB2 references. Newtpixel.anchorsmodule + package data.K169E-style mutation labels under the x-axis, computed against HxB2 (works in both classic and anchor mode).--markers/--no-markersto suppress PNGS dots.secondary_ref_rowfor three-way classification (match / mismatch-vs-primary / heterologous-vs-secondary).hiv_panelpalette overrides with adjacent same-color region merging.row_label_modesupportsgroup_rollup,per_row_numbered,raw_seqid._labelsetreuse error across multiplerender_panelscalls in one process).tests/data/*.fastacut to 10 records each; full alignment width preserved. Repo no longer carries large sequence sets..gitignorecleanup — addrefs/, restoretests/output/, drop dead prototype entries.Test plan
pytest tests/— 125 passedtpixel <CH505 alignment> --hiv -o out.pngtpixel <T205-4 fasta> --hiv --anchor-lineage T250-4 -o out.pngtpixel <alignment> --hiv --variant-labels -o out.png