Skip to main content

RefCM is a computational method that combines optimal transport and integer programming to enhance the annotation of scRNA clusters using established reference datasets.

Project description

PyPI version Python versions License

RefCM: Reference Cluster-Mapping

RefCM is an automated tool for cell type annotation across single-cell RNA-seq datasets. It leverages optimal transport to align cell-type clusters across tissues, sequencing technologies, and species.

This repository supports reproducing the results from our paper and helps others apply RefCM to their own datasets.

overview

Table of Contents

About

The primary purpose of this repository is to enable the reproduction of the results reported in the paper, and help others utilize this method towards their own work.

Installation

RefCM is available on PyPI. You can install it using pip:

pip install refcm

If you want to build from source and/or run our benchmarking suite, you can use uv:

uv sync --all-extras

Note: RefCM depends on the GLPK solver.

  • On macOS, install via Homebrew with brew install glpk.
  • On Windows, follow this guide.

After installation, restart your IDE or terminal to ensure the solver is recognized.

Requirements

The package has been tested on:

  • macOS Sequoia (Apple M1 Pro, 32 GB RAM)
  • Windows 11 (Intel i5 4-core CPU, 8 GB RAM)
  • Ubuntu 24.04 (NVIDIA GH200, 480 GB RAM)

There are no strict hardware requirements, aside from the ability to load the query and reference datasets into memory. All analyses, except for the large embryogenesis datasets, were reproducible on the 8 GB Windows system. On the M1 Pro, even the largest datasets completed in under 10 minutes.

Usage

Running RefCM on a given query: AnnData and reference: AnnData dataset pair, assuming clustering information under their respective .obs['cluster'] attributes, can be done as follows. The method expects log-normalized counts to be provided under each dataset's .X attribute.

from refcm import RefCM

rcm = RefCM()
rcm.setref(reference, 'cluster')
rcm.annotate(query, 'cluster')

The resulting annotations are written out to the .obs['refcm'] field in the query's AnnData object, metadata in .uns['refcm'], leaving the remaining fields unchanged.

Examples

We’ve put together a few example Jupyter notebooks under the vignettes folder.

We recommend starting with brain.ipynb, which applies RefCM to the Allen Brain Atlas.

Citation & Contact

If you use RefCM in your work, please consider citing our paper (link coming soon).
Feel free to open an issue or pull request — contributions and feedback are welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

refcm-1.0.1.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

refcm-1.0.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file refcm-1.0.1.tar.gz.

File metadata

  • Download URL: refcm-1.0.1.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for refcm-1.0.1.tar.gz
Algorithm Hash digest
SHA256 78822a61bcf4976cfb25d9d3e0b553b7ae0c33c87dd84c1a61c2b79084e447bd
MD5 013f08a7afb7195f6f41aa3b4de008e1
BLAKE2b-256 2829689c6e555e6b3bdb2d4ba437227cdf6efaf2bb5bc5cb3b2a5f028e2de77b

See more details on using hashes here.

File details

Details for the file refcm-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: refcm-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for refcm-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1e01604d9df7533199849b0e61c777d7ccb4efd282436422324cf2365f85b0de
MD5 3cf6e5bf23f817e97eb14b692c17d199
BLAKE2b-256 a256e0e5122c7f2ce9f4473c98a8b299887d29818bf00a3492768ca7c04ec757

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page