cellmapper 0.1.2__tar.gz → 0.1.3__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.
Files changed (56) hide show
  1. {cellmapper-0.1.2 → cellmapper-0.1.3}/CHANGELOG.md +13 -3
  2. {cellmapper-0.1.2 → cellmapper-0.1.3}/PKG-INFO +24 -5
  3. {cellmapper-0.1.2 → cellmapper-0.1.3}/README.md +18 -4
  4. cellmapper-0.1.3/docs/notebooks/tutorials/spatial_mapping.ipynb +973 -0
  5. cellmapper-0.1.3/docs/notebooks/tutorials/spatial_smoothing.ipynb +1212 -0
  6. {cellmapper-0.1.2 → cellmapper-0.1.3}/docs/references.bib +104 -0
  7. {cellmapper-0.1.2 → cellmapper-0.1.3}/pyproject.toml +6 -0
  8. {cellmapper-0.1.2 → cellmapper-0.1.3}/src/cellmapper/cellmapper.py +161 -73
  9. {cellmapper-0.1.2 → cellmapper-0.1.3}/src/cellmapper/check.py +6 -3
  10. {cellmapper-0.1.2 → cellmapper-0.1.3}/src/cellmapper/evaluate.py +81 -17
  11. {cellmapper-0.1.2 → cellmapper-0.1.3}/src/cellmapper/knn.py +197 -21
  12. cellmapper-0.1.3/src/cellmapper/utils.py +216 -0
  13. cellmapper-0.1.3/tests/conftest.py +255 -0
  14. cellmapper-0.1.3/tests/test_cellmapper.py +461 -0
  15. {cellmapper-0.1.2 → cellmapper-0.1.3}/tests/test_evaluate.py +5 -5
  16. cellmapper-0.1.3/tests/test_neighbors.py +177 -0
  17. cellmapper-0.1.3/tests/test_utils.py +132 -0
  18. cellmapper-0.1.2/docs/notebooks/tutorials/spatial_mapping.ipynb +0 -950
  19. cellmapper-0.1.2/tests/conftest.py +0 -134
  20. cellmapper-0.1.2/tests/test_cellmapper.py +0 -106
  21. cellmapper-0.1.2/tests/test_neighbors.py +0 -44
  22. {cellmapper-0.1.2 → cellmapper-0.1.3}/.codecov.yaml +0 -0
  23. {cellmapper-0.1.2 → cellmapper-0.1.3}/.cruft.json +0 -0
  24. {cellmapper-0.1.2 → cellmapper-0.1.3}/.editorconfig +0 -0
  25. {cellmapper-0.1.2 → cellmapper-0.1.3}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  26. {cellmapper-0.1.2 → cellmapper-0.1.3}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  27. {cellmapper-0.1.2 → cellmapper-0.1.3}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  28. {cellmapper-0.1.2 → cellmapper-0.1.3}/.github/workflows/build.yaml +0 -0
  29. {cellmapper-0.1.2 → cellmapper-0.1.3}/.github/workflows/release.yaml +0 -0
  30. {cellmapper-0.1.2 → cellmapper-0.1.3}/.github/workflows/test.yaml +0 -0
  31. {cellmapper-0.1.2 → cellmapper-0.1.3}/.gitignore +0 -0
  32. {cellmapper-0.1.2 → cellmapper-0.1.3}/.pre-commit-config.yaml +0 -0
  33. {cellmapper-0.1.2 → cellmapper-0.1.3}/.readthedocs.yaml +0 -0
  34. {cellmapper-0.1.2 → cellmapper-0.1.3}/.vscode/extensions.json +0 -0
  35. {cellmapper-0.1.2 → cellmapper-0.1.3}/.vscode/launch.json +0 -0
  36. {cellmapper-0.1.2 → cellmapper-0.1.3}/.vscode/settings.json +0 -0
  37. {cellmapper-0.1.2 → cellmapper-0.1.3}/LICENSE +0 -0
  38. {cellmapper-0.1.2 → cellmapper-0.1.3}/biome.jsonc +0 -0
  39. {cellmapper-0.1.2 → cellmapper-0.1.3}/docs/_static/.gitkeep +0 -0
  40. {cellmapper-0.1.2 → cellmapper-0.1.3}/docs/_static/css/custom.css +0 -0
  41. {cellmapper-0.1.2 → cellmapper-0.1.3}/docs/_templates/.gitkeep +0 -0
  42. {cellmapper-0.1.2 → cellmapper-0.1.3}/docs/_templates/autosummary/class.rst +0 -0
  43. {cellmapper-0.1.2 → cellmapper-0.1.3}/docs/api.md +0 -0
  44. {cellmapper-0.1.2 → cellmapper-0.1.3}/docs/changelog.md +0 -0
  45. {cellmapper-0.1.2 → cellmapper-0.1.3}/docs/conf.py +0 -0
  46. {cellmapper-0.1.2 → cellmapper-0.1.3}/docs/contributing.md +0 -0
  47. {cellmapper-0.1.2 → cellmapper-0.1.3}/docs/extensions/typed_returns.py +0 -0
  48. {cellmapper-0.1.2 → cellmapper-0.1.3}/docs/index.md +0 -0
  49. {cellmapper-0.1.2 → cellmapper-0.1.3}/docs/notebooks/tutorials/index.rst +0 -0
  50. {cellmapper-0.1.2 → cellmapper-0.1.3}/docs/references.md +0 -0
  51. {cellmapper-0.1.2 → cellmapper-0.1.3}/src/cellmapper/__init__.py +0 -0
  52. {cellmapper-0.1.2 → cellmapper-0.1.3}/src/cellmapper/logging.py +0 -0
  53. {cellmapper-0.1.2 → cellmapper-0.1.3}/tests/data/precomputed_leiden.csv +0 -0
  54. {cellmapper-0.1.2 → cellmapper-0.1.3}/tests/test_basic.py +0 -0
  55. {cellmapper-0.1.2 → cellmapper-0.1.3}/tests/test_check.py +0 -0
  56. {cellmapper-0.1.2 → cellmapper-0.1.3}/tests/test_neighbors_results.py +0 -0
