pinellolab / dictys

Context specific and dynamic gene regulatory network reconstruction and analysis
GNU Affero General Public License v3.0
110 stars 14 forks source link
dynamic-network gene-regulatory-network network-analysis network-inference network-visualization single-cell-analysis single-cell-multiomics single-cell-network

========= Dictys

Dictys reconstructs cell-type specific and dynamic gene regulatory networks (GRN) from scRNA-seq and scATAC-seq datasets. Dictys first infers a Transcription Factor (TF) binding network with TF footprinting from single-cell chromatin accessibility. Then Dictys refines the edges with single-cell transcriptome. Dictys addresses traditional challenges in network inference by orienting causality with TF binding information, modeling transcriptional rate to reconstruct cycle-compatible networks, and using probabilistic programming to capture the scRNA-seq process.

Dictys provides network analysis and visualization at global (across all cell types), pairwise (between two cell types) and single GRN levels. Dictys directly quantifies TF regulatory activity from GRN and enables a series of analyses such as cell-type specific TF discovery as regulation markers, differential regulation analysis alongside differential expression, and TF regulatory program illustration through its subnetwork and top activation/repression targets. These GRN-based analyses can capture unique biological insights not available from mean expression.

Dictys infers and analyzes dynamic GRN from scRNA-seq and scATAC-seq datasets along (inferred) trajectories. This avoids artificial cell subsets and potential biases from population imbalance, and allows (pseudo-)time-resolved discovery and investigation of driver TFs and their individual regulations. Dictys provides an integrative network viewer for dynamic GRN visualization of synchronous panels in animation.

Overview

.. image:: https://raw.githubusercontent.com/pinellolab/dictys/master/doc/images/logo.png :width: 180

.. image:: https://raw.githubusercontent.com/pinellolab/dictys/master/doc/images/Dictys_overview.png :width: 1000

Installation

Dictys has dependencies not in python. The options below automatically install these dependencies. Installation should take ~<10 mins.

Option 1: with Anaconda

First install Anaconda/Miniconda <https://docs.conda.io/en/latest/miniconda.html>_. Then, install Dictys and PyTorch with CPU computation:

.. code-block::

conda create -y -n dictys -c conda-forge python=3.9 mamba
. activate dictys
mamba install -y -c lingfeiwang -c bioconda -c conda-forge -c pytorch dictys pytorch torchvision torchaudio cpuonly

This will create a conda environment named dictys.

Alternatively, with GPU computation for PyTorch (here CUDA 11.7):

.. code-block::

conda create -y -n dictys -c conda-forge python=3.9 mamba
. activate dictys
mamba install -y -c lingfeiwang -c bioconda -c conda-forge -c pytorch -c nvidia dictys pytorch torchvision torchaudio pytorch-cuda=11.7

Or, with earlier versions (here CUDA 11.3, only supported in PyTorch 1):

.. code-block::

conda create -y -n dictys -c conda-forge python=3.9 mamba
. activate dictys
mamba install -y -c lingfeiwang -c bioconda -c conda-forge -c pytorch -c nvidia dictys pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3

Option 2: with bash script <https://tinyurl.com/dictys>_

First install Anaconda/Miniconda <https://docs.conda.io/en/latest/miniconda.html>_. Then, install Dictys and PyTorch with CPU computation:

.. code-block::

wget https://tinyurl.com/dictys -O - | bash

This will create a conda environment named dictys.

Alternatively, under a different conda environment name:

.. code-block::

wget https://tinyurl.com/dictys -O - | CONDAENV_NAME=your_favorite_name bash

Alternatively, with GPU computation for PyTorch (here CUDA 11.7):

.. code-block::

wget https://tinyurl.com/dictys -O - | CUDAVERSION_CONDA=11.7 bash

Option 3: with containers

To pull and run the pre-built docker image for Dictys with CPU computation:

.. code-block::

docker pull lfwa/dictys-cpu
#Add public ports with '--expose' or '-p' to serve jupyter notebooks and bind mount with '-v' to transfer input/output data
docker run -it lfwa/dictys-cpu

Inside the container, activate conda environment and serve jupyter notebooks:

.. code-block::

. activate dictys
jupyter notebook --allow-root

Then, you can access jupyter notebooks with the exposed or published ports.

Additional notes

For more advanced installation, see INSTALL.md <https://github.com/pinellolab/dictys/blob/master/INSTALL.md> and/or edit the install script <https://tinyurl.com/dictys>.

Note: dynamic network inference is computationally intensive and GPU availability is highly recommended. Running time depends on the dataset, but it can take weeks or longer without a GPU.

If you need STREAM <https://github.com/pinellolab/STREAM>, ArchR <https://www.archrproject.com/>, or other softwares upstream of Dictys, we recommend to install them in separate environments following their official instructions.

Updating Dictys

