From 53ad9ba43ae668812b6b569d1e74a699ce2768f1 Mon Sep 17 00:00:00 2001 From: Blampey Quentin Date: Mon, 8 Apr 2024 15:36:12 +0200 Subject: [PATCH] rename compensate --- CHANGELOG.md | 4 ++++ docs/api/preprocess.md | 2 +- pyproject.toml | 2 +- scyan/preprocess.py | 7 ++++--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index def0459..a424ed8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.6.1] - 2024-04-08 + +Rename `correct_spillover` -> `compensate` + ## [1.6.0] - 2024-04-08 ### Changed diff --git a/docs/api/preprocess.md b/docs/api/preprocess.md index df448f3..bd22729 100644 --- a/docs/api/preprocess.md +++ b/docs/api/preprocess.md @@ -18,6 +18,6 @@ options: show_root_heading: true -::: scyan.preprocess.correct_spillover +::: scyan.preprocess.compensate options: show_root_heading: true diff --git a/pyproject.toml b/pyproject.toml index 329b8bc..e9c40da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "scyan" -version = "1.6.0" +version = "1.6.1" description = "Single-cell Cytometry Annotation Network" documentation = "https://mics-lab.github.io/scyan/" homepage = "https://mics-lab.github.io/scyan/" diff --git a/scyan/preprocess.py b/scyan/preprocess.py index b3e9ebd..9487fb6 100644 --- a/scyan/preprocess.py +++ b/scyan/preprocess.py @@ -216,8 +216,8 @@ def subsample(adata: AnnData, n_obs: int) -> AnnData: return adata[indices] -def correct_spillover(adata: AnnData, key_added: Optional[str] = None): - """Use the spillover matrix in `adata.varp["spillover_matrix"]` to correct spillover +def compensate(adata: AnnData, key_added: Optional[str] = None): + """Use the spillover matrix in `adata.varp["spillover_matrix"]` to correct spillover from `adata.X` Args: adata: An `AnnData` object @@ -231,7 +231,8 @@ def correct_spillover(adata: AnnData, key_added: Optional[str] = None): ): log.warn("It is recommended to apply spillover only on raw data (unprocessed)") - corrected = adata.X @ adata.varp["spillover_matrix"].T + S = adata.varp["spillover_matrix"] + corrected = np.linalg.solve(S, adata.X.T).T if key_added is None: adata.X = corrected