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

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

Built distribution (wheel)

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

Total release size: 59.6 MB

Release files / m3_sc-0.3.3.tar.gz

Download URL m3_sc-0.3.3.tar.gz
Size 29.8 MB
Tags Source
SHA-256 checksum
How to use checksums
17a80ab3b26c6a5333f389a78f8836eac2d2eb2ee0f663a252d40b38f340293e
BLAKE2b-256 checksum
How to use checksums
384ba8cb1e7780273e109444a05d740e88148aa24619eb88605c9b2fee466199
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 13, 2026.

Transparency log

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

Download URL m3_sc-0.3.3-py3-none-any.whl
Size 29.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
053aa02512fe11cf7b8a49073673e518714b62c570888f1b3cf4ba5a7a09e37f
BLAKE2b-256 checksum
How to use checksums
a967efed1caeb3efeb846b188ec0f1a1a42a694c3822c623e2d220f388b76668
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 13, 2026.

Transparency log

Security for m3-sc 0.3.3

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.3.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 13, 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