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

Harmony 64bit #2655

Merged
merged 4 commits into from Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/release-notes/1.10.0.md
Expand Up @@ -8,6 +8,7 @@
* {func}`scanpy.pp.neighbors` now has a `transformer` argument allowing for more flexibility {pr}`2536` {smaller}`P Angerer`
* {func}`scanpy.experimental.pp.highly_variable_genes` using `flavor='pearson_residuals'`
now uses numba for variance computation {pr}`2612` {smaller}`S Dicks & P Angerer`
* {func}`scanpy.external.pp.harmony_integrate` now runs with 64 bit floats improving reproducibility {pr}`2655` {smaller}`S Dicks`

```{rubric} Docs
```
Expand Down
5 changes: 4 additions & 1 deletion scanpy/external/pp/_harmony_integrate.py
Expand Up @@ -5,6 +5,7 @@
from typing import Optional

from anndata import AnnData
import numpy as np


def harmony_integrate(
Expand Down Expand Up @@ -79,6 +80,8 @@ def harmony_integrate(
except ImportError:
raise ImportError("\nplease install harmonypy:\n\n\tpip install harmonypy")

harmony_out = harmonypy.run_harmony(adata.obsm[basis], adata.obs, key, **kwargs)
X = adata.obsm[basis].astype(np.float64)

harmony_out = harmonypy.run_harmony(X, adata.obs, key, **kwargs)

adata.obsm[adjusted_basis] = harmony_out.Z_corr.T