Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

monocle2-python

PyPI

Python port of the R monocle2 single-cell trajectory toolkit.

Installation

pip install monocle2-python                # from PyPI

For local development:

git clone https://github.com/Bio-Babel/Monocle2-python.git
cd Monocle2-python
pip install -e ".[dev]"

Quickstart

import monocle2py as m2

cds = m2.load_hsmm_fpkm()
m2.estimate_size_factors(cds)
m2.estimate_dispersions(cds)
m2.reduce_dimension(cds, reduction_method="DDRTree")
m2.order_cells(cds)
m2.plot_cell_trajectory(cds, color_by="State")

DDRTree backend (CPU / GPU)

If you want to use GPU, please install the torch build that fits your machine first.

# CPU, reference path (default — matches R numerically)
m2.reduce_dimension(cds, reduction_method="DDRTree")

# GPU via PyTorch (Borůvka MST stays on-device)
m2.reduce_dimension(cds, reduction_method="DDRTree",
                    backend="torch", device="cuda")

GPU is never selected automatically — passing backend="torch" and device="cuda" is required. K-means initialisation still runs on CPU (small, constant overhead).

Tutorials

Four runnable notebooks that reproduce the R monocle2 tutorials live under tutorials/:

Notebook Dataset
V2_1_HSMM.ipynb HSMM myoblast differentiation
V2_2_lung_BEAM.ipynb Lung epithelium BEAM walkthrough
V2_3_Olsson_corrected.ipynb Olsson myeloid progenitors (WT + KOs)
V2_4_Paul.ipynb Paul hematopoiesis

License

Artistic-2.0, matching the upstream R monocle2.

About

Monocle2 python version

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages