The R package MCube implements the methods in the MMM
paper. MMM, standing for
the Mixture of Mixed Models, is a unified framework for statistical
identification of cell-type-specific spatially variable genes (SVGs) in
spatial transcriptomic (ST) studies.
MMM’s effectiveness stems from our innovations in model and algorithm design:
- Beginning with the raw count data, MMM uses a log-mixture structure to account for cell type composition while simultaneously correcting for the spot and platform effects between ST and single‐cell RNA sequencing (scRNA-seq) data.
- The mixed-effects model decomposes the cell-type-specific gene expression in ST data into three components: the average gene expression of the same cell type obtained from scRNA-seq data, spatial variations, and non-spatial variations.
- The statistical significance of spatial variations is then examined using a powerful non-parametric test capable of detecting diverse spatial patterns.
You can install the development version of MCube from
GitHub with:
# install.packages("devtools")
devtools::install_github("YangLabHKUST/MCube")The code for reproducing the real data analysis results presented in our paper are available on the tutorial website (https://mcube-tutorial.readthedocs.io/):
- Visium human dorsolateral prefrontal cortex dataset
- Multiple adult mouse brain datasets from different sources
- Xenium human breast cancer dataset
- Multiple human colorectal cancer datasets generated by different technologies
- 3D Drosophila embryo model constructed from Stereo-seq dataset
We provide a simple way to integrate MCube with the cell type
deconvolution results from RCTD
using the
MCube::mcubeRCTD()
function in just one line of code. We also provide the example code for
real data analysis on the tutorial website:
- Direct integration with
RCTDon the Visium adult mouse brain dataset - Direct integration with
RCTDon the two human colorectal cancer datasets
If you find the MCube package or any of the source code in this
repository useful for your work, please cite:
A unified framework for identification of cell-type-specific spatially variable genes in spatial transcriptomic studies.
Zhiwei Wang, Yeqin Zeng, Ziyue Tan, Yuheng Chen, Xinrui Huang, Hongyu Zhao, Zhixiang Lin, and Can Yang.
Proceedings of the National Academy of Sciences of the United States of America, 2025.
DOI: 10.1073/pnas.2503952122
The R package MCube is developed and maintained by Zhiwei
Wang.
Please feel free to contact Zhiwei Wang, Prof. Hongyu Zhao, Prof. Zhixiang Lin, or Prof. Can Yang if any inquiries.

