Fix layer handling in Mixscape.mixscape to resolve errors with adata.raw #636
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.
PR Checklist
Description of changes
use_raw=False
to thesc.tl.rank_genes_groups
method callMixscape.mixscape
fails foradata
objects whereadata.raw
is present. This is due to the internal call ofsc.tl.rank_genes_groups
, which usesadata.raw
by default for computation ifuse_raw
is not explicitly set toFalse
. If a layer is specified when callingMixscape.mixscape
, this will cause therank_genes_groups
method to fail with the error:ValueError: Cannot specify "layer" and have "use_raw=True"
. If no layer is specified,rank_genes_groups
will useadata.raw
for computation, potentially leading to errors like the one reported in Error while using ms.mixscape - ValueError: Input X contains NaN. #617.Discussion point
X_pert
by default only aftersc.tl.rank_genes_groups
is called, meaning it will run onX
unless the user provides a different layer. Should we change this? On what basis should the perturbation markers be calculated? Rather based on theX_pert
layer?