dynUGENE is an R package for the inference, simulation, and visualization of gene regulatory network dynamics from time-series expression data.
dynUGENE build off dynGENIE3, an algorithm to infer gene network architecture and dynamics given time-series or steady-state expression data.
dynUGENE provides several additional functionalities on top of dynGENIE3.
- Visualization of the inferred network as a heatmap.
- Simulation of the learned system given any initial condition.
- Stochastic simulations by accounting for uncertainty in the random forests’ predictions
- Model selection using a Pareto front by comparing model error with model complexity.
- Additional datasets (repressilator, Hodgkin-Huxley) both deterministic and stochastic.
The package is useful for those who wish to build explainable models of gene regulatory networks with varying degrees of complexity. The package is also useful for synthetic biologists who wish to design genetic circuits that match some desired dynamical or steady-state properties.
Install the development version with:
install.packages("devtools")
devtools::install_github("tianyu-lu/dynUGENE", build_vignettes = TRUE)
library("dynUGENE")
The package is also available as a Shiny app on at tianyulu.shinyapps.io/dynUGENE/ or can be run locally with
dynUGENE::rundynUGENE()
The Shiny app includes a tutorial and interactivity with the outputs of dynUGENE. In particular, useful features of the app include the following:
- Visualize each of the stepwise-tuned networks
- Select custom masks by clicking on the heatmap cells to be masked
- Interactive simulation plot allows zooming
library("dynUGENE")
ls("package:dynUGENE")
#> [1] "estimateDecayRates" "HodgkinHuxley"
#> [3] "inferNetwork" "inferSSNetwork"
#> [5] "plotTrajectory" "Repressilator"
#> [7] "rundynUGENE" "simulateUGENE"
#> [9] "StochasticHodgkinHuxley" "StochasticRepressilator"
#> [11] "tuneThreshold"
data(package="dynUGENE")
The package file structure is illustrated below.
For detailed tutorials and descriptions of the provided datasets, see the vignette here:
browseVignettes("dynUGENE")
#> starting httpd help server ... done
Package author: Tianyu Lu.
With the exception of estimateDecayRates.R
, the remaining files are
original code. inferNetwork.R
is a re-implementation of the dynGENIE3
algorithm in R. The original implementation wraps around a random forest
implementation written in C. dynuGENE implements everything in R. The
randomForest
package is used to train random forests. ramify
is used
to obtain column-wise argmax of matrices. Plots for inferNetwork()
are
made with ggplot2
and preprocessing done by reshape2
. Plots for
inferSSNetwork()
are made with gplots
and colours specified by
RColorBrewer
. The stats
package is used to estimate mean and
variance from the random forests predictions and to sample from a
Gaussian.
Sources for code adapted from examples are provided near the code in question.
We can learn the architecture and simulate the dynamics of a
repressilator with inferNetwork()
:
We can perform a search over possible sparse network architectures with
tuneThreshold()
.
We can also learn the dynamics of a stochastic repressilator:
We can also visualize the learned networks for large, steady-state datasets:
Load and do inference with repressilator data:
library(dynUGENE)
## Infer network
ugene <- inferNetwork(Repressilator, mtry = 3L)
## Deterministic simulation of the inferred network dynamics
x0 <- Repressilator[1, 2:7]
trajectory <- simulateUGENE(ugene, x0)
plotTrajectory(trajectory, c("p3", "p2", "p1"))
## Stochastic simulation
trajectory <- simulateUGENE(ugene, x0, stochastic = TRUE)
plotTrajectory(trajectory, c("p3", "p2", "p1"))
inferNetwork()
take about 30 seconds for automatic threshold tuning
for the Repressilator dataset.
simulateUGENE()
takes about 3 minutes for simulating 5000 timesteps of
a 6 component system.
Tests: running the unit and integration tests takes about three minutes on a typical laptop.
dynUGENE
welcomes
issues and other
contributions.
Logo made with Wix.
A. Liaw and M. Wiener (2002). Classification and Regression by randomForest. R News 2(3), 18–22.
BioRender. (2020). Image created by Lu, T. Retrieved December 2, 2020, from https://app.biorender.com/
Brandon Greenwell (2016). ramify: Additional Matrix Functionality. R package version 0.3.3. https://CRAN.R-project.org/package=ramify
Brewer, C., Harrower, M., Sheesley, B., Woodruff, A., & Heyman, D. (2020). Colorbrewer 2.0. Retrieved December 02, 2020, from https://colorbrewer2.org/
Carl Ganz (2016). rintrojs: A Wrapper for the Intro.js Library. Journal of Open Source Software, 1(6), October 2016. URL http://dx.doi.org/10.21105/joss.00063
Erich Neuwirth (2014). RColorBrewer: ColorBrewer Palettes. R package version 1.1-2. https://CRAN.R-project.org/package=RColorBrewer
Ggplot2 : Quick correlation matrix heatmap - R software and data visualization. (2020). Retrieved December 02, 2020, from http://www.sthda.com/english/wiki/ggplot2-quick-correlation-matrix-heatmap-r-software-and-data-visualization
Gregory R. Warnes, Ben Bolker, Lodewijk Bonebakker, Robert Gentleman, Wolfgang Huber, Andy Liaw, Thomas Lumley, Martin Maechler, Arni Magnusson, Steffen Moeller, Marc Schwartz and Bill Venables (2020). gplots: Various R Programming Tools for Plotting Data. R package version 3.1.0. https://CRAN.R-project.org/package=gplots
H. Wickham. ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York, 2016.
Hadley Wickham and Jennifer Bryan (2020). usethis: Automate Package and Project Setup. R package version 1.6.3. https://CRAN.R-project.org/package=usethis
Hadley Wickham, Jim Hester and Winston Chang (2020). devtools: Tools to Make Developing R Packages Easier. R package version 2.3.2. https://CRAN.R-project.org/package=devtools
Hadley Wickham, Peter Danenberg, Gábor Csárdi and Manuel Eugster (2020). roxygen2: In-Line Documentation for R. R package version 7.1.1. https://CRAN.R-project.org/package=roxygen2
Hadley Wickham (2007). Reshaping Data with the reshape Package. Journal of Statistical Software, 21(12), 1-20. URL http://www.jstatsoft.org/v21/i12/.
Hadley Wickham. testthat: Get Started with Testing. The R Journal, vol. 3, no. 1, pp. 5–10, 2011
R Core Team (2020). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/.
Rackauckas, C., & Nie, Q. (2017). Adaptive methods for stochastic differential equations via natural embeddings and rejection sampling with memory. Discrete and continuous dynamical systems. Series B, 22(7), 2731.
Rackauckas, C., & Nie, Q. (2017). Differentialequations. jl–a performant and feature-rich ecosystem for solving differential equations in julia. Journal of Open Research Software, 5(1).
Silva, A. (2020) TestingPackage: An Example R Package For BCB410H. Unpublished. URL https://github.com/anjalisilva/TestingPackage
Wickham, H. and Bryan, J. (2019). R Packages (2nd edition). Newton, Massachusetts: O’Reilly Media.
Winston Chang, Joe Cheng, JJ Allaire, Yihui Xie and Jonathan McPherson (2020). shiny: Web Application Framework for R. R package version 1.5.0. https://CRAN.R-project.org/package=shiny
Yihui Xie (2020). knitr: A General-Purpose Package for Dynamic Report Generation in R. R package version 1.30.