If your minor version is the latest (e.g. your installed version is 1.0.0 and the latest release <https://github.com/pinellolab/dictys/releases>_ is 1.0.9), you can update Dictys to the latest github version with pip3 install --no-deps --force-reinstall git+https://github.com/pinellolab/dictys inside your Dictys conda environment.

If your minor version is not the latest (e.g. your installed version is 1.0.0 but the latest release <https://github.com/pinellolab/dictys/releases>_ is 1.1.0), you should reinstall Dictys in a new conda environment with any option above.

Tutorials

We provide several tutorials for different data types. Please download each tutorial folder structure before running. Note that these tutorials are not intended to fully replicate the results in the paper due to differences in software versions, computing platforms, various randomness e.g. in HOMER genome preparsing <http://homer.ucsd.edu/homer/ngs/peakMotifs.html> or Pytorch algorithms <https://pytorch.org/docs/stable/notes/randomness.html>, etc.

  1. short-multiome <https://www.github.com/pinellolab/dictys/blob/master/doc/tutorials/short-multiome>_: a single-notebook tutorial for the data preparation, inference, and analysis of context specific networks on 10x multiome data for human blood.

  2. full-multiome <https://www.github.com/pinellolab/dictys/blob/master/doc/tutorials/full-multiome>_: an extended version of the above tutorial with detailed usage.

  3. full-skin <https://www.github.com/pinellolab/dictys/blob/master/doc/tutorials/full-skin>_: a short tutorial for the inference and analysis of dynamic networks on SHARE-seq data for mouse skin. Contains a simple demonstration to account for covariates.

The network analysis tutorials below use the same reconstructed networks as in the paper and are designed to fully replicate the results.

  1. analysis-blood <https://www.github.com/pinellolab/dictys/blob/master/doc/tutorials/analysis-blood>_: a simple tutorial for context specific and dynamic network analysis on separate scRNA-seq and scATAC-seq quantifications of human blood as in manuscript.

  2. analysis-skin <https://www.github.com/pinellolab/dictys/blob/master/doc/tutorials/analysis-skin>_: a simple tutorial for context specific network analysis on SHARE-seq of mouse skin as in manuscript.

Gallery

The figures below are produced with the blood example dataset. You can reproduce them with the analysis-blood example. See Tutorials_. Each figure is linked to the jupyter notebook that produces it.

Cell-type specific GRN analyses

Regulation marker TF discovery <https://nbviewer.org/github/pinellolab/dictys/blob/master/doc/tutorials/analysis-blood/notebooks/static/main.ipynb#Regulation-marker-TF-discovery-with-dot-plot-(global-dotplot.ipynb)>_

.. image:: https://raw.githubusercontent.com/pinellolab/dictys/master/doc/images/Global_dotplot.png :width: 300

Top activation target heatmap for select TFs <https://nbviewer.org/github/pinellolab/dictys/blob/master/doc/tutorials/analysis-blood/notebooks/static/main.ipynb#Heatmap-of-regulation-strengths-between-select-TFs-and-their-top-targets-in-select-cell-types-(global-heatmap.ipynb)>_

.. image:: https://raw.githubusercontent.com/pinellolab/dictys/master/doc/images/Global_heatmap.png :width: 400

Differential regulation v.s. differential expression scatter plot; integrative TF rank plot <https://nbviewer.org/github/pinellolab/dictys/blob/master/doc/tutorials/analysis-blood/notebooks/static/main.ipynb#Scatter-plot-and-bar-plot-of-differential-regulation-&-differential-expression-between-two-cell-clusters--(pair-diff.ipynb)>_

.. image:: https://raw.githubusercontent.com/pinellolab/dictys/master/doc/images/Diff_analysis.png :width: 750

Subnetwork for select TF <https://nbviewer.org/github/pinellolab/dictys/blob/master/doc/tutorials/analysis-blood/notebooks/static/main.ipynb#Draw-target-gene-subnetwork-of-a-TF-(subnet.ipynb)>_

.. image:: https://raw.githubusercontent.com/pinellolab/dictys/master/doc/images/Subnet.png :width: 300

Dynamic GRN analysis

Driver TF discovery based on regulatory activity curve <https://nbviewer.org/github/pinellolab/dictys/blob/master/doc/tutorials/analysis-blood/notebooks/dynamic/main.ipynb#TF-discovery-based-on-4-patterns-of-highly-variable-regulatory-activity-over-developmental-trajectory-(discovery.ipynb)>_

.. image:: https://raw.githubusercontent.com/pinellolab/dictys/master/doc/images/Dynamic_discovery.png :width: 1050

Dynamic GRN animation <https://nbviewer.org/github/pinellolab/dictys/blob/master/doc/tutorials/analysis-blood/notebooks/dynamic/main.ipynb#Animation-visualization-of-dynamic-networks>_

.. image:: https://raw.githubusercontent.com/pinellolab/dictys/master/doc/images/animation.gif :width: 800

FAQ

Issues

Please raise an issue on github <https://github.com/pinellolab/dictys/issues/new/choose>_.

References

Dictys: dynamic gene regulatory network dissects developmental continuum with single-cell multiomics <https://www.nature.com/articles/s41592-023-01971-3>_ Nature Methods (2023)