Skip to main content

A Python implementation of the M3Drop single-cell RNA-seq analysis tool.

Project description

M3DropPy

A Python implementation of the M3Drop single-cell RNA-seq analysis tool, originally developed as an R package.

About

M3DropPy is a Python conversion of the popular M3Drop R package for dropout-based feature selection in single-cell RNA sequencing data. This package provides powerful methods for identifying highly variable and differentially expressed genes by leveraging the high frequency of dropout events (zero expression values) that are characteristic of single-cell RNA-seq data.

Background

Single-cell RNA sequencing often results in a large number of dropouts (genes with zero expression in particular cells) due to the technical challenges of reverse-transcribing and amplifying small quantities of RNA from individual cells. M3Drop takes advantage of this characteristic by modeling the relationship between dropout rate and mean expression using the Michaelis-Menten equation:

P_i = 1 - S_i/(S_i + K)

Where:

  • P_i is the proportion of cells where gene i drops out
  • S_i is the mean expression of gene i
  • K is the Michaelis constant

Key Features

M3Drop Method

  • Michaelis-Menten Modeling: Models dropout rates using enzyme kinetics principles
  • Feature Selection: Identifies differentially expressed genes by detecting outliers from the fitted curve
  • Optimized for Smart-seq2: Works best with full-transcript protocols without UMIs

DANB (Depth-Adjusted Negative Binomial) Method

  • UMI Compatibility: Specifically designed for UMI-tagged data (10X Chromium, etc.)
  • Depth Adjustment: Accounts for sequencing depth variations across cells
  • Negative Binomial Modeling: Models count data with appropriate variance structure

Additional Methods

  • Brennecke Method: Implementation of highly variable gene detection
  • Consensus Feature Selection: Combines multiple feature selection approaches
  • Pearson Residuals: Alternative normalization for UMI data

Requirements

M3DropPy requires:

  • Python >= 3.8
  • NVIDIA GPU with CUDA support (CUDA 12.x recommended)
  • CuPy for GPU-accelerated computations

Installation

Step 1: Ensure CUDA is installed

Check your CUDA version:

nvcc --version
# or
nvidia-smi

Step 2: Install M3DropPy

pip install M3Drop

Note: M3Drop now requires CuPy for GPU acceleration. If you have CUDA 11.x instead of CUDA 12.x, you'll need to install the appropriate CuPy version manually:

# For CUDA 11.x users
pip uninstall cupy-cuda12x
pip install cupy-cuda11x

Imports

You can import specific functions from different modules:

from m3Drop.basics import your_function_name
from m3Drop.M3D_Imputation import another_function

Usage

from m3Drop.basics import M3DropConvertData, M3DropFeatureSelection
from m3Drop.NB_UMI import NBumiFitModel, NBumiFeatureSelectionCombinedDrop, NBumiPearsonResiduals

# Load your single-cell expression data
# counts should be a genes x cells matrix

# For non-UMI data (Smart-seq2, etc.)
# Convert and normalize data
norm_data = M3DropConvertData(counts, is_counts=True)

# Perform M3Drop feature selection
selected_genes = M3DropFeatureSelection(norm_data, mt_method="fdr", mt_threshold=0.01)

# For UMI data (10X Chromium, etc.)
# Fit DANB model
danb_fit = NBumiFitModel(counts)

# Perform dropout-based feature selection
selected_genes = NBumiFeatureSelectionCombinedDrop(danb_fit, method="fdr", qval_thres=0.01)

# Calculate Pearson residuals for normalization
pearson_residuals = NBumiPearsonResiduals(counts, danb_fit)

When to Use Each Method

  • M3Drop: Use for Smart-seq2 and other full-transcript protocols without UMIs
  • DANB/NBumi: Use for UMI-tagged data like 10X Chromium
  • Consensus: Use when you want to combine multiple feature selection approaches

Original R Package

This Python implementation is based on the M3Drop R package developed by Tallulah Andrews and converted to Python by Anthony Son and Pragalvha Sharma.

Citation

If you use M3DropPy in your research, please cite the original M3Drop paper:

  • Andrews, T.S. and Hemberg, M. (2019). M3Drop: Dropout-based feature selection for scRNASeq. Bioinformatics, 35(16), 2865-2867.

Project details


Release history Release notifications | RSS feed

This version

0.2.5

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

m3drop-0.2.5.tar.gz (79.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

m3drop-0.2.5-py3-none-any.whl (75.4 kB view details)

Uploaded Python 3

File details

Details for the file m3drop-0.2.5.tar.gz.

File metadata

  • Download URL: m3drop-0.2.5.tar.gz
  • Upload date:
  • Size: 79.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for m3drop-0.2.5.tar.gz
Algorithm Hash digest
SHA256 2a1584f82d7334f702b0850c09bae01e290a3710e2b714bd240067d7439e655b
MD5 87abfe3a0e7ff715cd6eb7d234f7c3c6
BLAKE2b-256 612cd92b4b11e008cc0eb73e0b205f0de7cc5b51aea7808c3e7099aa21f30d83

See more details on using hashes here.

File details

Details for the file m3drop-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: m3drop-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 75.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for m3drop-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b03c3d2e92f46b095f5c7c90c00cf8d36919def95bf3c5b23d9afe2e67a01355
MD5 94ac7b609d05652554e2063b57f83ff6
BLAKE2b-256 0342af4984160815ba591a6b58c5faede11ef89e1dcdd1e95918e1ce4ac87d6e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page