Skip to content

Version 2.0.0 · successor of GCEN

GCEN2

Gene co-expression network analysis from bulk to single-cell and spatial transcriptomes

One command-line tool and Python package for co-expression networks, WGCNA and hdWGCNA modules, single-cell, spatial, trajectory and multi-omics analyses, with publication figures. It gives the same results as the established tools, faster.

$ pip install "gcen2[all]"
$ conda install -c conda-forge -c bioconda gcen2
$ git clone https://github.com/wen-chen/GCEN2
$ cd GCEN2
$ pip install ".[all]"

Linux x86-64, Windows x86-64 and macOS on Apple Silicon; Python 3.9–3.14. All options

Workflow

Four kinds of data, one toolkit

Bulk, single-cell, spatial and trajectory data go from input to modules and their comparison with 24 commands; gene function, figures and reports are shared by all. The same analyses can be run from Python.

GCEN2 workflow. Four lanes (bulk RNA-seq, single cells, spatial, trajectories and multi-omics) pass through input, preprocessing, network construction, module identification and comparison, each step labelled with its gcen2 command; gene function and outputs are shared, on a multithreaded C++ engine.
The GCEN2 workflow. Rounded boxes are gcen2 commands; snipped boxes are data; dashed boxes are methods inside a command.

What it does

From GCEN's networks to single cells and tissues

Co-expression networks

Everything GCEN v1 does, with the same commands, files and results: normalization, filtering, Pearson or Spearman networks with p-values and FDR, modules, merge, extract, shuffle, statistics. Differential co-expression between two conditions with DGCA's test.

normalizefilterbuildmodulediff

Tutorial : Co-expression networks

WGCNA modules

Soft power, topological overlap, dynamic tree cut, eigengenes, kME, hub genes and module–trait correlations, consensus modules over several data sets and module preservation, giving the same modules as WGCNA.

module -econsensus-modulesmodule-preservation

Tutorial : WGCNA modules

Single cells

The hdWGCNA workflow from an AnnData file: metacells per cell type, modules, cell eigengenes, Harmony, differential module eigengenes and module projection; networks per cell type with p-values from the effective number of samples. Atlas scale, from backed files.

celltype-modulescelltypeproject-modules

Tutorial : Single cells

Spatial transcriptomes

Visium, Visium HD and Slide-seq: metaspots on the grid or by nearest neighbours, modules and spot eigengenes on the tissue, module–region correlations, spatially smoothed networks and Moran's I.

spatial-modulesspatial-build

Tutorial : Spatial transcriptomes

Trajectories and multi-omics

Networks along pseudotime with the edges gained, lost and transient; fusion of co-expression with prior networks such as STRING and TRRUST; random walk with restart on multiplex networks.

trajectoryfuserwr-multiplex

Tutorial : Trajectories and multi-omics

Gene function, figures and reports

GO and KEGG annotation and enrichment, gene ranking from seed genes, 43 kinds of publication figures (PDF, PNG, SVG) and HTML or PDF reports of whole analyses.

annotateenrichrwrplotreport

Tutorial : Gene function, figures and reports

Benchmarks

Same results, faster

Compared on the same data with GCEN v1, WGCNA, hdWGCNA, DGCA and RandomWalkRestartMH, GCEN2 gives the same edges, modules and statistics.

6–89×
faster than GCEN v1, with the same edges and modules
4.0×
faster than WGCNA on GTEx whole blood, 2.7× less memory
8 min
for all 49 cell types of a 584,944-cell atlas
185×
faster than DGCA for Spearman differential co-expression

Quick start

The GCEN pipeline, in GCEN2

On the GCEN sample data in data/example/bulk/: normalize, filter, build the network, find modules, annotate them, rank genes from seeds, and write a report.

Command line

EX=GCEN2/data/example/bulk
gcen2 normalize -i $EX/gene_expr.tsv -o norm.tsv -m tmm
gcen2 filter    -i norm.tsv -o filt.tsv -p 0.75
gcen2 build     -i filt.tsv -o net.network -m spearman -c 0.8 -p 0.001 -f -t 8
gcen2 module    -i net.network -o modules.txt -s 0.5 -t 8
gcen2 annotate  -g $EX/go-basic.obo.gz -a $EX/gene_go.assoc.gz -n net.network -o annotation/
gcen2 rwr       -n net.network -g $EX/rwr_seed_genes.list -o rwr.tsv
gcen2 report    -n net.network -m modules.txt -o report.html

Python

import gcen2

expr = gcen2.read_tsv("filt.tsv")
net = gcen2.network.build(expr, method="spearman", cor=0.8,
                          pval=0.001, fdr=True, threads=8)
modules = gcen2.module.identify(net, similarity=0.5)

Next: the bulk tutorial adds WGCNA modules; the others cover single cells and spatial data.

Cite

Citing GCEN2

Please cite the GCEN2 software and the GCEN article:

Chen WH. GCEN2: a toolkit for gene co-expression network analysis with single-cell resolution. Version 2.0.0. https://github.com/wen-chen/GCEN2

Chen W, Li J, Huang S, Li X, Zhan X, Hu X, Xiang S, Liu C. GCEN: an easy-to-use toolkit for gene co-expression network analysis and lncRNAs annotation. Curr Issues Mol Biol. 2022;44(4):1479–1487. doi:10.3390/cimb44040100

GCEN2 reimplements methods of WGCNA and hdWGCNA; please also cite their papers when you use those methods.

Contact

Questions and suggestions

Open an issue on GitHub or write to chenwen@biochen.org.

GCEN2 is free software under the GNU General Public License, version 3 or later. GCEN (v1) remains available at biochen.org/gcen.