Skip to content

Adapt combat - #149

Merged
rcannood merged 4 commits into
mainfrom
adapt_combat
Oct 27, 2026
Merged

rcannood merged 4 commits into
mainfrom
adapt_combat

Conversation

@LuLeom

@LuLeom LuLeom commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes

Re-implements methods/combat in R with sva::ComBat, replacing the Python (scanpy) version.

The reason for the switch is that sva::ComBat supports ref.batch, so batches can be corrected towards a reference batch. The scanpy implementation can't do that.

Following the convention for parameterised methods introduced in #142, combat is implemented as a single component with a --target argument and two paramsets in info.variants:

  • to_goal (--target goal): ref.batch = "1". Batch 1 is left unchanged and the other batches are corrected towards it.
  • to_mid (--target mid, default): ref.batch = NULL. All batches are corrected towards the pooled mean (like the previous implementation).

As combat does not make use of specific control samples, I am using the prefix no_controls_.

Tested via:

  • viash test src/methods/combat/config.vsh.yaml passes.
  • A manual run viash run with --target goal.

Fixes #148

Checklist before requesting a review

  • I have performed a self-review of my code

  • Check the correct box. Does this PR contain:

    • Breaking changes
    • New functionality
    • Major changes
    • Minor changes
    • Bug fixes
  • Proposed changes are described in the CHANGELOG.md

  • CI Tests succeed and look good!

@LuLeom
LuLeom requested review from ghar1821 and rcannood and a balanced review from Copilot October 20, 2026 12:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No blocking issues were identified in correction logic, output handling, or parameterised workflow integration.

No open issues 🎉

What changed in this PR

Replaces Scanpy-based ComBat with R’s sva::ComBat, enabling reference-batch correction within the existing parameterised-method workflow.

Changes:

  • Adds goal correction towards batch 1 and default mid correction across batches.
  • Declares no-control variants and switches runtime dependencies to R.
  • Documents the implementation change.
File Description
src/​methods/​combat/​script.R Implements correction targets and AnnData output.
src/​methods/​combat/​script.py Removes the Scanpy implementation.
src/​methods/​combat/​config.vsh.yaml Configures targets, variants, and R dependencies.
CHANGELOG.md Records the ComBat implementation switch.

Review effort: Balanced

@ghar1821

Copy link
Copy Markdown
Contributor

LGTM!

@rcannood
rcannood merged commit 14e1617 into main Oct 27, 2026
3 checks passed
@rcannood
rcannood deleted the adapt_combat branch October 27, 2026 12:27
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.

change ComBat implementation to sva::ComBat

4 participants