Skip to content

Commit 102b4ef

Browse files
Support Dask in highly_variable_genes (#2809)
Co-authored-by: Isaac Virshup <[email protected]>
1 parent e7a1251 commit 102b4ef

File tree

7 files changed

+410
-285
lines changed

7 files changed

+410
-285
lines changed

docs/release-notes/1.10.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
now support a `mask` parameter {pr}`2272` {smaller}`C Bright, T Marcella, & P Angerer`
1818
* {func}`scanpy.tl.rank_genes_groups` no longer warns that it's default was changed from t-test_overestim_var to t-test {pr}`2798` {smaller}`L Heumos`
1919
* {func}`scanpy.pp.highly_variable_genes` has new flavor `seurat_v3_paper` that is in its implementation consistent with the paper description in Stuart et al 2018. {pr}`2792` {smaller}`E Roellin`
20+
* {func}`scanpy.pp.highly_variable_genes` supports dask for the default `seurat` and `cell_ranger` flavors {pr}`2809` {smaller}`P Angerer`
2021

2122
```{rubric} Docs
2223
```

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ doc = [
120120
"ipython>=7.20", # for nbsphinx code highlighting
121121
"matplotlib!=3.6.1",
122122
# TODO: remove necessity for being able to import doc-linked classes
123+
"dask",
123124
"scanpy[paga]",
124125
"sam-algorithm",
125126
]

scanpy/_compat.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@ class ZappyArray:
3030
pass
3131

3232

33-
__all__ = ["cache", "DaskArray", "fullname", "pkg_metadata", "pkg_version"]
33+
__all__ = [
34+
"cache",
35+
"DaskArray",
36+
"ZappyArray",
37+
"fullname",
38+
"pkg_metadata",
39+
"pkg_version",
40+
]
3441

3542

3643
def fullname(typ: type) -> str:

scanpy/preprocessing/_deprecated/highly_variable_genes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ def filter_genes_dispersion( # noqa: PLR0917
111111
if n_top_genes is not None and not all(
112112
x is None for x in [min_disp, max_disp, min_mean, max_mean]
113113
):
114-
logg.info("If you pass `n_top_genes`, all cutoffs are ignored.")
114+
msg = "If you pass `n_top_genes`, all cutoffs are ignored."
115+
warnings.warn(msg, UserWarning)
115116
if min_disp is None:
116117
min_disp = 0.5
117118
if min_mean is None:

scanpy/preprocessing/_distributed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def materialize_as_ndarray(
3737
def materialize_as_ndarray(
3838
a: ArrayLike | tuple[ArrayLike | ZappyArray | DaskArray, ...],
3939
) -> tuple[np.ndarray] | np.ndarray:
40-
"""Convert distributed arrays to ndarrays."""
40+
"""Compute distributed arrays and convert them to numpy ndarrays."""
4141
if not isinstance(a, tuple):
4242
return np.asarray(a)
4343

0 commit comments

Comments
 (0)