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

add layer argument for sc.tl.score_genes_cell_cycle #3138

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion src/scanpy/tools/_score_genes.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
s_genes: Sequence[str],
g2m_genes: Sequence[str],
copy: bool = False,
layer: str | None = None,
**kwargs,
) -> AnnData | None:
"""\
Expand All @@ -226,6 +227,8 @@
List of genes associated with G2M phase.
copy
Copy `adata` or modify it inplace.
layer
Key from `adata.layers` whose value will be used to perform tests on.
**kwargs
Are passed to :func:`~scanpy.tl.score_genes`. `ctrl_size` is not
possible, as it's set as `min(len(s_genes), len(g2m_genes))`.
Expand Down Expand Up @@ -254,7 +257,7 @@
adata = adata.copy() if copy else adata
ctrl_size = min(len(s_genes), len(g2m_genes))
for genes, name in [(s_genes, "S_score"), (g2m_genes, "G2M_score")]:
score_genes(adata, genes, score_name=name, ctrl_size=ctrl_size, **kwargs)
score_genes(adata, genes, score_name=name, ctrl_size=ctrl_size, layer=layer, **kwargs)

Check warning on line 260 in src/scanpy/tools/_score_genes.py

View check run for this annotation

Codecov / codecov/patch

src/scanpy/tools/_score_genes.py#L260

Added line #L260 was not covered by tests
scores = adata.obs[["S_score", "G2M_score"]]

# default phase is S
Expand Down
Loading