Fix dependency-gated validation flow in DE/SCTransform/Numbat paths#23
Draft
Fix dependency-gated validation flow in DE/SCTransform/Numbat paths#23
Conversation
Agent-Logs-Url: https://github.com/cafferychen777/ChatSpatial/sessions/751ab6cf-839c-430e-8fcd-78c992090f70 Co-authored-by: cafferychen777 <82987086+cafferychen777@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Check for bugs in the application
Fix dependency-gated validation flow in DE/SCTransform/Numbat paths
Apr 3, 2026
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.
Description
This PR addresses multiple concrete failure paths found during detailed bug inspection, where optional dependency imports preempted expected validation errors or produced unstable behavior under mocked environments.
The changes are surgical and focused on restoring correct error semantics and deterministic control flow.
Type of Change
Related Issues
N/A
Changes Made
Added/modified spatial analysis methods
Updated MCP server functionality
Improved data preprocessing
Enhanced visualization capabilities
Updated documentation
Added tests
Other: Fixed dependency/validation ordering and import robustness in optional-tool paths
Differential expression (
_run_pydeseq2)pydeseq2import from function entry to post-precondition stage.pydeseq2is not installed.Preprocessing (
normalization="sct")rpy2import.DependencyErrorguidance whenrpy2is unavailable instead of generic processing failure.CNV Numbat path (
_infer_cnv_numbat)rpy2submodule resolution (sys.modules+importlib) for compatibility with test-time module stubbing.rpy2 not installed) for downstream expectations.Focused test update
rpy2module stub intest_infer_cnv_numbat_requires_allele_dataframeto make the mocked import graph complete and deterministic.Testing
Checklist
Screenshots (if applicable)
N/A (no UI changes)
Additional Notes
This PR intentionally avoids unrelated cleanup and keeps scope to bug-reproducing paths only.