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-0.1.3.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-0.1.3-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: refcm-0.1.3.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-0.1.3.tar.gz
Algorithm Hash digest
SHA256 20dd7517b8248eb7a4307524fe20ecc42ce7aacf7660118a8022993c48f9e311
MD5 eb807b4b8e30647109167d79e503318b
BLAKE2b-256 7f9aa90da212cf06d5c0b7c290cf993c0eee0f81fcf37c188fbf78c12dfd2d1f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: refcm-0.1.3-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-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3655198ac73986d3a230e06475d435f041fba42f132b3386450b94a3a506d25a
MD5 941cc24df7a45a8d06059cfbeea5bf0f
BLAKE2b-256 68b2e0e4fd0ac369b2ba6a1135201e045b2b24e49b4dd45e75b6dcbbc1a93a45

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