@@ -10,14 +10,24 @@ and this project adheres to [Semantic Versioning][].
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [v0.1.3]
14
+
15
+ ### Added
16
+ - Added a tutorial on spatial contextualization and niche identification {pr}`23`.
17
+ - Implemented a self-mapping mode with only a query dataset {pr}`21`.
18
+ - Allow importing a pre-computed dataset of transfered expression values {pr}`21`.
19
+ - Allow importing pre-computed neighborhood matrices {pr}`21`.
20
+ - Add a tutorial on spatial contextualization and niche identification {pr}`21`.
21
+ - Add an equal-weight kernel {pr}`22`.
22
+
13
23
  ## [v0.1.2]
14
24
 
15
25
  ### Added
16
26
  - Included tests for the `check` module, and more tests for the main classes {pr}`15`.
17
27
  - Implemented the computation of presence scores, following HNOCA-tools {pr}`16`.
18
- - Add a `groupby` parameter to expression transfer evaluation {pr}`16`.
19
- - Add a `test_var_key` parameter to expression transfer evaluation {pr}`19`.
20
- - Add a tutorial on spatial mapping {pr}`19`.
28
+ - Added a `groupby` parameter to expression transfer evaluation {pr}`16`.
29
+ - Added a `test_var_key` parameter to expression transfer evaluation {pr}`19`.
30
+ - Added a tutorial on spatial mapping {pr}`19`.
21
31
 
22
32
  ## [v0.1.1]
23
33
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cellmapper
3
- Version: 0.1.2
3
+ Version: 0.1.3
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
@@ -65,9 +65,14 @@ Requires-Dist: sphinxext-opengraph; extra == 'doc'
65
65
  Provides-Extra: test
66
66
  Requires-Dist: coverage; extra == 'test'
67
67
  Requires-Dist: pytest; extra == 'test'
68
+ Requires-Dist: squidpy; extra == 'test'
68
69
  Provides-Extra: tutorials
69
70
  Requires-Dist: harmony-pytorch; extra == 'tutorials'
71
+ Requires-Dist: netgraph; extra == 'tutorials'
72
+ Requires-Dist: python-louvain; extra == 'tutorials'
73
+ Requires-Dist: scvi-tools; extra == 'tutorials'
70
74
  Requires-Dist: seaborn; extra == 'tutorials'
75
+ Requires-Dist: sopa; extra == 'tutorials'
71
76
  Requires-Dist: squidpy; extra == 'tutorials'
72
77
  Description-Content-Type: text/markdown
73
78
 
@@ -89,6 +94,16 @@ k-NN-based mapping of cells across representations to tranfer labels, embeddings
89
94
 
90
95
  Inspired by scanpy's [ingest][] and the [HNOCA-tools][] packages. Check out the [docs][] to learn more, in particular our [tutorials][].
91
96
 
97
+ ## Key use cases
98
+
99
+ - Transfer cell type labels and expression values from dissociated to spatial datasets.
100
+ - Transfer embeddings between arbitrary query and reference datasets.
101
+ - Compute presence scores for query datasets in large reference atlasses.
102
+ - Identify niches in spatial datasets by contextualizing latent spaces in spatial coordinates.
103
+ - Evaluate the results of transferring labels, embeddings and feature spaces using a variety of metrics.
104
+
105
+ 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.
106
+
92
107
  ## Installation
93
108
 
94
109
  You need to have Python 3.10 or newer installed on your system.
@@ -110,20 +125,20 @@ There are two alternative options to install ``cellmapper``:
110
125
 
111
126
  ## Getting started
112
127
 
113
- This package assumes that you have ``ref`` and ``query`` AnnData objects, with a joint embedding computed and stored in ``.obsm``. We explicilty do not compute this joint embedding, but there are plenty of method you can use to get such joint embeddings, 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!
128
+ This package assumes that you have ``query`` and ``reference`` AnnData objects, with a joint embedding computed and stored in ``.obsm``. We explicilty do not compute this joint embedding, but there are plenty of method you can use to get such joint embeddings, 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!
114
129
 
