Skip to content

KellisLab/scdemon

Repository files navigation

scdemon: single-cell decorrelated module networks

Installation

Conda environment:

# Minimal
conda create -n scdemonpy -c conda-forge pip numpy pandas scipy igraph umap-learn leidenalg scanpy seaborn matplotlib

# If you want to run GO enrichment:
conda install -n scdemonpy -c bioconda gprofiler-official

Python package:

Install the python package with pip directly from github as:

pip install git+https://github.com/KellisLab/scdemon

For a fresh install, or if version number hasn’t changed, first run: pip uninstall scdemon

Alternatively, install by cloning the directory as:

git clone https://github.com/KellisLab/scdemon.git
pip install ./scdemon

Dependencies:

# Core:
numpy, pandas, scipy, igraph, umap-learn, leidenalg, scanpy, seaborn, matplotlib

# Optional:
anndata, gprofiler-official, adjustText

Usage

See documentation: https://scdemon.readthedocs.io/. Also see notebooks/example.py for a more complete example.

Basic example using scanpy:

import numpy as np
import scanpy as sc
import scdemon as sm
from scdemon.utils import recipe_full
from scdemon import plotting as pl

# Load one of scanpy's datasets:
adata = sc.datasets.pbmc3k()
recipe_full(adata, preprocess=True, annotate=True)

# Make the modules handling object:
mod = sm.modules(adata, suffix='pbmc_example', k=100)
mod.setup()

# Build a gene-graph graph and learn modules:
graph_id = 'base'
mod.make_graph(graph_id, resolution=2.5)

# Plot genes on the gene-gene graph and on the gene-level UMAP basis
pl.plot_genes(mod, graph_id, attr="leiden", show_labels=True, width=16)
pl.plot_genes(mod, graph_id, basis='umap', attr="leiden", width=16)

# Plot module expression on the cell-level UMAP basis:
pl.plot_umap_grid(mod, graph_id)

# Get the modules and/or print them out:
mlist = mod.get_modules(graph_id, print_modules=False)
mod.save_modules(graph_id)

# Get functional enrichments for the modules:
gpres = sm.get_goterms(mod, graph_id)

Cite: Mathys*, Boix*, Akay*, et al. Single-cell multiregion dissection of Alzheimer’s disease

About

single-cell decorrelated module networks

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages