k-NN-based mapping of cells across representations
Project description
CellMapper
k-NN-based mapping of cells across representations to tranfer 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.
Inspired by scanpy's ingest and the HNOCA-tools packages. Check out the docs to learn more, in particular our tutorials.
Installation
You need to have Python 3.10 or newer installed on your system. If you don't have Python installed, we recommend installing uv.
There are two alternative options to install cellmapper:
-
Install the latest release from PyPI:
pip install cellmapper
-
Install the latest development version:
pip install git+https://github.com/quadbio/cellmapper.git@main
Getting started
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!
With a joint embedding in .obsm["X_joint"] at hand, the simplest way to use CellMapper is as follows:
from cellmapper import CellMapper
cmap = CellMapper(ref, query).fit(
use_rep="X_joint", obs_keys="celltype", obsm_keys="X_umap", layer_key="X"
)
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.
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.
Release notes
See the changelog.
Contact
If you found a bug, please use the issue tracker.
Citation
Please cite this GitHub repo if you find CellMapper useful for your research.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cellmapper-0.1.2.tar.gz.
File metadata
- Download URL: cellmapper-0.1.2.tar.gz
- Upload date:
- Size: 2.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3ddc1ec663c4bb52ef1528e9d7adb0090a9db25bd049955ee1888d12c14add3
|
|
| MD5 |
b75c615534b0f03d9a8830b02dc037c0
|
|
| BLAKE2b-256 |
87be3cd6c74878fe055581f037faae1796c7d0cbac1572b4ac3860957a00778f
|
Provenance
The following attestation bundles were made for cellmapper-0.1.2.tar.gz:
Publisher:
release.yaml on quadbio/cellmapper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cellmapper-0.1.2.tar.gz -
Subject digest:
f3ddc1ec663c4bb52ef1528e9d7adb0090a9db25bd049955ee1888d12c14add3 - Sigstore transparency entry: 206084839
- Sigstore integration time:
-
Permalink:
quadbio/cellmapper@f0fb6ebf79283490a16ad25ad0d2d4f11095b5a9 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/quadbio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@f0fb6ebf79283490a16ad25ad0d2d4f11095b5a9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cellmapper-0.1.2-py3-none-any.whl.
File metadata
- Download URL: cellmapper-0.1.2-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bda17c239a1f7cc4e48a08d9cad9b98cb495003ec593d6b2680a48cc13ac9148
|
|
| MD5 |
4fed0d16f5c65a15cb2d84b91e6b5899
|
|
| BLAKE2b-256 |
e388016df9883604d5a347393b3fabd3ebcc8e3b2a34d5d8921ca7aa457687c3
|
Provenance
The following attestation bundles were made for cellmapper-0.1.2-py3-none-any.whl:
Publisher:
release.yaml on quadbio/cellmapper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cellmapper-0.1.2-py3-none-any.whl -
Subject digest:
bda17c239a1f7cc4e48a08d9cad9b98cb495003ec593d6b2680a48cc13ac9148 - Sigstore transparency entry: 206084850
- Sigstore integration time:
-
Permalink:
quadbio/cellmapper@f0fb6ebf79283490a16ad25ad0d2d4f11095b5a9 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/quadbio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@f0fb6ebf79283490a16ad25ad0d2d4f11095b5a9 -
Trigger Event:
release
-
Statement type: