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.2.tar.gz (12.9 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.2-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: refcm-0.1.2.tar.gz
  • Upload date:
  • Size: 12.9 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.2.tar.gz
Algorithm Hash digest
SHA256 13dd7a88cfae81a59c633ea121ba1c0a88931fa3ced8a960e7a52931c9f4bdb9
MD5 888ff5f9138cffcc389af8248bfdada2
BLAKE2b-256 eea80635f187028972655e90a1ef2df89585e965186cc8a40d9b16a8b0566c66

See more details on using hashes here.

File details

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

File metadata

  • Download URL: refcm-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fcad72f2c4229d6e45222feb42d1262f90428ee4c68d8baed20d31f0319ffc39
MD5 351d2fe925be80d6938e532842942325
BLAKE2b-256 424b36a2d81cfb281b1b393557b33bc481d8ecc653cad74f6472c94433f93ee9

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