|
| 1 | +"""Shared documentation for cellmapper.""" |
| 2 | + |
| 3 | +from docrep import DocstringProcessor |
| 4 | + |
| 5 | +__all__ = ["d"] |
| 6 | + |
| 7 | +_t = """\ |
| 8 | +t |
| 9 | + Number of diffusion time steps. This parameter controls the degree of |
| 10 | + smoothing applied by the diffusion operator. Larger values lead to more |
| 11 | + smoothing.""" |
| 12 | + |
| 13 | +_diffusion_method = """\ |
| 14 | +diffusion_method |
| 15 | + Method for computing powers of the mapping matrix (only valid in self-mapping mode). Options are "iterative" for |
| 16 | + iterative matrix multiplication (inspired by MAGIC :cite:`van2018recovering`) and "spectral" for |
| 17 | + eigendecomposition-based approach. """ |
| 18 | + |
| 19 | +_prediction_postfix = """\ |
| 20 | +prediction_postfix |
| 21 | + Postfix to add to mapped variables to identify them as predictions.""" |
| 22 | + |
| 23 | +_symmetrize = """\ |
| 24 | +symmetrize |
| 25 | + If True, create a symmetrize connectivity matrix. Only valid for square matrices (self-mapping). |
| 26 | + If None (default), uses True for self-mapping and False for cross-mapping.""" |
| 27 | + |
| 28 | +_self_edges = """\ |
| 29 | +self_edges |
| 30 | + Control self-edges (diagonal entries) for square matrices (self-mapping). |
| 31 | + If None (default), uses False for self-mapping (scanpy style) and None for cross-mapping. |
| 32 | + This controls whether or not the kernel used to compute the connectivities is supplied with self-edges. |
| 33 | + It does not determine whether the final connectivity matrix has self edges. For example, the `umap` |
| 34 | + kernel expectes self-edges, but does not produce them in the final connectivity matrix.""" |
| 35 | + |
| 36 | +_knn_method = """\ |
| 37 | +knn_method |
| 38 | + Method for computing k-nearest neighbors. Options include: |
| 39 | + - "sklearn": Scikit-learn's NearestNeighbors. See https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.NearestNeighbors.html |
| 40 | + - "pynndescent": Pynndescent's approximate nearest neighbors. See https://pynndescent.readthedocs.io/en/latest/ |
| 41 | + - "rapids": RAPIDS cuML's NearestNeighbors (GPU). See https://docs.rapids.ai/api/cuml/stable/api.html#cuml.neighbors.NearestNeighbors |
| 42 | + - "faiss-cpu": Facebook AI Similarity Search (FAISS) on CPU. See https://faiss.ai/ |
| 43 | + - "faiss-gpu": Facebook AI Similarity Search (FAISS) on GPU. See https://faiss.ai/ |
| 44 | +
|
| 45 | +
|
| 46 | + All methods return exactly `n_neighbors` neighbors, including the reference cell itself (in self-mapping mode).""" |
| 47 | + |
| 48 | +_only_yx = """\ |
| 49 | +only_yx |
| 50 | + If True, only compute the xy neighbors. In self-mapping mode, this is |
| 51 | + automatically set to True for efficiency since all neighbor matrices contain the same information. |
| 52 | + This is faster, but not suitable for Jaccard or HNOCA methods in cross-mapping mode.""" |
| 53 | + |
| 54 | +_kernel_method = """\ |
| 55 | +kernel_method |
| 56 | + Method to use for computing the mapping matrix. Options include: |
| 57 | +
|
| 58 | + - "jaccard": Jaccard similarity. Inspired by GLUE :cite:`cao2022multi` |
| 59 | + - "gauss": Gaussian kernel with (global) bandwith equal to the mean distance. |
| 60 | + - "scarches": scArches kernel. Inspired by scArches :cite:`lotfollahi2022mapping` |
| 61 | + - "inverse_distance": Inverse distance kernel. |
| 62 | + - "random": Random kernel, useful for testing. |
| 63 | + - "hnoca": HNOCA kernel. Inspired by HNOCA-tools :cite:`he2024integrated` |
| 64 | + - "equal": All neighbors are equally weighted (1/n_neighbors). |
| 65 | + - "umap": UMAP fuzzy simplicial set connectivities. Only available for self-mapping with true k-NN graphs.""" |
| 66 | + |
| 67 | +_comparison_method = """\ |
| 68 | +comparison_method |
| 69 | + Method to use for comparing the mapping results. Options include: |
| 70 | +
|
| 71 | + - "pearson": Pearson correlation coefficient. |
| 72 | + - "spearman": Spearman rank correlation coefficient. |
| 73 | + - "js": Jenson-Shanon divergence. |
| 74 | + - "rmse": Root Mean Square Error.""" |
| 75 | + |
| 76 | +_layer_key = """\ |
| 77 | +layer_key |
| 78 | + Key in `self.query.layers` to use as the original expression. Use "X" to use `self.query.X`.""" |
| 79 | + |
| 80 | + |
| 81 | +_n_neighbors = """\ |
| 82 | +n_neighbors |
| 83 | + Number of nearest neighbors. This parameter controls the sparsity of the connectivity matrix. """ |
| 84 | + |
| 85 | +_use_rep = """\ |
| 86 | +use_rep |
| 87 | + Data representation based on which to find nearest neighbors. If None, a fallback representation will be |
| 88 | + computed automatically. """ |
| 89 | + |
| 90 | +_knn_dist_metric = """\ |
| 91 | +knn_dist_metric |
| 92 | + Distance metric to use for nearest neighbors. See the knn algorithms documentation for details. """ |
| 93 | + |
| 94 | + |
| 95 | +d = DocstringProcessor( |
| 96 | + t=_t, |
| 97 | + diffusion_method=_diffusion_method, |
| 98 | + prediction_postfix=_prediction_postfix, |
| 99 | + symmetrize=_symmetrize, |
| 100 | + self_edges=_self_edges, |
| 101 | + knn_method=_knn_method, |
| 102 | + only_yx=_only_yx, |
| 103 | + kernel_method=_kernel_method, |
| 104 | + comparison_method=_comparison_method, |
| 105 | + layer_key=_layer_key, |
| 106 | + n_neighbors=_n_neighbors, |
| 107 | + use_rep=_use_rep, |
| 108 | + knn_dist_metric=_knn_dist_metric, |
| 109 | +) |
0 commit comments