Add sanity check for two layers needed for IntegrateLayers#10396
Open
cyrillustan wants to merge 1 commit into
Open
Add sanity check for two layers needed for IntegrateLayers#10396cyrillustan wants to merge 1 commit into
cyrillustan wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
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.
| 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" | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Taking the suggestion from issue #9381 on including a sanity check for at least 2-layers in the input for IntegrateLayers() function.