Skip to content

fix(xenium_patch): restore --min-transcripts-per-cell in stitch script#11

Merged
khersameesh24 merged 1 commit into
khersameesh24:update-nfcore-modulesfrom
an-altosian:fix/stitch-min-transcripts-pr184
Jun 27, 2026
Merged

fix(xenium_patch): restore --min-transcripts-per-cell in stitch script#11
khersameesh24 merged 1 commit into
khersameesh24:update-nfcore-modulesfrom
an-altosian:fix/stitch-min-transcripts-pr184

Conversation

@an-altosian

Copy link
Copy Markdown

What & why

XENIUM_PATCH_STITCH fails with:

xenium_patch_stitch_transcripts.py: error: unrecognized arguments: --min-transcripts-per-cell 50

Reproduced with --mode coordinate --method baysor (routes through
BAYSOR_RUN_TRANSCRIPTS_PARQUET → XENIUM_PATCH_STITCH).

Root cause: when stitch_transcripts.py was split into
xenium_patch_stitch_transcripts.py + xenium_patch_stitch_postprocess.py, the
--min-transcripts-per-cell argument and its small-cell filter were dropped from
the transcripts script — but conf/modules.config still injects the flag
(baysor_tiling_min_transcripts_per_cell, default 50). ext.args is opaque
string concatenation, so the mismatch only surfaces at runtime as an argparse
error.

This is not a container issue: pipeline bin/ scripts are staged by Nextflow
and run with the container's interpreter; sopa imports and runs fine in the
sopa_procps-ng_pyarrow image. An argparse "unrecognized arguments" message can
only come from the script's own argument definitions.

Changes

  • Restore the --min-transcripts-per-cell argument and the post-stitch
    small-cell filter (reassign sub-threshold cells' transcripts to noise, drop
    their polygons) in bin/xenium_patch_stitch_transcripts.py. The newer
    _ensure_polygon refactor in that script is preserved.
  • Repoint tests/test_xenium_patch/test_stitch_transcripts.py from the deleted
    modules/.../resources/usr/bin/ path to bin/ — it had been broken since the
    PR refactor(modules): convert all 19 module-level bin scripts to Nextflow templates nf-core/spatialaxe#154 refactor (masked by the module's stub block in CI).
  • Add TestMinTranscriptsFilter: filter behaviour, a no-op control, and a
    subprocess CLI test that reproduces the exact failing invocation.
  • Remove the orphan bin/stitch_transcripts.py (superseded, unused).

Testing

Ran inside the module's own container
community.wave.seqera.io/library/sopa_procps-ng_pyarrow:c9ce8cd2ede79d72:

15 passed in 3.89s

including the CLI test invoking the script with --min-transcripts-per-cell 50
(asserts no "unrecognized arguments", exit 0).

XENIUM_PATCH_STITCH failed with 'unrecognized arguments:
--min-transcripts-per-cell 50'. When stitch_transcripts.py was split into
xenium_patch_stitch_transcripts.py + xenium_patch_stitch_postprocess.py, the
--min-transcripts-per-cell argument and its small-cell filter were dropped from
the transcripts script, but conf/modules.config still injects the flag.

- restore the argument + post-stitch small-cell filter (reassign transcripts of
  sub-threshold cells to noise, drop their polygons)
- repoint tests/test_xenium_patch/test_stitch_transcripts.py from the deleted
  modules/.../resources/usr/bin path to bin/ (broken since the PR nf-core#154 refactor)
- add TestMinTranscriptsFilter: filter behaviour, no-op control, and a
  subprocess CLI test reproducing the exact production invocation
- remove the orphan bin/stitch_transcripts.py (superseded, unused)

Validated in the module's sopa container: 15 passed.
@khersameesh24 khersameesh24 merged commit 7b02685 into khersameesh24:update-nfcore-modules Jun 27, 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.

2 participants