Skip to content

fix: prevent markers.csv duplication in multi-sample runs (#165) - #166

Draft
adamjtaylor wants to merge 2 commits into
nf-core:devfrom
adamjtaylor:fix/165-multisample-marker-duplication
Draft

fix: prevent markers.csv duplication in multi-sample runs (#165)#166
adamjtaylor wants to merge 2 commits into
nf-core:devfrom
adamjtaylor:fix/165-multisample-marker-duplication

Conversation

@adamjtaylor

Copy link
Copy Markdown
Contributor

Fixes #165.

  • Multi-sample runs where samples differed in exposure time inflated the shared markers.csv with duplicate rows (44 → 64 in the reported case), causing MCQUANT to abort with "number of channels doesn't match".
  • UPDATE_FROM_OME now groups markers by (cycle_number, channel_number) and collapses to one row per image channel, instead of .unique() over whole maps that still carried per-sample exposure_time.
  • Samples disagreeing on a cycle's channel count now fail with a clear error rather than silently duplicating.
  • Added a defense-in-depth check that the final sheet is contiguously numbered 1..N, and removed the previous list-level guards that never fired.
  • Added two nf-test regression cases (exposure-differs, channel-count-mismatch); existing single-sample snapshot unchanged.

🤖 Generated with Claude Code

adamjtaylor and others added 2 commits July 17, 2026 18:59
… runs (nf-core#165)

Multi-sample runs failed in MCQUANT with "number of channels in markers.csv
doesn't match the image" whenever samples differed in a per-sample field.

Two independent causes, both fixed here:

- The shared markersheet was deduplicated with `.unique()` on the whole marker
  map, which includes per-sample fields (exposure_time/_unit). Any difference
  left duplicate rows, inflating markers.csv beyond the image channel count.
  Now rows are grouped by (cycle_number, channel_number) and collapsed to one
  shared row per channel; samples may differ in exposure (validated separately
  for backsub), but must agree on the marker definition.

- The per-cycle channel offset uniqued (cycle_number, channel_count) pairs, so
  samples disagreeing on a cycle's channel count silently produced duplicate
  offsets and duplicated markers. This is now a clear, actionable error.

Adds a defense-in-depth assertion that the final markers.csv has exactly one
contiguously numbered row (1..N) per image channel. Also removes the previous
inter-sample/backsub checks, which operated on the whole list rather than
individual rows and never fired.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ore#165)

Two nf-test cases exercising the multi-sample paths that previously produced a
malformed markers.csv:

- samples differing in exposure time must collapse to one row per image channel
  (regression against the 44 -> 64 row duplication)
- samples disagreeing on a cycle's channel count must fail with a clear error

Both feed small committed OME-XML fixtures straight to the xml input so they run
OMEVALIDATION natively without a container. The existing single-sample snapshot
is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nf-core-bot

Copy link
Copy Markdown
Member

Warning

Newer version of the nf-core template is available.

Your pipeline is using an old version of the nf-core template: 3.5.1.
Please update your pipeline to the latest version.

For more documentation on how to update your pipeline, please see the Synchronisation documentation.

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.

Multi-sample runs: UPDATE_FROM_OME duplicates markers when samples differ in exposure time

2 participants