-
Notifications
You must be signed in to change notification settings - Fork 742
Expand file tree
/
Copy pathtools.py
More file actions
65 lines (35 loc) · 1.13 KB
/
tools.py
File metadata and controls
65 lines (35 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""Benchmark tool operations in Scanpy.
API documentation: <https://scanpy.readthedocs.io/en/stable/api/tools.html>.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import scanpy as sc
from ._utils import pbmc68k_reduced
if TYPE_CHECKING:
from anndata import AnnData
# setup variables
adata: AnnData
def setup():
global adata # noqa: PLW0603
adata = pbmc68k_reduced()
assert "X_pca" in adata.obsm
def time_umap():
sc.tl.umap(adata)
def peakmem_umap():
sc.tl.umap(adata)
def time_diffmap():
sc.tl.diffmap(adata)
def peakmem_diffmap():
sc.tl.diffmap(adata)
def time_leiden():
sc.tl.leiden(adata, flavor="igraph")
def peakmem_leiden():
sc.tl.leiden(adata, flavor="igraph")
def time_rank_genes_groups() -> None:
sc.tl.rank_genes_groups(adata, "bulk_labels", method="wilcoxon")
def peakmem_rank_genes_groups() -> None:
sc.tl.rank_genes_groups(adata, "bulk_labels", method="wilcoxon")
def time_score_genes() -> None:
sc.tl.score_genes(adata, adata.var_names[:500])
def peakmem_score_genes() -> None:
sc.tl.score_genes(adata, adata.var_names[:500])