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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| m3_sc-0.3.1.tar.gz | 29.8 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| m3_sc-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 59.6 MB
Release files / m3_sc-0.3.1.tar.gz
| Download URL | m3_sc-0.3.1.tar.gz |
|---|---|
| Size | 29.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
144740264a3bc3e7c4691fdcc9bcda7a040847b0713f5b58fa58ae301ea16eb1
|
|
BLAKE2b-256 checksum How to use checksums |
47ee9c90f00894f165af2c7deeebccefe605102fe36075389e0aadc7d97f702f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 16, 2026.
Transparency logRelease files / m3_sc-0.3.1-py3-none-any.whl
| Download URL | m3_sc-0.3.1-py3-none-any.whl |
|---|---|
| Size | 29.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65b189f20939a517564742f7d4acc9500b37c4af172778360a2c5bbe504a76c9
|
|
BLAKE2b-256 checksum How to use checksums |
1f96a43f6de8f1e8cecc30c7c09b9fb0787f11ddc9d0ceec8ed6c7d9317043e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 16, 2026.
Transparency log