Skip to content

Commit

Permalink
rename compensate
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinblampey committed Apr 8, 2024
1 parent 1940939 commit 53ad9ba
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.6.1] - 2024-04-08

Rename `correct_spillover` -> `compensate`

## [1.6.0] - 2024-04-08

### Changed
Expand Down
2 changes: 1 addition & 1 deletion docs/api/preprocess.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
options:
show_root_heading: true

::: scyan.preprocess.correct_spillover
::: scyan.preprocess.compensate
options:
show_root_heading: true
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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/"
Expand Down
7 changes: 4 additions & 3 deletions scyan/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 53ad9ba

Please sign in to comment.