Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix layer handling in Mixscape.mixscape to resolve errors with adata.raw #636

Merged
merged 1 commit into from
Aug 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions pertpy/tools/_mixscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def mixscape(
X = adata_comp.layers["X_pert"]
except KeyError:
raise KeyError(
"No 'X_pert' found in .layers! Please run pert_sign first to calculate perturbation signature!"
"No 'X_pert' found in .layers! Please run perturbation_signature first to calculate perturbation signature!"
) from None
# initialize return variables
adata.obs[f"{new_class_name}_p_{perturbation_type.lower()}"] = 0
Expand Down Expand Up @@ -461,7 +461,13 @@ def _get_perturbation_markers(
adata_split = adata[split_mask].copy()
# find top DE genes between cells with targeting and non-targeting gRNAs
sc.tl.rank_genes_groups(
adata_split, layer=layer, groupby=labels, groups=genes, reference=control, method="t-test"
adata_split,
layer=layer,
groupby=labels,
groups=genes,
reference=control,
method="t-test",
use_raw=False,
)
# get DE genes for each gene
for gene in genes:
Expand Down
Loading