Skip to main content

M3

M3 is a deep generative framework for condition-aware integration, patient-level inference, and multi-resolution interpretation of multimodal single-cell omics data across many biological conditions and samples.

From one shared, condition-aware representation, M3 delivers six downstream tasks: factorised dimension reduction, condition-aware batch correction, mosaic integration + imputation, patient-level condition inference, patient/sample generation, and multi-resolution attribution.

📖 Documentation & tutorials: https://pyanglab.github.io/M3/

System requirements

M3 runs on Linux with Python 3.10–3.12. All dependencies are installed automatically via pip (see pyproject.toml), and no non-standard hardware is required (a GPU is optional).

Install

Installation typically takes a few minutes (a few seconds if PyTorch is already installed).

Python

pip install m3-sc      # imported as `import m3`

PyTorch comes along automatically. If you need a build matched to a specific CUDA version, install it first and pip will keep it:

pip install torch --index-url https://download.pytorch.org/whl/cu121
pip install m3-sc

For the development version: pip install "git+https://github.com/PYangLab/M3.git".

R

install.packages("remotes")
remotes::install_github("PYangLab/M3", subdir = "m3-r")

The R package provisions its own Python engine through basilisk on first use — no manual Python / PyTorch setup, and R and Python produce identical results.

Quickstart (Python)

import m3

data  = m3.datasets.liu_demo()                                  # built-in demo
model = m3.M3(data, condition_keys=["cond_group"],
              celltype_key="mergedcelltype").train()
emb   = model.embedding(part="bio")                             # integrated embedding

More demos, together with their expected outputs, are available in the tutorials.

Using M3 on your own data

M3 takes raw counts: one count matrix per modality (RNA and/or ADT and/or ATAC) and cell metadata with a batch column and one or two condition columns; the donor-level tasks also need donor and cell-type columns. With one .h5ad per modality, m3.read_h5ad({"rna": "rna.h5ad", "adt": "adt.h5ad"}) reads every batch at once and matches the cells by name (m3.from_anndata does the same for AnnData in memory), then build and train the model as in the Quickstart. See the documentation for the full workflow.

Repository layout

Path What
src/m3/ the m3-sc Python package (PyTorch engine vendored under _engine/)
m3-r/ the R package — library(m3), basilisk-wrapped, same engine
website/ documentation site (MkDocs Material); mkdocs serve -f website/mkdocs.yml
.github/workflows/deploy.yml builds + publishes the docs to GitHub Pages
tests/ Python test suite

License

See LICENSE.

Metadata

Release files for m3-sc 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for m3-sc 0.5.0
File Size Uploaded Provenance Actions
m3_sc-0.5.0.tar.gz 33.2 MB With provenance Details for m3_sc-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for m3-sc 0.5.0
File Interpreter ABI Platform Actions
m3_sc-0.5.0-py3-none-any.whl Python 3 none any Details for m3_sc-0.5.0-py3-none-any.whl

Total release size: 66.5 MB

Release files / m3_sc-0.5.0.tar.gz

Download URL m3_sc-0.5.0.tar.gz
Size 33.2 MB
Tags Source
SHA-256 checksum
How to use checksums
296a76225256a6ca91ed5ce64367d9247dd63880341e293c87836fe1d7ee5fce
BLAKE2b-256 checksum
How to use checksums
bb3541b23144ef1bcf9c0109c6eaa260602bd51361ceac4c740b20896f229253
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / m3_sc-0.5.0-py3-none-any.whl

Download URL m3_sc-0.5.0-py3-none-any.whl
Size 33.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
f543d4511df3fd4a7be50e574cc7f8d516cba0d63c93ac98845c9c088572dcaa
BLAKE2b-256 checksum
How to use checksums
a7eec93aa3f0479fc4c1dfc5a5e20f19f39a8bb00e7842878d27a5aae1774eae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for m3-sc 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for m3_sc-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page