Conversation
elhb
force-pushed
the
PNA-3532
branch
2 times, most recently
from
September 23, 2026 07:20
adc2abc to
71a7191
Compare
Keep mean difference on the original matrix, like PixelatorR RunDAA. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
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
Makes
differential_abundancevalid on signed CLR.differenceis stillmean(target) - mean(reference)on the originalmatrix, matching PixelatorR
RunDAA(fc.name = "difference"). Wilcoxonruns on a test-only copy where each marker is shifted so its minimum is 0.
That shift is the same for every cell, so ranks (and thus p-values) match a
Wilcoxon on the original CLR. Scanpy still computes log-fold changes
internally, which break on negatives; we do not use those values.
Based on
PNA-3531.Fixes: PNA-3532
Type of change
How Has This Been Tested?
test_differential_abundance_returns_expected_columnstest_differential_abundance_layer_from_obsmtest_differential_abundance_group_vars_splits_rowstest_differential_abundance_invalid_reference_raisestest_differential_abundance_signed_clr_keeps_original_difference_signPR checklist:
pyproject.tomland cited it properlyNote
Low Risk
Scoped change to PNA differential abundance statistics; non-negative CLR paths are unchanged, with clearer behavior for signed CLR effect sizes and p-values.
Overview
differential_abundancenow supports matrices with negative values (e.g. signed CLR) without relying on scanpy Wilcoxon on raw signed data.When negatives are present, the helper builds a test-only layer (
_pixelator_daa_nonneg) by shifting each marker so its column minimum is at least zero (same shift for every cell, preserving ranks).scanpy.tl.rank_genes_groupsWilcoxon p-values use that layer;difference,pct_1, andpct_2stay on the original selected matrix, aligned with pixelatorRRunDAA. The previous runtime warning filter and negative-value warning are replaced by a one-time info log. Docs and CHANGELOG describe the new flow; the signed-CLR test now asserts the reported mean difference matches the original matrix and that inputadata.Xis unchanged.Reviewed by Cursor Bugbot for commit 3a3b424. Bugbot is set up for automated code reviews on this repo. Configure here.