|
6 | 6 | from tqdm import tqdm |
7 | 7 |
|
8 | 8 | _SIMILARITY_MATRIX = Literal["cosine", "euclidean", "pearson", "spearman"] |
9 | | - |
| 9 | +_METHOD = Literal["mean", "median", "sum"] |
10 | 10 |
|
11 | 11 | def adjust( |
12 | 12 | adata: AnnData, |
13 | 13 | use_data: str = "X_pca", |
14 | 14 | radius: float = 50.0, |
15 | 15 | rates: int = 1, |
16 | | - method="mean", |
17 | | - copy: bool = False, |
| 16 | + method: _SIMILARITY_MATRIX = "mean", |
18 | 17 | similarity_matrix: _SIMILARITY_MATRIX = "cosine", |
| 18 | + copy: bool = False, |
19 | 19 | ) -> AnnData | None: |
20 | 20 | """\ |
21 | 21 | SME normalisation: Using spot location information and tissue morphological |
22 | 22 | features to correct spot gene expression |
23 | 23 |
|
24 | 24 | Parameters |
25 | 25 | ---------- |
26 | | - adata |
| 26 | + adata : AnnData |
27 | 27 | Annotated data matrix. |
28 | | - use_data |
| 28 | + use_data : str, default "X_pca" |
29 | 29 | Input date to be adjusted by morphological features. |
30 | 30 | choose one from ["raw", "X_pca", "X_umap"] |
31 | | - radius |
| 31 | + radius: float, default 50.0 |
32 | 32 | Radius to select neighbour spots. |
33 | | - rates |
34 | | - Strength for adjustment. |
35 | | - method |
36 | | - Method for disk smoothing. |
37 | | - choose one from ["means", "median"] |
38 | | - copy |
| 33 | + rates: int, default 1 |
| 34 | + Number of times to add the aggregated neighbor contribution. |
| 35 | + Higher values increase the strength of morphological adjustment. |
| 36 | + method: {'mean', 'median', 'sum'}, default 'mean' |
| 37 | + Method for aggregating neighbor contributions. |
| 38 | + similarity_matrix : {'cosine', 'euclidean', 'pearson', 'spearman'}, default 'cosine' |
| 39 | + Method to calculate morphological similarity between spots. |
| 40 | + copy : bool, default False |
39 | 41 | Return a copy instead of writing to adata. |
40 | | - similarity_matrix |
41 | | - Matrix to calculate morphological similarity of two spots |
42 | | - choose one from ["cosine", "euclidean", "pearson", "spearman"] |
43 | 42 | Returns |
44 | 43 | ------- |
45 | 44 | Depending on `copy`, returns or updates `adata` with the following fields. |
|
0 commit comments