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.3.2

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.3.2
File Size Uploaded Provenance Actions
m3_sc-0.3.2.tar.gz 29.8 MB With provenance Details for m3_sc-0.3.2.tar.gz

Built distribution (wheel)

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

Total release size: 59.6 MB

Release files / m3_sc-0.3.2.tar.gz

Download URL m3_sc-0.3.2.tar.gz
Size 29.8 MB
Tags Source
SHA-256 checksum
How to use checksums
d37e4e689b731b337f22188f742a099f81554dc4881b226cd1804a0359d8f276
BLAKE2b-256 checksum
How to use checksums
46676e9836bd73cb46d6f26e6d07a510309e809c473034b916f51f2c0e9614d5
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 12, 2026.

Transparency log

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

Download URL m3_sc-0.3.2-py3-none-any.whl
Size 29.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
6b6322e61ec7d62339b44f3be66ba0adf3509102c31aa05be9a7bc373f3a7aa8
BLAKE2b-256 checksum
How to use checksums
7762e6cfb8af8f6affea19df89981410ada59d345c363df925e7d832a9a16b0c
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 12, 2026.

Transparency log

Security for m3-sc 0.3.2

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.3.2.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 12, 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