Skip to main content

MCC: Momentum Contrastive Coupling

GitHub Pages License: MIT

Interactive Benchmarking Portal: https://peterponyu.github.io/MCCVAE/

Publication status: Published in Biomedical Signal Processing and Control.

Fu, Z., Chen, C., Zhang, K. (2026). Islands and bridges: Momentum contrastive coupling unifies discrete and continuous structure in single-cell omics. Biomedical Signal Processing and Control, 122, 110376. DOI · ScienceDirect

MCC is a deep learning framework for single-cell genomics analysis. It combines a Momentum Contrastive (MoCo) module with an information-bottleneck coupling within a Variational Autoencoder (VAE) framework.

Features

  • Momentum Contrastive Learning: Uses MoCo with InfoNCE loss, momentum-updated encoders, and memory queues for contrastive representation learning.
  • Information Bottleneck Coupling: Compresses and refines latent codes through a low-dimensional bottleneck layer.
  • Dual Reconstruction Pathways: Two reconstruction paths - direct from primary latent representation and through the information bottleneck.
  • Multiple Modalities: Supports scRNA-seq and scATAC-seq data.

Installation

Install the package from PyPI:

pip install mccvae
# benchmark metrics and graph baselines
pip install "mccvae[all]"

To run the web interface, install from source:

  1. Clone the repository:
    git clone https://github.com/PeterPonyu/MCCVAE.git
    cd MCCVAE
    
  2. Install the required dependencies:
    pip install -r requirements.txt
    

UI

Visualization training

python start_servers.py

Usage

Use the Agent class to train models and extract latent representations.

import scanpy as sc
from mccvae import Agent

# Load data
adata = sc.read_h5ad("your_data.h5ad")

# Initialize agent
agent = Agent(
    adata=adata,
    layer="counts",
    latent_dim=10,
    use_moco=True,
    irecon=1.
)

# Train
agent.fit(epochs=1000)

# Extract representations
latent_representations = agent.get_latent()       # Shape: (n_cells, latent_dim)
bottleneck_embeddings = agent.get_bottleneck()    # Shape: (n_cells, i_dim)
refined_embeddings = agent.get_refined()          # Shape: (n_cells, latent_dim)

Embeddings:

  • get_latent(): Primary latent representations (z) with dimension latent_dim
  • get_bottleneck() or get_iembed(): Compressed bottleneck (l_e) with dimension i_dim
  • get_refined(): Refined representations (l_d) with dimension latent_dim

Architecture

The framework consists of three components:

VAE Backbone

  • Query Encoder: Maps input to latent representation z
  • Decoder: Reconstructs data from latent representations
  • Loss: Negative binomial reconstruction + KL divergence

MoCo Component

  • Momentum Encoder: Parameters updated via exponential moving average
  • Memory Queue: FIFO mechanism for negative samples
  • InfoNCE Loss: Contrastive loss with L2-normalized embeddings

Coupling Component

  • Information Bottleneck: z → l_e → l_d pathway
    • l_e: Compressed representation via bottleneck_encoder (dimension: i_dim)
    • l_d: Refined representation via bottleneck_decoder (dimension: latent_dim)
  • Secondary Reconstruction: Reconstruction through l_d

Loss Function

The MCC objective combines four loss components:

L_MCC = L_NB + β·L_KLD + α·L_MoCo + γ·L_Cou
  • L_NB: Negative binomial reconstruction loss (z → reconstruction)
  • L_KLD: KL divergence regularization
  • L_MoCo: InfoNCE contrastive loss
  • L_Cou: Coupling reconstruction loss (z → l_e → l_d → reconstruction)

Citation

If you use MCCVAE or the MCC benchmark portal, please cite:

@article{fu2026islands,
  title = {Islands and bridges: Momentum contrastive coupling unifies discrete and continuous structure in single-cell omics},
  author = {Fu, Zeyu and Chen, Chunlin and Zhang, Keyang},
  journal = {Biomedical Signal Processing and Control},
  volume = {122},
  pages = {110376},
  year = {2026},
  doi = {10.1016/j.bspc.2026.110376}
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for mccvae 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mccvae 0.0.1
File Size Uploaded Provenance Actions
mccvae-0.0.1.tar.gz 106.2 kB With provenance Details for mccvae-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mccvae 0.0.1
File Interpreter ABI Platform Actions
mccvae-0.0.1-py3-none-any.whl Python 3 none any Details for mccvae-0.0.1-py3-none-any.whl

Total release size: 241.4 kB

Release files / mccvae-0.0.1.tar.gz

Download URL mccvae-0.0.1.tar.gz
Size 106.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4fa8890641637ef758a2b0cb13d36bb631df734ae4c6cb974a758f9b22b036d5
BLAKE2b-256 checksum
How to use checksums
07596693cb193524126a7a8acb62a06f7d85b1b8565d5009da5bc51897964304
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 / mccvae-0.0.1-py3-none-any.whl

Download URL mccvae-0.0.1-py3-none-any.whl
Size 135.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
69f4098d86835ebd0655fa18ba14cb8623f5b437f1c71fcd12b0416c241061c5
BLAKE2b-256 checksum
How to use checksums
9f63cb233d3aaa8413410baa380dd089ae698eb07e446e8800b6ed832c97d46d
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 mccvae 0.0.1

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 mccvae-0.0.1.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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files Full provenance

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