feat: add mixscale continuous perturbation scoring#945
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #945 +/- ##
==========================================
+ Coverage 73.54% 77.81% +4.26%
==========================================
Files 48 50 +2
Lines 5613 6580 +967
==========================================
+ Hits 4128 5120 +992
+ Misses 1485 1460 -25
🚀 New features to boost your workflow:
|
Zethson
left a comment
There was a problem hiding this comment.
Hi,
thanks for the contribution! I'd very happy to get this feature merged eventually.
This looks a bit AI generated. Could you please disclose that? There's a few things that the contributing guide outlines that was missed. It would be awesome if you could have another look, please.
Some initial feedback:
- Should this be in the mixscape code base or should this be its own Tool? Even from a user perspective.
- This also needs to show up in the tutorials. Maybe a general version of mixscape & mixscale? We might need a new term then.
- We should likely also point this out clearer in our documentation which pretty much just mentions mixscale for now.
- The ground truth is the R implementation. Could you please compare your version against the R version? We did the same for mixscape. They should be as close as possible.
|
Hey thanks for taking a look! I ended up overlooking your styling conventions in the process. A separate tool suggestion is a good shout actually... probably makes more sense architecturally. I will swing back to this when I get a chance! Have a great day. |
|
@stefanm808 very kind check in - is there anything you'd need from me to revive this PR? Thanks! |
|
@stefanm808 I might take this PR over next week unless you want to finish it? |
Adds pt.tl.Mixscale for continuous per-cell perturbation scoring (Jiang et al., Nature Cell Biology 2025), matching the satijalab/Mixscale R implementation to floating-point precision. Mixscape is refactored into a _mixscape/ package: a shared PerturbationScreenAnalyzer base (perturbation_signature + DE marker detection) with Mixscape (binary) and Mixscale (continuous) as siblings. pt.tl.Mixscape is unchanged. Builds on scverse#945. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
d2b3f48 to
601afb9
Compare
Adds pt.tl.Mixscale for continuous per-cell perturbation scoring (Jiang et al., Nature Cell Biology 2025), matching the satijalab/Mixscale R implementation to floating-point precision. Mixscape is refactored into a _perturbation_efficacy package: a shared PerturbationEfficacyAnalyzer base (perturbation_signature + DE marker detection) with Mixscape (binary) and Mixscale (continuous) as siblings. pt.tl.Mixscape is unchanged. Renames the tutorial to perturbation_efficacy and bumps the pertpy-tutorials submodule to the matching commit (scverse/pertpy-tutorials#64). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
OK I think this PR is now ready. Thank you very much @stefanm808 for your initial work! I hope you're happy with the outcome. Please feel free to have a look and propose any improvements if necessary. |
Implements the Mixscale scoring method (Jiang et al., Nat Cell Biol 2025) as a new method on the Mixscape class. Unlike the binary KO/NP classification in mixscape(), mixscale() computes a continuous perturbation efficiency score per cell likescalar projection onto the estimated perturbation direction vector.
Reuses existing _get_perturbation_markers() pipeline for DE gene detection and follows the same code patterns as mixscape() for split handling, layer access & scaling.
Closes #921 (partial - continuous scoring component)
PR Checklist
Description of changes
Added
Mixscape.mixscale()for continuous perturbation efficiency scoring, implementing the method from Jiang, Dalgarno et al., Nature Cell Biology (2025). Unlike the binary KO/NP classification inmixscape(),mixscale()computes a continuous perturbation efficiency score per cell via scalar projection onto the estimated perturbation direction vector. This is particularly useful for CRISPRi/CRISPRa screens where cells exhibit a gradient of perturbation responses.Usage:
Technical details
Algorithm:
_get_perturbation_markers()pipeline for DE gene detectionFollows the same code patterns as
mixscape()for split handling, layer access, and scaling. No new dependencies added. 9 new tests added, all 5 existing Mixscape tests still pass.Additional context
This addresses item 1 (continuous perturbation scoring) from #921. Items 2-4 (weighted DE, decomposition, program signatures) are planned for follow-up PRs.