115
130
  With a joint embedding in ``.obsm["X_joint"]`` at hand, the simplest way to use ``CellMapper`` is as follows:
116
131
  ```Python
117
132
  from cellmapper import CellMapper
118
133
 
119
- cmap = CellMapper(ref, query).fit(
134
+ cmap = CellMapper(query, reference).fit(
120
135
  use_rep="X_joint", obs_keys="celltype", obsm_keys="X_umap", layer_key="X"
121
136
  )
122
137
  ```
123
138
 
124
- This will transfer data from the reference to the query dataset, including celltype labels stored in ``ref.obs``, a UMAP embedding stored in ``ref.obsm``, and expression values stored in ``ref.X``.
139
+ 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``.
125
140
 
126
- 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. Check out the [docs][] to learn more.
141
+ 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.
127
142
 
128
143
  ## Release notes
129
144
 
@@ -147,7 +162,11 @@ Please cite this GitHub repo if you find CellMapper useful for your research.
147
162
  [coverage]: https://codecov.io/gh/quadbio/cellmapper
148
163
  [pre-commit]: https://results.pre-commit.ci/latest/github/quadbio/cellmapper/main
149
164
  [pypi]: https://pypi.org/project/cellmapper/
165
+
150
166
  [faiss]: https://github.com/facebookresearch/faiss
167
+ [pynndescent]: https://github.com/lmcinnes/pynndescent
168
+ [sklearn]: https://scikit-learn.org/stable/modules/neighbors.html
169
+ [rapids]: https://docs.rapids.ai/api/cuml/stable/api/#nearest-neighbors
151
170
 
152
171
  [ingest]: https://scanpy.readthedocs.io/en/stable/generated/scanpy.tl.ingest.html
153
172
  [HNOCA-tools]: https://devsystemslab.github.io/HNOCA-tools/
@@ -16,6 +16,16 @@ k-NN-based mapping of cells across representations to tranfer labels, embeddings
16
16
 
17
17
  Inspired by scanpy's [ingest][] and the [HNOCA-tools][] packages. Check out the [docs][] to learn more, in particular our [tutorials][].
18
18
 
19
+ ## Key use cases
20
+
21
+ - Transfer cell type labels and expression values from dissociated to spatial datasets.
22
+ - Transfer embeddings between arbitrary query and reference datasets.
23
+ - Compute presence scores for query datasets in large reference atlasses.
24
+ - Identify niches in spatial datasets by contextualizing latent spaces in spatial coordinates.
25
+ - Evaluate the results of transferring labels, embeddings and feature spaces using a variety of metrics.
26
+
27
+ 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.
28
+
19
29
  ## Installation
20
30
 
21
31
  You need to have Python 3.10 or newer installed on your system.
@@ -37,20 +47,20 @@ There are two alternative options to install ``cellmapper``:
37
47
 
38
48
  ## Getting started
39
49
 
40
- This package assumes that you have ``ref`` and ``query`` AnnData objects, with a joint embedding computed and stored in ``.obsm``. We explicilty do not compute this joint embedding, but there are plenty of method you can use to get such joint embeddings, 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!
50
+ This package assumes that you have ``query`` and ``reference`` AnnData objects, with a joint embedding computed and stored in ``.obsm``. We explicilty do not compute this joint embedding, but there are plenty of method you can use to get such joint embeddings, 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!
41
51
 
42
52
  With a joint embedding in ``.obsm["X_joint"]`` at hand, the simplest way to use ``CellMapper`` is as follows:
43
53
  ```Python
44
54
  from cellmapper import CellMapper
45
55
 
46
- cmap = CellMapper(ref, query).fit(
56
+ cmap = CellMapper(query, reference).fit(
47
57
  use_rep="X_joint", obs_keys="celltype", obsm_keys="X_umap", layer_key="X"
48
58
  )
49
59
  ```
50
60
 
51
- This will transfer data from the reference to the query dataset, including celltype labels stored in ``ref.obs``, a UMAP embedding stored in ``ref.obsm``, and expression values stored in ``ref.X``.
61
+ 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``.
52
62
 
53
- 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. Check out the [docs][] to learn more.
63
+ 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.
54
64
 
55
65
  ## Release notes
56
66
 
@@ -74,7 +84,11 @@ Please cite this GitHub repo if you find CellMapper useful for your research.
74
84
  [coverage]: https://codecov.io/gh/quadbio/cellmapper
75
85
  [pre-commit]: https://results.pre-commit.ci/latest/github/quadbio/cellmapper/main
76
86
  [pypi]: https://pypi.org/project/cellmapper/
87
+
77
88
  [faiss]: https://github.com/facebookresearch/faiss
89
+ [pynndescent]: https://github.com/lmcinnes/pynndescent
90
+ [sklearn]: https://scikit-learn.org/stable/modules/neighbors.html
91
+ [rapids]: https://docs.rapids.ai/api/cuml/stable/api/#nearest-neighbors
78
92
 
79
93
  [ingest]: https://scanpy.readthedocs.io/en/stable/generated/scanpy.tl.ingest.html
80
94
  [HNOCA-tools]: https://devsystemslab.github.io/HNOCA-tools/