Skip to content

Promote a simulated count too big for int16 instead of refusing it - #4

Merged
emattei merged 3 commits into
mainfrom
fix/promote-simulated-counts
Sep 28, 2026
Merged

emattei merged 3 commits into
mainfrom
fix/promote-simulated-counts

Conversation

@emattei

@emattei emattei commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • draw_counts returned simulated counts as int16 and raised OverflowError when a draw passed 32,767. The comment assumed no real screen gets close (largest observed count 2,717).
  • DC-TAP K562 breaks that assumption. HBA2 has an observed maximum of 6,583, but sceptre's fitted mean reaches 20,104 in its most extreme cell. With θ = 2.1, about one draw in seven from that cell passes 32,767. Every simulation task on the screen failed.
  • Those are legitimate draws from the model the test assumes. draw_counts now returns the narrowest of int16, int32 or int64 that holds the largest draw. Nothing is wrapped or clipped, and any draw that fits in int16 comes back exactly as before.
  • Also syncs pixi.lock with the anndata/mudata entries that PR CI: put pysceptre's scripts/ on PYTHONPATH for the Nextflow DAG step #3 added to pyproject.toml. Without that, every pixi run rewrote the lock.

Test plan

  • pixi run -e dev pytest tests/: 78 passed. The int16 test now checks that an oversized draw comes back as int32 and equals the full-width draw.
  • One DC-TAP K562 cis simulation task (76 pairs, 100 simulations, es 0.15, CRT, --driver engine --null-fits refit, 8 workers) failed before the change and completes after it, in 171 s.

🤖 Generated with Claude Code

emattei and others added 3 commits September 28, 2026 16:06
PR #3 declared both in pyproject.toml without relocking, so every `pixi run` rewrote the lock's
metadata for the watteg package.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
sceptre's fitted mean for a very highly expressed gene can reach far past anything observed in
the cells with extreme covariates. HBA2 in DC-TAP K562 has an observed maximum of 6,583 and a
fitted mean of 20,104 in its most extreme cell, so NB(20,104, theta 2.1) passes 32,767 about one
draw in seven, and every simulation task on that screen failed with an OverflowError. Those are
legitimate draws from the model the test assumes, so draw_counts now returns the narrowest of
int16/int32/int64 that holds the largest draw. No value is wrapped or clipped, and a draw that
fits int16 is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@emattei
emattei merged commit f97fc76 into main Sep 28, 2026
1 check 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