cellmapper 0.2.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cellmapper-0.2.0 → cellmapper-0.2.2}/CHANGELOG.md +20 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/PKG-INFO +21 -19
- {cellmapper-0.2.0 → cellmapper-0.2.2}/README.md +18 -18
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/notebooks/tutorials/data_denoising.ipynb +42 -58
- cellmapper-0.2.2/docs/notebooks/tutorials/query_to_reference_mapping.ipynb +1029 -0
- cellmapper-0.2.2/docs/notebooks/tutorials/spatial_mapping.ipynb +978 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/notebooks/tutorials/spatial_smoothing.ipynb +17 -17
- {cellmapper-0.2.0 → cellmapper-0.2.2}/pyproject.toml +2 -0
- cellmapper-0.2.2/src/cellmapper/_docs.py +117 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/src/cellmapper/check.py +5 -2
- {cellmapper-0.2.0 → cellmapper-0.2.2}/src/cellmapper/constants.py +2 -2
- {cellmapper-0.2.0 → cellmapper-0.2.2}/src/cellmapper/model/_knn_backend.py +42 -8
- {cellmapper-0.2.0 → cellmapper-0.2.2}/src/cellmapper/model/cellmapper.py +176 -139
- {cellmapper-0.2.0 → cellmapper-0.2.2}/src/cellmapper/model/embedding.py +4 -6
- {cellmapper-0.2.0 → cellmapper-0.2.2}/src/cellmapper/model/evaluate.py +29 -27
- {cellmapper-0.2.0 → cellmapper-0.2.2}/src/cellmapper/model/kernel.py +31 -52
- {cellmapper-0.2.0 → cellmapper-0.2.2}/src/cellmapper/model/mapping_operator.py +12 -14
- {cellmapper-0.2.0 → cellmapper-0.2.2}/src/cellmapper/model/neighbors.py +11 -17
- {cellmapper-0.2.0 → cellmapper-0.2.2}/tests/conftest.py +56 -3
- {cellmapper-0.2.0 → cellmapper-0.2.2}/tests/model/test_evaluate.py +6 -6
- {cellmapper-0.2.0 → cellmapper-0.2.2}/tests/model/test_kernel.py +18 -3
- cellmapper-0.2.2/tests/model/test_mapping_operator.py +272 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/tests/model/test_query_to_reference_mapping.py +155 -21
- {cellmapper-0.2.0 → cellmapper-0.2.2}/tests/model/test_self_mapping.py +17 -17
- cellmapper-0.2.0/docs/notebooks/tutorials/query_to_reference_mapping.ipynb +0 -1028
- cellmapper-0.2.0/docs/notebooks/tutorials/spatial_mapping.ipynb +0 -956
- {cellmapper-0.2.0 → cellmapper-0.2.2}/.codecov.yaml +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/.cruft.json +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/.editorconfig +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/.github/workflows/build.yaml +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/.github/workflows/release.yaml +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/.github/workflows/test.yaml +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/.gitignore +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/.pre-commit-config.yaml +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/.readthedocs.yaml +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/.vscode/extensions.json +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/.vscode/launch.json +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/.vscode/settings.json +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/LICENSE +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/biome.jsonc +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/_static/.gitkeep +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/_static/css/custom.css +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/_static/images/cellmapper_logo_dark.svg +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/_static/images/cellmapper_logo_light.svg +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/_templates/.gitkeep +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/_templates/autosummary/class.rst +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/api.md +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/changelog.md +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/conf.py +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/contributing.md +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/extensions/typed_returns.py +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/index.md +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/notebooks/tutorials/index.rst +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/references.bib +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/docs/references.md +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/src/cellmapper/__init__.py +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/src/cellmapper/logging.py +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/src/cellmapper/utils.py +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/tests/data/precomputed_leiden.csv +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/tests/model/test_embedding.py +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/tests/model/test_neighbors.py +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/tests/test_basic.py +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/tests/test_check.py +0 -0
- {cellmapper-0.2.0 → cellmapper-0.2.2}/tests/test_utils.py +0 -0
|
@@ -10,6 +10,26 @@ and this project adheres to [Semantic Versioning][].
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [v0.2.2]
|
|
14
|
+
### Added
|
|
15
|
+
- Enabled subsetting categories before mapping .obs values {pr}`46`
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Updated the README a bit {pr}`44`
|
|
19
|
+
- Updated tutorials to work with new parameter names {pr}`43`
|
|
20
|
+
|
|
21
|
+
### Fices
|
|
22
|
+
- Fixed a small bug where hvg masks would not be propagated correctly to joint pca computation {pr}`48`
|
|
23
|
+
|
|
24
|
+
## [v0.2.1]
|
|
25
|
+
### Changed
|
|
26
|
+
- Move some duplicated docstrings into a central _docs.py file {pr}`41`
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
- Added some tests for edge cases in the `MappingOperator` class {pr}`41`
|
|
30
|
+
- Treat faiss-cpu and faiss-gpu separately {pr}`41`
|
|
31
|
+
|
|
32
|
+
|
|
13
33
|
## [v0.2.0]
|
|
14
34
|
|
|
15
35
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cellmapper
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: k-NN-based mapping of cells across representations
|
|
5
5
|
Project-URL: Documentation, https://cellmapper.readthedocs.io/
|
|
6
6
|
Project-URL: Homepage, https://github.com/quadbio/cellmapper
|
|
@@ -36,6 +36,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
36
36
|
Classifier: Programming Language :: Python :: 3.13
|
|
37
37
|
Requires-Python: >=3.10
|
|
38
38
|
Requires-Dist: anndata>=0.11
|
|
39
|
+
Requires-Dist: docrep
|
|
39
40
|
Requires-Dist: numpy
|
|
40
41
|
Requires-Dist: packaging
|
|
41
42
|
Requires-Dist: pandas
|
|
@@ -63,6 +64,7 @@ Requires-Dist: sphinxcontrib-bibtex>=1; extra == 'doc'
|
|
|
63
64
|
Requires-Dist: sphinxext-opengraph; extra == 'doc'
|
|
64
65
|
Provides-Extra: test
|
|
65
66
|
Requires-Dist: coverage; extra == 'test'
|
|
67
|
+
Requires-Dist: faiss-cpu; extra == 'test'
|
|
66
68
|
Requires-Dist: pytest; extra == 'test'
|
|
67
69
|
Requires-Dist: squidpy>=1.6; extra == 'test'
|
|
68
70
|
Provides-Extra: tutorials
|
|
@@ -94,42 +96,42 @@ Description-Content-Type: text/markdown
|
|
|
94
96
|
[badge-downloads]: https://static.pepy.tech/badge/cellmapper
|
|
95
97
|
[badge-zenodo]: https://zenodo.org/badge/973714072.svg
|
|
96
98
|
|
|
97
|
-
k-NN-based mapping of cells across representations to
|
|
99
|
+
k-NN-based mapping of cells across representations to transfer labels, embeddings and expression values. Works for millions of cells, on CPU and GPU, across molecular modalities, between spatial and non-spatial data, for arbitrary query and reference datasets. Using [faiss][] to compute k-NN graphs, CellMapper takes about 30 seconds to transfer cell type labels from 1.5M cells to 1.5M cells on a single RTX 4090 with 60 GB CPU memory.
|
|
98
100
|
|
|
99
|
-
Inspired by scanpy's [ingest][] and the [HNOCA-tools][] packages. Check out the [docs][] to learn more, in particular our [tutorials][].
|
|
101
|
+
Inspired by previous tools, including scanpy's [ingest][] and the [HNOCA-tools][] packages. Check out the 📚 [docs][] to learn more, in particular our [tutorials][].
|
|
100
102
|
|
|
101
|
-
## Key use cases
|
|
103
|
+
## ✨ Key use cases
|
|
102
104
|
|
|
103
|
-
- Transfer cell type labels and expression values from dissociated to spatial datasets.
|
|
104
|
-
- Transfer embeddings between arbitrary query and reference datasets.
|
|
105
|
-
- Compute presence scores for query datasets in large reference atlasses.
|
|
106
|
-
- Identify niches in spatial datasets by contextualizing latent spaces in spatial coordinates.
|
|
107
|
-
- Evaluate the results of transferring labels, embeddings and feature spaces using a variety of metrics.
|
|
105
|
+
- 🧬 Transfer cell type labels and expression values from dissociated to spatial datasets.
|
|
106
|
+
- ↔️ Transfer embeddings between arbitrary query and reference datasets.
|
|
107
|
+
- 📊 Compute presence scores for query datasets in large reference atlasses.
|
|
108
|
+
- 🗺️ Identify niches in spatial datasets by contextualizing latent spaces in spatial coordinates.
|
|
109
|
+
- 📈 Evaluate the results of transferring labels, embeddings and feature spaces using a variety of metrics.
|
|
108
110
|
|
|
109
111
|
The core idea of `CellMapper` is to separate the method (k-NN graph with some kernel applied to get a mapping matrix) from the application (mapping across arbitrary representations), to be flexible and fast. The tool currently supports [pynndescent][], [sklearn][], [faiss][] and [rapids][] for neighborhood search, implements a variety of graph kernels, and is closely integrated with `AnnData` objects.
|
|
110
112
|
|
|
111
|
-
## Installation
|
|
113
|
+
## 📦 Installation
|
|
112
114
|
|
|
113
|
-
You need to have Python 3.10 or newer installed on your system.
|
|
115
|
+
You need to have 🐍 Python 3.10 or newer installed on your system.
|
|
114
116
|
If you don't have Python installed, we recommend installing [uv][].
|
|
115
117
|
|
|
116
118
|
There are two alternative options to install ``cellmapper``:
|
|
117
119
|
|
|
118
|
-
- Install the latest release from [PyPI][]:
|
|
120
|
+
- 🚀 Install the latest release from [PyPI][]:
|
|
119
121
|
|
|
120
122
|
```bash
|
|
121
123
|
pip install cellmapper
|
|
122
124
|
```
|
|
123
125
|
|
|
124
|
-
- Install the latest development version:
|
|
126
|
+
- 🛠️ Install the latest development version:
|
|
125
127
|
|
|
126
128
|
```bash
|
|
127
129
|
pip install git+https://github.com/quadbio/cellmapper.git@main
|
|
128
130
|
```
|
|
129
131
|
|
|
130
|
-
## Getting started
|
|
132
|
+
## 🏁 Getting started
|
|
131
133
|
|
|
132
|
-
This package assumes that you have ``query`` and ``reference`` AnnData objects, with a joint embedding computed and stored in ``.obsm``.
|
|
134
|
+
This package assumes that you have ``query`` and ``reference`` AnnData objects, with a joint embedding computed and stored in ``.obsm``. While we implement some baseline approaches to compute joint embeddings (PCA and a fast reimplementation of CCA), we typically expect you to provide a pre-computed joint embedding from some task-specific representation learning tools, e.g. [GimVI][] or [ENVI][] for spatial mapping, [GLUE][], [MIDAS][] and [MOFA+][] for modality translation, and [scVI][], [scANVI][] and [scArches][] for query-to-reference mapping - this is just a small selection!
|
|
133
135
|
|
|
134
136
|
With a joint embedding in ``.obsm["X_joint"]`` at hand, the simplest way to use ``CellMapper`` is as follows:
|
|
135
137
|
```Python
|
|
@@ -142,17 +144,17 @@ cmap = CellMapper(query, reference).map(
|
|
|
142
144
|
|
|
143
145
|
This will transfer data from the reference to the query dataset, including celltype labels stored in ``reference.obs``, a UMAP embedding stored in ``reference.obsm``, and expression values stored in ``reference.X``.
|
|
144
146
|
|
|
145
|
-
There are many ways to customize this, e.g. use different ways to compute k-NN graphs and to turn them into mapping matrices, and we implement a few methods to evaluate whether your k-NN transfer was sucessful. The tool also implements a `self-mapping` mode (only a query object, no reference), which is useful for spatial contextualization. Check out the [docs][] to learn more.
|
|
147
|
+
There are many ways to customize this, e.g. use different ways to compute k-NN graphs and to turn them into mapping matrices, and we implement a few methods to evaluate whether your k-NN transfer was sucessful. The tool also implements a `self-mapping` mode (only a query object, no reference), which is useful for spatial contextualization and data denoising. Check out the 📚 [docs][] to learn more.
|
|
146
148
|
|
|
147
|
-
## Release notes
|
|
149
|
+
## 📝 Release notes
|
|
148
150
|
|
|
149
151
|
See the [changelog][].
|
|
150
152
|
|
|
151
|
-
## Contact
|
|
153
|
+
## 📬 Contact
|
|
152
154
|
|
|
153
155
|
If you found a bug, please use the [issue tracker][].
|
|
154
156
|
|
|
155
|
-
## Citation
|
|
157
|
+
## 📖 Citation
|
|
156
158
|
Please use our [zenodo][] entry to cite this software.
|
|
157
159
|
|
|
158
160
|
[uv]: https://github.com/astral-sh/uv
|
|
@@ -16,42 +16,42 @@
|
|
|
16
16
|
[badge-downloads]: https://static.pepy.tech/badge/cellmapper
|
|
17
17
|
[badge-zenodo]: https://zenodo.org/badge/973714072.svg
|
|
18
18
|
|
|
19
|
-
k-NN-based mapping of cells across representations to
|
|
19
|
+
k-NN-based mapping of cells across representations to transfer labels, embeddings and expression values. Works for millions of cells, on CPU and GPU, across molecular modalities, between spatial and non-spatial data, for arbitrary query and reference datasets. Using [faiss][] to compute k-NN graphs, CellMapper takes about 30 seconds to transfer cell type labels from 1.5M cells to 1.5M cells on a single RTX 4090 with 60 GB CPU memory.
|
|
20
20
|
|
|
21
|
-
Inspired by scanpy's [ingest][] and the [HNOCA-tools][] packages. Check out the [docs][] to learn more, in particular our [tutorials][].
|
|
21
|
+
Inspired by previous tools, including scanpy's [ingest][] and the [HNOCA-tools][] packages. Check out the 📚 [docs][] to learn more, in particular our [tutorials][].
|
|
22
22
|
|
|
23
|
-
## Key use cases
|
|
23
|
+
## ✨ Key use cases
|
|
24
24
|
|
|
25
|
-
- Transfer cell type labels and expression values from dissociated to spatial datasets.
|
|
26
|
-
- Transfer embeddings between arbitrary query and reference datasets.
|
|
27
|
-
- Compute presence scores for query datasets in large reference atlasses.
|
|
28
|
-
- Identify niches in spatial datasets by contextualizing latent spaces in spatial coordinates.
|
|
29
|
-
- Evaluate the results of transferring labels, embeddings and feature spaces using a variety of metrics.
|
|
25
|
+
- 🧬 Transfer cell type labels and expression values from dissociated to spatial datasets.
|
|
26
|
+
- ↔️ Transfer embeddings between arbitrary query and reference datasets.
|
|
27
|
+
- 📊 Compute presence scores for query datasets in large reference atlasses.
|
|
28
|
+
- 🗺️ Identify niches in spatial datasets by contextualizing latent spaces in spatial coordinates.
|
|
29
|
+
- 📈 Evaluate the results of transferring labels, embeddings and feature spaces using a variety of metrics.
|
|
30
30
|
|
|
31
31
|
The core idea of `CellMapper` is to separate the method (k-NN graph with some kernel applied to get a mapping matrix) from the application (mapping across arbitrary representations), to be flexible and fast. The tool currently supports [pynndescent][], [sklearn][], [faiss][] and [rapids][] for neighborhood search, implements a variety of graph kernels, and is closely integrated with `AnnData` objects.
|
|
32
32
|
|
|
33
|
-
## Installation
|
|
33
|
+
## 📦 Installation
|
|
34
34
|
|
|
35
|
-
You need to have Python 3.10 or newer installed on your system.
|
|
35
|
+
You need to have 🐍 Python 3.10 or newer installed on your system.
|
|
36
36
|
If you don't have Python installed, we recommend installing [uv][].
|
|
37
37
|
|
|
38
38
|
There are two alternative options to install ``cellmapper``:
|
|
39
39
|
|
|
40
|
-
- Install the latest release from [PyPI][]:
|
|
40
|
+
- 🚀 Install the latest release from [PyPI][]:
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
43
|
pip install cellmapper
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
- Install the latest development version:
|
|
46
|
+
- 🛠️ Install the latest development version:
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
49
|
pip install git+https://github.com/quadbio/cellmapper.git@main
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
## Getting started
|
|
52
|
+
## 🏁 Getting started
|
|
53
53
|
|
|
54
|
-
This package assumes that you have ``query`` and ``reference`` AnnData objects, with a joint embedding computed and stored in ``.obsm``.
|
|
54
|
+
This package assumes that you have ``query`` and ``reference`` AnnData objects, with a joint embedding computed and stored in ``.obsm``. While we implement some baseline approaches to compute joint embeddings (PCA and a fast reimplementation of CCA), we typically expect you to provide a pre-computed joint embedding from some task-specific representation learning tools, e.g. [GimVI][] or [ENVI][] for spatial mapping, [GLUE][], [MIDAS][] and [MOFA+][] for modality translation, and [scVI][], [scANVI][] and [scArches][] for query-to-reference mapping - this is just a small selection!
|
|
55
55
|
|
|
56
56
|
With a joint embedding in ``.obsm["X_joint"]`` at hand, the simplest way to use ``CellMapper`` is as follows:
|
|
57
57
|
```Python
|
|
@@ -64,17 +64,17 @@ cmap = CellMapper(query, reference).map(
|
|
|
64
64
|
|
|
65
65
|
This will transfer data from the reference to the query dataset, including celltype labels stored in ``reference.obs``, a UMAP embedding stored in ``reference.obsm``, and expression values stored in ``reference.X``.
|
|
66
66
|
|
|
67
|
-
There are many ways to customize this, e.g. use different ways to compute k-NN graphs and to turn them into mapping matrices, and we implement a few methods to evaluate whether your k-NN transfer was sucessful. The tool also implements a `self-mapping` mode (only a query object, no reference), which is useful for spatial contextualization. Check out the [docs][] to learn more.
|
|
67
|
+
There are many ways to customize this, e.g. use different ways to compute k-NN graphs and to turn them into mapping matrices, and we implement a few methods to evaluate whether your k-NN transfer was sucessful. The tool also implements a `self-mapping` mode (only a query object, no reference), which is useful for spatial contextualization and data denoising. Check out the 📚 [docs][] to learn more.
|
|
68
68
|
|
|
69
|
-
## Release notes
|
|
69
|
+
## 📝 Release notes
|
|
70
70
|
|
|
71
71
|
See the [changelog][].
|
|
72
72
|
|
|
73
|
-
## Contact
|
|
73
|
+
## 📬 Contact
|
|
74
74
|
|
|
75
75
|
If you found a bug, please use the [issue tracker][].
|
|
76
76
|
|
|
77
|
-
## Citation
|
|
77
|
+
## 📖 Citation
|
|
78
78
|
Please use our [zenodo][] entry to cite this software.
|
|
79
79
|
|
|
80
80
|
[uv]: https://github.com/astral-sh/uv
|