cellmapper 0.2.3__tar.gz → 0.2.5__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.3 → cellmapper-0.2.5}/.cruft.json +3 -3
- {cellmapper-0.2.3 → cellmapper-0.2.5}/.github/ISSUE_TEMPLATE/bug_report.yml +1 -1
- {cellmapper-0.2.3 → cellmapper-0.2.5}/.github/ISSUE_TEMPLATE/feature_request.yml +1 -1
- cellmapper-0.2.5/.github/copilot-instructions.md +206 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/.github/workflows/build.yaml +2 -4
- {cellmapper-0.2.3 → cellmapper-0.2.5}/.github/workflows/release.yaml +2 -4
- {cellmapper-0.2.3 → cellmapper-0.2.5}/.github/workflows/test.yaml +13 -8
- {cellmapper-0.2.3 → cellmapper-0.2.5}/.gitignore +4 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/.pre-commit-config.yaml +5 -14
- cellmapper-0.2.5/.python-version +1 -0
- cellmapper-0.2.5/.readthedocs.yaml +16 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/CHANGELOG.md +27 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/PKG-INFO +9 -7
- {cellmapper-0.2.3 → cellmapper-0.2.5}/README.md +1 -1
- {cellmapper-0.2.3 → cellmapper-0.2.5}/biome.jsonc +3 -2
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/conf.py +8 -4
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/contributing.md +129 -13
- {cellmapper-0.2.3 → cellmapper-0.2.5}/pyproject.toml +13 -10
- {cellmapper-0.2.3 → cellmapper-0.2.5}/src/cellmapper/_docs.py +1 -1
- {cellmapper-0.2.3 → cellmapper-0.2.5}/src/cellmapper/check.py +19 -3
- {cellmapper-0.2.3 → cellmapper-0.2.5}/src/cellmapper/model/_knn_backend.py +45 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/src/cellmapper/model/cellmapper.py +25 -15
- {cellmapper-0.2.3 → cellmapper-0.2.5}/src/cellmapper/model/evaluate.py +47 -12
- {cellmapper-0.2.3 → cellmapper-0.2.5}/src/cellmapper/model/kernel.py +11 -6
- {cellmapper-0.2.3 → cellmapper-0.2.5}/tests/conftest.py +5 -2
- {cellmapper-0.2.3 → cellmapper-0.2.5}/tests/model/test_query_to_reference_mapping.py +1 -1
- {cellmapper-0.2.3 → cellmapper-0.2.5}/tests/model/test_self_mapping.py +23 -9
- {cellmapper-0.2.3 → cellmapper-0.2.5}/tests/test_check.py +16 -0
- cellmapper-0.2.3/.readthedocs.yaml +0 -16
- {cellmapper-0.2.3 → cellmapper-0.2.5}/.codecov.yaml +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/.editorconfig +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/.vscode/extensions.json +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/.vscode/launch.json +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/.vscode/settings.json +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/LICENSE +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/_static/.gitkeep +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/_static/css/custom.css +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/_static/images/cellmapper_logo_dark.svg +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/_static/images/cellmapper_logo_light.svg +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/_templates/.gitkeep +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/_templates/autosummary/class.rst +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/api.md +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/changelog.md +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/extensions/typed_returns.py +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/index.md +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/notebooks/tutorials/data_denoising.ipynb +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/notebooks/tutorials/index.rst +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/notebooks/tutorials/query_to_reference_mapping.ipynb +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/notebooks/tutorials/spatial_mapping.ipynb +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/notebooks/tutorials/spatial_smoothing.ipynb +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/references.bib +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/docs/references.md +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/src/cellmapper/__init__.py +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/src/cellmapper/constants.py +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/src/cellmapper/logging.py +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/src/cellmapper/model/embedding.py +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/src/cellmapper/model/mapping_operator.py +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/src/cellmapper/model/neighbors.py +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/src/cellmapper/utils.py +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/tests/data/precomputed_leiden.csv +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/tests/model/test_embedding.py +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/tests/model/test_evaluate.py +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/tests/model/test_kernel.py +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/tests/model/test_mapping_operator.py +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/tests/model/test_neighbors.py +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/tests/test_basic.py +0 -0
- {cellmapper-0.2.3 → cellmapper-0.2.5}/tests/test_utils.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"template": "https://github.com/scverse/cookiecutter-scverse",
|
|
3
|
-
"commit": "
|
|
4
|
-
"checkout":
|
|
3
|
+
"commit": "6ff5b92b5d44ea6d8a88e47538475718d467db95",
|
|
4
|
+
"checkout": "v0.7.0",
|
|
5
5
|
"context": {
|
|
6
6
|
"cookiecutter": {
|
|
7
7
|
"project_name": "cellmapper",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"trim_blocks": true
|
|
37
37
|
},
|
|
38
38
|
"_template": "https://github.com/scverse/cookiecutter-scverse",
|
|
39
|
-
"_commit": "
|
|
39
|
+
"_commit": "6ff5b92b5d44ea6d8a88e47538475718d467db95"
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"directory": null
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Copilot Instructions for CellMapper
|
|
2
|
+
|
|
3
|
+
## Important Notes
|
|
4
|
+
- Avoid drafting summary documents or endless markdown files. Just summarize in chat what you did, why, and any open questions.
|
|
5
|
+
- Don't update Jupyter notebooks - those are managed manually.
|
|
6
|
+
- When running terminal commands, use `uv run` to execute commands within the project's virtual environment (e.g., `uv run python script.py`).
|
|
7
|
+
- **Testing: ALWAYS use `hatch test`, NEVER `uv run pytest` or standalone pytest.** Hatch manages the test matrix (Python versions, dependencies) that CI uses. See "Testing Strategy" section for details.
|
|
8
|
+
- Rather than making assumptions, ask for clarification when uncertain.
|
|
9
|
+
- **GitHub workflows**: Use GitHub CLI (`gh`) when possible. For GitHub MCP server tools, ensure Docker Desktop is running first (`open -a "Docker Desktop"`).
|
|
10
|
+
|
|
11
|
+
## Project Overview
|
|
12
|
+
|
|
13
|
+
**CellMapper** is a k-NN-based tool for mapping cells across representations to transfer labels, embeddings, and expression values. It works for millions of cells, on CPU and GPU, across molecular modalities, between spatial and non-spatial data. The core idea is to separate the method (k-NN graph with kernels) from the application (mapping across arbitrary representations).
|
|
14
|
+
|
|
15
|
+
### Domain Context (Brief)
|
|
16
|
+
- **AnnData**: Standard single-cell data structure. Contains `.X`, `.obs`, `.var`, `.obsm` (embeddings), `.layers`.
|
|
17
|
+
- **k-NN mapping**: Compute k-nearest neighbors between query and reference datasets, apply graph kernel to create mapping matrix, use it to transfer labels/embeddings/expression.
|
|
18
|
+
- **Joint embeddings**: CellMapper expects pre-computed joint embeddings in `.obsm` from tools like scVI, scANVI, GimVI, ENVI, GLUE, or implements baseline methods (PCA, CCA).
|
|
19
|
+
- **Use cases**: Transfer labels from dissociated to spatial data, map embeddings between datasets, compute presence scores in atlases, identify spatial niches, evaluate mapping quality.
|
|
20
|
+
|
|
21
|
+
### Key Dependencies
|
|
22
|
+
- **Core**: anndata, scanpy, numpy, pandas, scipy, scikit-learn
|
|
23
|
+
- **k-NN backends**: pynndescent, sklearn, faiss (CPU/GPU), rapids (GPU)
|
|
24
|
+
- **Optional**: squidpy (for spatial), scvi-tools, harmony-pytorch (for tutorials)
|
|
25
|
+
|
|
26
|
+
## Architecture & Code Organization
|
|
27
|
+
|
|
28
|
+
### Module Structure (follows scverse conventions)
|
|
29
|
+
- Use `AnnData` objects as primary data structure
|
|
30
|
+
- Type annotations use modern syntax: `str | None` instead of `Optional[str]`
|
|
31
|
+
- Supports Python 3.11, 3.12, 3.13 (see `pyproject.toml`)
|
|
32
|
+
- Avoid local imports unless necessary for circular import resolution
|
|
33
|
+
|
|
34
|
+
### Core Components
|
|
35
|
+
1. **`src/cellmapper/model/cellmapper.py`**: Main `CellMapper` class with `map()` method
|
|
36
|
+
- Inherits from `EvaluationMixin` and `EmbeddingMixin`
|
|
37
|
+
- Handles both query-to-reference and self-mapping modes
|
|
38
|
+
- Core methods: `map()`, `map_obs()`, `map_obsm()`, `map_layers()`
|
|
39
|
+
2. **`src/cellmapper/model/neighbors.py`**: k-NN graph computation with multiple backends
|
|
40
|
+
3. **`src/cellmapper/model/kernel.py`**: Graph kernels for creating mapping matrices
|
|
41
|
+
4. **`src/cellmapper/model/mapping_operator.py`**: Encapsulates mapping matrix with matrix powers for diffusion
|
|
42
|
+
5. **`src/cellmapper/model/evaluate.py`**: Metrics for evaluating label/expression transfer quality
|
|
43
|
+
6. **`src/cellmapper/model/embedding.py`**: Baseline joint embedding methods (PCA, CCA)
|
|
44
|
+
7. **`src/cellmapper/utils.py`**: Utilities (library size adjustment, imputed data creation)
|
|
45
|
+
|
|
46
|
+
## Development Workflow
|
|
47
|
+
|
|
48
|
+
### Environment Management (uv-based)
|
|
49
|
+
```bash
|
|
50
|
+
# Create/sync virtual environment
|
|
51
|
+
uv sync # install project with default dependencies
|
|
52
|
+
uv sync --extra test # include test dependencies
|
|
53
|
+
uv sync --extra doc # include documentation dependencies
|
|
54
|
+
uv sync --all-extras # include all optional dependencies
|
|
55
|
+
|
|
56
|
+
# Run commands in virtual environment
|
|
57
|
+
uv run python script.py # run any Python script
|
|
58
|
+
uv run pytest tests/ # run tests directly (alternative to hatch)
|
|
59
|
+
|
|
60
|
+
# Testing via hatch (recommended, runs test matrix, uses uv internally)
|
|
61
|
+
hatch test # test with highest Python version
|
|
62
|
+
hatch test --all # test all Python 3.11, 3.13, pre-release deps
|
|
63
|
+
|
|
64
|
+
# Documentation
|
|
65
|
+
hatch run docs:build # build Sphinx docs
|
|
66
|
+
hatch run docs:open # open in browser
|
|
67
|
+
hatch run docs:clean # clean build artifacts
|
|
68
|
+
|
|
69
|
+
# Environment inspection
|
|
70
|
+
hatch env show # list environments
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Testing Strategy
|
|
74
|
+
- Test matrix defined in `[[tool.hatch.envs.hatch-test.matrix]]` in `pyproject.toml`
|
|
75
|
+
- Tests Python 3.11 & 3.13 with stable deps, 3.13 with pre-release deps
|
|
76
|
+
- CI extracts test config from pyproject.toml (`.github/workflows/test.yaml`)
|
|
77
|
+
- Tests live in `tests/`, fixtures in `tests/conftest.py`
|
|
78
|
+
- **Always run tests via `hatch test`**, NOT standalone pytest
|
|
79
|
+
|
|
80
|
+
### Code Quality Tools
|
|
81
|
+
- **Ruff**: Linting and formatting (120 char line length)
|
|
82
|
+
- **Biome**: JSON/JSONC formatting with trailing commas
|
|
83
|
+
- **Pre-commit**: Auto-runs ruff, biome. Install with `pre-commit install`
|
|
84
|
+
- Use `git pull --rebase` if pre-commit.ci commits to your branch
|
|
85
|
+
|
|
86
|
+
## Documentation Conventions
|
|
87
|
+
|
|
88
|
+
### Docstring Style (NumPy format via Napoleon)
|
|
89
|
+
```python
|
|
90
|
+
def map_obs(
|
|
91
|
+
self,
|
|
92
|
+
obs_keys: str | list[str],
|
|
93
|
+
*, # keyword-only marker
|
|
94
|
+
prediction_postfix: str = "_predicted",
|
|
95
|
+
confidence_postfix: str = "_confidence",
|
|
96
|
+
) -> pd.DataFrame:
|
|
97
|
+
"""Short one-line description.
|
|
98
|
+
|
|
99
|
+
Extended description if needed.
|
|
100
|
+
|
|
101
|
+
Parameters
|
|
102
|
+
----------
|
|
103
|
+
obs_keys
|
|
104
|
+
Keys in reference.obs to transfer to query.
|
|
105
|
+
prediction_postfix
|
|
106
|
+
Suffix for predicted column names.
|
|
107
|
+
confidence_postfix
|
|
108
|
+
Suffix for confidence score column names.
|
|
109
|
+
|
|
110
|
+
Returns
|
|
111
|
+
-------
|
|
112
|
+
DataFrame with transferred labels and confidence scores.
|
|
113
|
+
"""
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Sphinx & Documentation
|
|
117
|
+
- API docs auto-generated from `docs/api.md` using `autosummary`
|
|
118
|
+
- Tutorials in `docs/notebooks/tutorials/` rendered via myst-nb (`.ipynb` only)
|
|
119
|
+
- Add external packages to `intersphinx_mapping` in `docs/conf.py`
|
|
120
|
+
- See `docs/contributing.md` for detailed documentation guidelines
|
|
121
|
+
|
|
122
|
+
## Key Configuration Files
|
|
123
|
+
|
|
124
|
+
### `pyproject.toml`
|
|
125
|
+
- **Build**: `hatchling` with `hatch-vcs` for git-based versioning
|
|
126
|
+
- **Dependencies**: Minimal runtime deps; optional extras for `[test]`, `[doc]`, `[tutorials]`
|
|
127
|
+
- **Ruff**: 120 char line length, NumPy docstring convention
|
|
128
|
+
- **Test matrix**: Python 3.11 & 3.13 (stable), 3.13 (pre-release)
|
|
129
|
+
|
|
130
|
+
### Version Management
|
|
131
|
+
- Version from git tags via `hatch-vcs`
|
|
132
|
+
- Release: Create GitHub release with tag `vX.X.X`
|
|
133
|
+
- Follows **Semantic Versioning**
|
|
134
|
+
|
|
135
|
+
## Project-Specific Patterns
|
|
136
|
+
|
|
137
|
+
### Basic Usage Pattern
|
|
138
|
+
```python
|
|
139
|
+
from cellmapper import CellMapper
|
|
140
|
+
|
|
141
|
+
# Assume query and reference have joint embedding in .obsm["X_joint"]
|
|
142
|
+
cmap = CellMapper(query, reference).map(
|
|
143
|
+
use_rep="X_joint",
|
|
144
|
+
obs_keys="celltype", # transfer labels
|
|
145
|
+
obsm_keys="X_umap", # transfer UMAP
|
|
146
|
+
layer_key="counts", # transfer expression
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
# Self-mapping (for spatial contextualization, denoising)
|
|
150
|
+
cmap_self = CellMapper(query).map(
|
|
151
|
+
use_rep="X_pca",
|
|
152
|
+
layer_key="counts",
|
|
153
|
+
)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### k-NN Backends
|
|
157
|
+
- **pynndescent**: Fast approximate k-NN, CPU-only
|
|
158
|
+
- **sklearn**: Exact k-NN, CPU-only, slower for large datasets
|
|
159
|
+
- **faiss**: Exact/approximate k-NN, supports CPU and GPU (via faiss-gpu)
|
|
160
|
+
- **rapids**: GPU-accelerated k-NN using cuML
|
|
161
|
+
|
|
162
|
+
### Mapping Workflow
|
|
163
|
+
1. Compute k-NN graph between query and reference (or self)
|
|
164
|
+
2. Apply kernel to k-NN graph to create mapping matrix M
|
|
165
|
+
3. Transfer data: `query_data = M @ reference_data`
|
|
166
|
+
4. Optionally apply matrix powers `M^t` for diffusion
|
|
167
|
+
5. Evaluate transfer quality with metrics
|
|
168
|
+
|
|
169
|
+
### AnnData Conventions
|
|
170
|
+
- Check matrix format: `adata.X` may be sparse or dense
|
|
171
|
+
- Use `adata.layers[key]` for alternative representations (e.g., counts, log-normalized)
|
|
172
|
+
- Joint embeddings stored in `adata.obsm["X_<method>"]`
|
|
173
|
+
- Transferred data goes back into query's `.obs`, `.obsm`, `.layers`
|
|
174
|
+
|
|
175
|
+
### Testing with AnnData
|
|
176
|
+
```python
|
|
177
|
+
# From conftest.py - example fixture pattern
|
|
178
|
+
@pytest.fixture
|
|
179
|
+
def adata_spatial():
|
|
180
|
+
"""Small spatial AnnData object with spatial coordinates."""
|
|
181
|
+
adata = ad.AnnData(
|
|
182
|
+
X=np.random.randn(100, 50).astype(np.float32),
|
|
183
|
+
obs=pd.DataFrame({"celltype": ["A", "B"] * 50}),
|
|
184
|
+
obsm={"spatial": np.random.rand(100, 2)},
|
|
185
|
+
)
|
|
186
|
+
sc.pp.pca(adata)
|
|
187
|
+
return adata
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Common Gotchas
|
|
191
|
+
|
|
192
|
+
1. **Hatch for testing**: Always use `hatch test`, never standalone `pytest`. CI matches hatch test matrix.
|
|
193
|
+
2. **Joint embeddings required**: Most use cases require pre-computed joint embedding in `.obsm`. Don't assume PCA is sufficient for complex mappings.
|
|
194
|
+
3. **Sparse matrices**: Check `scipy.sparse.issparse(adata.X)` before operations. Mapping matrices are typically dense.
|
|
195
|
+
4. **Self-mapping mode**: If `reference` is `None` or same as `query`, automatically enters self-mapping mode.
|
|
196
|
+
5. **k-NN backends**: faiss requires `faiss-cpu` or `faiss-gpu`, rapids requires CUDA environment. Handle gracefully with fallbacks.
|
|
197
|
+
6. **Pre-commit conflicts**: Use `git pull --rebase` to integrate pre-commit.ci fixes.
|
|
198
|
+
7. **Line length**: Ruff set to 120 chars, but keep docstrings readable (~80 chars per line).
|
|
199
|
+
|
|
200
|
+
## Related Resources
|
|
201
|
+
|
|
202
|
+
- **Contributing guide**: `docs/contributing.md`
|
|
203
|
+
- **Tutorials**: `docs/notebooks/tutorials/`
|
|
204
|
+
- **scanpy docs**: https://scanpy.readthedocs.io/
|
|
205
|
+
- **faiss docs**: https://github.com/facebookresearch/faiss
|
|
206
|
+
- **squidpy docs**: https://squidpy.readthedocs.io/ (for spatial analysis)
|
|
@@ -19,14 +19,12 @@ jobs:
|
|
|
19
19
|
package:
|
|
20
20
|
runs-on: ubuntu-latest
|
|
21
21
|
steps:
|
|
22
|
-
- uses: actions/checkout@
|
|
22
|
+
- uses: actions/checkout@v5
|
|
23
23
|
with:
|
|
24
24
|
filter: blob:none
|
|
25
25
|
fetch-depth: 0
|
|
26
26
|
- name: Install uv
|
|
27
|
-
uses: astral-sh/setup-uv@
|
|
28
|
-
with:
|
|
29
|
-
cache-dependency-glob: pyproject.toml
|
|
27
|
+
uses: astral-sh/setup-uv@v7
|
|
30
28
|
- name: Build package
|
|
31
29
|
run: uv build
|
|
32
30
|
- name: Check package
|
|
@@ -20,14 +20,12 @@ jobs:
|
|
|
20
20
|
permissions:
|
|
21
21
|
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
|
22
22
|
steps:
|
|
23
|
-
- uses: actions/checkout@
|
|
23
|
+
- uses: actions/checkout@v5
|
|
24
24
|
with:
|
|
25
25
|
filter: blob:none
|
|
26
26
|
fetch-depth: 0
|
|
27
27
|
- name: Install uv
|
|
28
|
-
uses: astral-sh/setup-uv@
|
|
29
|
-
with:
|
|
30
|
-
cache-dependency-glob: pyproject.toml
|
|
28
|
+
uses: astral-sh/setup-uv@v7
|
|
31
29
|
- name: Build package
|
|
32
30
|
run: uv build
|
|
33
31
|
- name: Publish package distributions to PyPI
|
|
@@ -28,12 +28,12 @@ jobs:
|
|
|
28
28
|
outputs:
|
|
29
29
|
envs: ${{ steps.get-envs.outputs.envs }}
|
|
30
30
|
steps:
|
|
31
|
-
- uses: actions/checkout@
|
|
31
|
+
- uses: actions/checkout@v5
|
|
32
32
|
with:
|
|
33
33
|
filter: blob:none
|
|
34
34
|
fetch-depth: 0
|
|
35
35
|
- name: Install uv
|
|
36
|
-
uses: astral-sh/setup-uv@
|
|
36
|
+
uses: astral-sh/setup-uv@v7
|
|
37
37
|
- name: Get test environments
|
|
38
38
|
id: get-envs
|
|
39
39
|
run: |
|
|
@@ -60,17 +60,18 @@ jobs:
|
|
|
60
60
|
|
|
61
61
|
name: ${{ matrix.env.label }}
|
|
62
62
|
runs-on: ${{ matrix.os }}
|
|
63
|
+
# Allow pre-release tests to fail without blocking the PR (dependency compatibility issues)
|
|
64
|
+
continue-on-error: ${{ contains(matrix.env.name, 'pre') }}
|
|
63
65
|
|
|
64
66
|
steps:
|
|
65
|
-
- uses: actions/checkout@
|
|
67
|
+
- uses: actions/checkout@v5
|
|
66
68
|
with:
|
|
67
69
|
filter: blob:none
|
|
68
70
|
fetch-depth: 0
|
|
69
71
|
- name: Install uv
|
|
70
|
-
uses: astral-sh/setup-uv@
|
|
72
|
+
uses: astral-sh/setup-uv@v7
|
|
71
73
|
with:
|
|
72
74
|
python-version: ${{ matrix.env.python }}
|
|
73
|
-
cache-dependency-glob: pyproject.toml
|
|
74
75
|
- name: create hatch environment
|
|
75
76
|
run: uvx hatch env create ${{ matrix.env.name }}
|
|
76
77
|
- name: run tests using hatch
|
|
@@ -78,11 +79,15 @@ jobs:
|
|
|
78
79
|
MPLBACKEND: agg
|
|
79
80
|
PLATFORM: ${{ matrix.os }}
|
|
80
81
|
DISPLAY: :42
|
|
81
|
-
run: uvx hatch run ${{ matrix.env.name }}:run-cov
|
|
82
|
+
run: uvx hatch run ${{ matrix.env.name }}:run-cov -v --color=yes -n auto
|
|
82
83
|
- name: generate coverage report
|
|
83
|
-
run:
|
|
84
|
+
run: |
|
|
85
|
+
# See https://coverage.readthedocs.io/en/latest/config.html#run-patch
|
|
86
|
+
test -f .coverage || uvx hatch run ${{ matrix.env.name }}:cov-combine
|
|
87
|
+
uvx hatch run ${{ matrix.env.name }}:cov-report # report visibly
|
|
88
|
+
uvx hatch run ${{ matrix.env.name }}:coverage xml # create report for upload
|
|
84
89
|
- name: Upload coverage
|
|
85
|
-
uses: codecov/codecov-action@
|
|
90
|
+
uses: codecov/codecov-action@v5
|
|
86
91
|
with:
|
|
87
92
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
88
93
|
|
|
@@ -7,24 +7,24 @@ default_stages:
|
|
|
7
7
|
minimum_pre_commit_version: 2.16.0
|
|
8
8
|
repos:
|
|
9
9
|
- repo: https://github.com/biomejs/pre-commit
|
|
10
|
-
rev:
|
|
10
|
+
rev: v2.3.10
|
|
11
11
|
hooks:
|
|
12
12
|
- id: biome-format
|
|
13
13
|
exclude: ^\.cruft\.json$ # inconsistent indentation with cruft - file never to be modified manually.
|
|
14
14
|
- repo: https://github.com/tox-dev/pyproject-fmt
|
|
15
|
-
rev: v2.
|
|
15
|
+
rev: v2.11.1
|
|
16
16
|
hooks:
|
|
17
17
|
- id: pyproject-fmt
|
|
18
18
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
19
|
-
rev: v0.11
|
|
19
|
+
rev: v0.14.11
|
|
20
20
|
hooks:
|
|
21
|
-
- id: ruff
|
|
21
|
+
- id: ruff-check
|
|
22
22
|
types_or: [python, pyi, jupyter]
|
|
23
23
|
args: [--fix, --exit-non-zero-on-fix]
|
|
24
24
|
- id: ruff-format
|
|
25
25
|
types_or: [python, pyi, jupyter]
|
|
26
26
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
27
|
-
rev:
|
|
27
|
+
rev: v6.0.0
|
|
28
28
|
hooks:
|
|
29
29
|
- id: detect-private-key
|
|
30
30
|
- id: check-ast
|
|
@@ -36,12 +36,3 @@ repos:
|
|
|
36
36
|
# Check that there are no merge conflicts (could be generated by template sync)
|
|
37
37
|
- id: check-merge-conflict
|
|
38
38
|
args: [--assume-in-merge]
|
|
39
|
-
- repo: local
|
|
40
|
-
hooks:
|
|
41
|
-
- id: forbid-to-commit
|
|
42
|
-
name: Don't commit rej files
|
|
43
|
-
entry: |
|
|
44
|
-
Cannot commit .rej files. These indicate merge conflicts that arise during automated template updates.
|
|
45
|
-
Fix the merge conflicts manually and remove the .rej files.
|
|
46
|
-
language: fail
|
|
47
|
-
files: '.*\.rej$'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# https://docs.readthedocs.io/en/stable/config-file/v2.html
|
|
2
|
+
version: 2
|
|
3
|
+
build:
|
|
4
|
+
os: ubuntu-24.04
|
|
5
|
+
tools:
|
|
6
|
+
python: "3.13"
|
|
7
|
+
nodejs: latest
|
|
8
|
+
jobs:
|
|
9
|
+
create_environment:
|
|
10
|
+
- asdf plugin add uv
|
|
11
|
+
- asdf install uv latest
|
|
12
|
+
- asdf global uv latest
|
|
13
|
+
build:
|
|
14
|
+
html:
|
|
15
|
+
- uvx hatch run docs:build
|
|
16
|
+
- mv docs/_build $READTHEDOCS_OUTPUT
|
|
@@ -10,6 +10,33 @@ and this project adheres to [Semantic Versioning][].
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [v0.2.5]
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- Added `batch_size` parameter to `Kernel.compute_neighbors()` for backend-agnostic batching {pr}`60`
|
|
17
|
+
- Added `subset` parameter to `plot_confusion_matrix()` for filtering cells {pr}`60`
|
|
18
|
+
- Added Python 3.14 support {pr}`62`
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- Default postfixes now include underscore: `"_pred"` and `"_conf"` instead of `"pred"` and `"conf"` {pr}`60`
|
|
22
|
+
- Switched from MathJax to KaTeX for documentation math rendering {pr}`61`
|
|
23
|
+
- Updated GitHub Actions to latest versions (checkout v5, setup-uv v7) {pr}`61`
|
|
24
|
+
- Updated test matrix to Python 3.11/3.14 {pr}`62`
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
- Fixed `PackageNotFoundError` when checking rapids availability in conda environments {pr}`60`
|
|
28
|
+
- Fixed stale k-NN state when `compute_neighbors()` fails {pr}`60`
|
|
29
|
+
- Fixed `plot_confusion_matrix()` handling of NaN values in both y_true and y_pred {pr}`60`
|
|
30
|
+
- Fixed `plot_confusion_matrix()` handling of mismatched category sets {pr}`60`
|
|
31
|
+
- Fixed `plot_confusion_matrix()` handling of float categories {pr}`60`
|
|
32
|
+
- Fixed `importlib.resources.files()` compatibility with Python 3.14 {pr}`62`
|
|
33
|
+
|
|
34
|
+
## [v0.2.4]
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
- Deprecated Python 3.10 support {pr}`55`
|
|
38
|
+
- Updated to cookiecutter-scverse template v0.6.0 {pr}`54`
|
|
39
|
+
|
|
13
40
|
## [v0.2.3]
|
|
14
41
|
|
|
15
42
|
### Changed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cellmapper
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
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
|
|
@@ -30,11 +30,11 @@ License: MIT License
|
|
|
30
30
|
SOFTWARE.
|
|
31
31
|
License-File: LICENSE
|
|
32
32
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
33
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
34
33
|
Classifier: Programming Language :: Python :: 3.11
|
|
35
34
|
Classifier: Programming Language :: Python :: 3.12
|
|
36
35
|
Classifier: Programming Language :: Python :: 3.13
|
|
37
|
-
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
37
|
+
Requires-Python: >=3.11
|
|
38
38
|
Requires-Dist: anndata>=0.11
|
|
39
39
|
Requires-Dist: docrep
|
|
40
40
|
Requires-Dist: numpy
|
|
@@ -49,7 +49,7 @@ Provides-Extra: dev
|
|
|
49
49
|
Requires-Dist: pre-commit; extra == 'dev'
|
|
50
50
|
Requires-Dist: twine>=4.0.2; extra == 'dev'
|
|
51
51
|
Provides-Extra: doc
|
|
52
|
-
Requires-Dist: docutils!=0.18.*,!=0.19
|
|
52
|
+
Requires-Dist: docutils!=0.18.*,!=0.19.*,<0.22,>=0.8; extra == 'doc'
|
|
53
53
|
Requires-Dist: ipykernel; extra == 'doc'
|
|
54
54
|
Requires-Dist: ipython; extra == 'doc'
|
|
55
55
|
Requires-Dist: myst-nb>=1.1; extra == 'doc'
|
|
@@ -59,13 +59,15 @@ Requires-Dist: sphinx-autodoc-typehints; extra == 'doc'
|
|
|
59
59
|
Requires-Dist: sphinx-book-theme>=1; extra == 'doc'
|
|
60
60
|
Requires-Dist: sphinx-copybutton; extra == 'doc'
|
|
61
61
|
Requires-Dist: sphinx-tabs; extra == 'doc'
|
|
62
|
-
Requires-Dist: sphinx>=
|
|
62
|
+
Requires-Dist: sphinx>=8.1; extra == 'doc'
|
|
63
63
|
Requires-Dist: sphinxcontrib-bibtex>=1; extra == 'doc'
|
|
64
|
+
Requires-Dist: sphinxcontrib-katex; extra == 'doc'
|
|
64
65
|
Requires-Dist: sphinxext-opengraph; extra == 'doc'
|
|
65
66
|
Provides-Extra: test
|
|
66
|
-
Requires-Dist: coverage; extra == 'test'
|
|
67
|
+
Requires-Dist: coverage>=7.10; extra == 'test'
|
|
67
68
|
Requires-Dist: faiss-cpu; extra == 'test'
|
|
68
69
|
Requires-Dist: pytest; extra == 'test'
|
|
70
|
+
Requires-Dist: pytest-cov; extra == 'test'
|
|
69
71
|
Requires-Dist: squidpy>=1.6; extra == 'test'
|
|
70
72
|
Provides-Extra: tutorials
|
|
71
73
|
Requires-Dist: harmony-pytorch; extra == 'tutorials'
|
|
@@ -112,7 +114,7 @@ The core idea of `CellMapper` is to separate the method (k-NN graph with some ke
|
|
|
112
114
|
|
|
113
115
|
## 📦 Installation
|
|
114
116
|
|
|
115
|
-
You need to have 🐍 Python 3.
|
|
117
|
+
You need to have 🐍 Python 3.11 or newer installed on your system.
|
|
116
118
|
If you don't have Python installed, we recommend installing [uv][].
|
|
117
119
|
|
|
118
120
|
There are two alternative options to install ``cellmapper``:
|
|
@@ -32,7 +32,7 @@ The core idea of `CellMapper` is to separate the method (k-NN graph with some ke
|
|
|
32
32
|
|
|
33
33
|
## 📦 Installation
|
|
34
34
|
|
|
35
|
-
You need to have 🐍 Python 3.
|
|
35
|
+
You need to have 🐍 Python 3.11 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``:
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://biomejs.dev/schemas/
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.2.0/schema.json",
|
|
3
|
+
"vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true },
|
|
3
4
|
"formatter": { "useEditorconfig": true },
|
|
4
5
|
"overrides": [
|
|
5
6
|
{
|
|
6
|
-
"
|
|
7
|
+
"includes": ["./.vscode/*.json", "**/*.jsonc"],
|
|
7
8
|
"json": {
|
|
8
9
|
"formatter": { "trailingCommas": "all" },
|
|
9
10
|
"parser": {
|
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
6
6
|
|
|
7
7
|
# -- Path setup --------------------------------------------------------------
|
|
8
|
+
import shutil
|
|
8
9
|
import sys
|
|
9
10
|
from datetime import datetime
|
|
10
11
|
from importlib.metadata import metadata
|
|
11
12
|
from pathlib import Path
|
|
12
13
|
|
|
14
|
+
from sphinxcontrib import katex
|
|
15
|
+
|
|
13
16
|
HERE = Path(__file__).parent
|
|
14
17
|
sys.path.insert(0, str(HERE / "extensions"))
|
|
15
18
|
|
|
@@ -19,7 +22,7 @@ sys.path.insert(0, str(HERE / "extensions"))
|
|
|
19
22
|
# NOTE: If you installed your project in editable mode, this might be stale.
|
|
20
23
|
# If this is the case, reinstall it to refresh the metadata
|
|
21
24
|
info = metadata("cellmapper")
|
|
22
|
-
|
|
25
|
+
project = info["Name"]
|
|
23
26
|
author = info["Author"]
|
|
24
27
|
copyright = f"{datetime.now():%Y}, {author}."
|
|
25
28
|
version = info["Version"]
|
|
@@ -37,7 +40,7 @@ needs_sphinx = "4.0"
|
|
|
37
40
|
html_context = {
|
|
38
41
|
"display_github": True, # Integrate GitHub
|
|
39
42
|
"github_user": "quadbio",
|
|
40
|
-
"github_repo":
|
|
43
|
+
"github_repo": project,
|
|
41
44
|
"github_version": "main",
|
|
42
45
|
"conf_py_path": "/docs/",
|
|
43
46
|
}
|
|
@@ -54,9 +57,9 @@ extensions = [
|
|
|
54
57
|
"sphinx.ext.autosummary",
|
|
55
58
|
"sphinx.ext.napoleon",
|
|
56
59
|
"sphinxcontrib.bibtex",
|
|
60
|
+
"sphinxcontrib.katex",
|
|
57
61
|
"sphinx_autodoc_typehints",
|
|
58
62
|
"sphinx_tabs.tabs",
|
|
59
|
-
"sphinx.ext.mathjax",
|
|
60
63
|
"IPython.sphinxext.ipython_console_highlighting",
|
|
61
64
|
"sphinxext.opengraph",
|
|
62
65
|
*[p.stem for p in (HERE / "extensions").glob("*.py")],
|
|
@@ -121,7 +124,7 @@ html_theme = "sphinx_book_theme"
|
|
|
121
124
|
html_static_path = ["_static"]
|
|
122
125
|
html_css_files = ["css/custom.css"]
|
|
123
126
|
|
|
124
|
-
html_title =
|
|
127
|
+
html_title = project
|
|
125
128
|
|
|
126
129
|
html_theme_options = {
|
|
127
130
|
"repository_url": repository_url,
|
|
@@ -135,6 +138,7 @@ html_theme_options = {
|
|
|
135
138
|
}
|
|
136
139
|
|
|
137
140
|
pygments_style = "default"
|
|
141
|
+
katex_prerender = shutil.which(katex.NODEJS_BINARY) is not None
|
|
138
142
|
|
|
139
143
|
nitpick_ignore = [
|
|
140
144
|
# If building the documentation fails because of a missing link that is outside your control,
|