Skip to content

Add sanity check for two layers needed for IntegrateLayers#10396

Open
cyrillustan wants to merge 1 commit into
mainfrom
issue_9381
Open

Add sanity check for two layers needed for IntegrateLayers#10396
cyrillustan wants to merge 1 commit into
mainfrom
issue_9381

Conversation

@cyrillustan

Copy link
Copy Markdown
Contributor

Taking the suggestion from issue #9381 on including a sanity check for at least 2-layers in the input for IntegrateLayers() function.

Copilot AI review requested due to automatic review settings May 21, 2026 19:40
@cyrillustan cyrillustan linked an issue May 21, 2026 that may be closed by this pull request

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.

Pull request overview

Adds a guardrail to IntegrateLayers() to fail fast when the input assay does not contain enough groups/layers to meaningfully run integration, addressing the failure mode described in issue #9381.

Changes:

  • Add a sanity check in IntegrateLayers() to require at least 2 groups/layers before running the chosen integration method.
  • Add a unit test ensuring an informative error is raised when a v5 assay is split into only a single layer.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
R/integration5.R Adds preflight validation of group/layer count for IntegrateLayers() with an explicit error message.
tests/testthat/test_integration5.R Adds a regression test verifying IntegrateLayers() errors on single-layer v5 assay inputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/integration5.R
abort(message = "'assay' must be a v5 or SCT assay")
}
n.groups <- if (inherits(x = object[[assay]], what = 'SCTAssay')) {
length(levels(x = object[[assay]]))
new.reduction = "integrated"
),
regexp = "at least two groups/layers"
)
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.

Error in IntegrateLayers after subsetting Seurat object

2 participants