Skip to content

Pool replicate samples instead of refusing the run - #6

Merged
mzueva merged 1 commit into
mainfrom
mzueva/merge-replicate-samples
Aug 31, 2026
Merged

Pool replicate samples instead of refusing the run#6
mzueva merged 1 commit into
mainfrom
mzueva/merge-replicate-samples

Conversation

@mzueva

@mzueva mzueva commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Greptile Summary

This PR replaces the duplicate-sample refusal with replicate pooling and exposes pooling details through the manifest, CLI report, and run-statistics UI. Important touched terms:

  • Replicate sample — an additional sample sharing a condition-and-gate group; it is now pooled instead of causing refusal.
  • Pooled group — a condition-and-gate group containing multiple samples; the new PooledGroup type records its condition, gate, sample IDs, and fraction disagreement.
  • Sort fraction — normalized per-gate cell yield used for corrected scoring; replicate values are now averaged, although the current ordering can conceal invalid original values.
  • Run manifest — the computation-to-model result contract; it now includes pooledGroups.
  • Sample label — the user-facing name associated with a sample-axis ID; new model outputs let the statistics dialog resolve pooled sample IDs to labels.
  • Read distribution — per-variant, per-gate display data; pooling restores one row per (variantKey, gate) for replicated gates.

Confidence Score: 4/5

The fraction-validation ordering should be fixed before merging because replicated inputs can conceal invalid per-sample values and produce corrected scores.

Replicate fractions are reduced to a non-null mean before the existing presence and range checks run, so an invalid original value can become an accepted pooled value.

Files Needing Attention: software/src/pooling.py, software/src/pipeline.py, software/src/validate.py

Important Files Changed

Filename Overview
software/src/pooling.py Adds replicate read and metadata aggregation, but averaging before validation can hide invalid per-sample fractions.
software/src/pipeline.py Inserts pooling before validation and scoring and adds pooled-group details to the manifest.
software/src/validate.py Removes duplicate-sample refusal and validates only the post-pooling fraction values.
model/src/types.ts Adds the typed pooled-group manifest contract.
model/src/index.ts Publishes the sample-label frame and column identifier used by the UI.
ui/src/components/RunStatistics.vue Displays pooling warnings and resolves sample IDs to user-facing labels with a raw-ID fallback.
software/tests/unit/test_pooling.py Thoroughly covers pooling grain, read sums, reporting, fraction averaging, and distribution uniqueness, but not invalid raw fractions masked by averaging.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Selected-gate read rows] --> B[Group replicate samples]
  B --> C[Sum reads by condition, gate, and variant]
  B --> D[Average replicate sort fractions]
  C --> E[Pooled reads table]
  D --> E
  E --> F[Validate pooled fractions]
  F --> G[Score retained conditions]
  G --> H[Score and distribution files]
  B --> I[pooledGroups report]
  H --> J[Run manifest]
  I --> J
  J --> K[CLI report and Run Statistics UI]
Loading

Fix all with Greploop Fix All in Claude Code

Prompt To Fix All With AI
### Issue 1
software/src/pooling.py:78
**Averaging bypasses fraction validation**

When a replicated gate contains an invalid sort fraction alongside a valid value, `pool_replicates` averages the raw values before validation; for example, `1.5` and `0.5` become the accepted value `1.0`. The subsequent presence and range checks therefore cannot identify the invalid sample, causing corrected scoring to proceed with input that should have been refused.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "Pool replicate samples instead of refusi..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Context used (5)

Comment thread software/src/pooling.py
@mzueva
mzueva merged commit 3c17fd2 into main Aug 31, 2026
13 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