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. Each batch needs a count matrix (RNA and/or ADT and/or ATAC) and cell metadata with donor, cell type, condition and batch columns. Load batches with m3.read_h5ad (or m3.read_h5 / m3.from_anndata), combine them with m3.concat, 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.4.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.4.0
File Size Uploaded Provenance Actions
m3_sc-0.4.0.tar.gz 33.2 MB With provenance Details for m3_sc-0.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 66.5 MB

Release files / m3_sc-0.4.0.tar.gz

Download URL m3_sc-0.4.0.tar.gz
Size 33.2 MB
Tags Source
SHA-256 checksum
How to use checksums
a514918ad5ad343a6104a6816a2f7ccf7bff518707b8ce623abb1cea8318dc87
BLAKE2b-256 checksum
How to use checksums
50582f51d1b4ec15774528f51a63592f2f325c4f9fc2aeb5e69d2d388550e09d
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 16, 2026.

Transparency log

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

Download URL m3_sc-0.4.0-py3-none-any.whl
Size 33.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
a1987948428f0dc88a2272f25cfec81b80b547c1982a605a1341897ab928eb67
BLAKE2b-256 checksum
How to use checksums
4abee8fd6c659a0ecfa20eb450d53b29e5be8fdb79215947d7d4e7c7c2bbb10c
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 16, 2026.

Transparency log

Security for m3-sc 0.4.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.4.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 16, 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