R Gene Regulatory Interaction Formulator For Inquiring Networks

This blog post was written by ME Martinez-Sanchez, S Muñoz, M Carrillo, E Azpeitia, D Rosenblueth and originally posted at the CDSB blog.1

In this blog post we will describe the package rGriffin (Martinez-Sanchez, Muñoz, Carrillo, Azpeitia, et al., 2019) that was one of the projects developed during the TIB2018-BCDW. We hope to continue developing Griffin and rGriffin (Martinez-Sanchez, Muñoz, Carrillo, Azpeitia, et al., 2019). If you have ideas, suggestions or bugs, please contact us via rGriffin GitHub repo.

The problem

Boolean networks allow us to give a mechanistic explanation to how cell types emerge from regulatory networks. However, inferring the regulatory network and its functions is complex problem, as the available information is often incomplete. rGriffin (Martinez-Sanchez, Muñoz, Carrillo, Azpeitia, et al., 2019) uses available biological information (regulatory interactions, cell types, mutants) codified as a set of restrictions and returns the Boolean Networks that satisfy that restrictions. This Boolean networks can then be used to study the biological system.

The rGriffin (Martinez-Sanchez, Muñoz, Carrillo, Azpeitia, et al., 2019) package is an R connector to Griffin (Gene Regulatory Interaction Formulator For Inquiring Networks), a java library for inference and analysis of Boolean Network models. Griffin takes as inputs biologically meaningful constraints and turns them into a symbolic representation. Using a SAT engine, Griffin explores the Boolean Network search space, finding all satisfying assignments that are compatible with the specified constraints. The rGriffin (Martinez-Sanchez, Muñoz, Carrillo, Azpeitia, et al., 2019) package includes a number of functions to interact with the BoolNet package.

A small example

Let us suppose a cell, we know that this cell has three proteins called a, b and c. We know that a activates b and that b and c inhibit each other. We also suspect that b and c may have positive self-regulatory loops. We can add this interactions to the table as “OPU” (optional, positive, unambiguous). This dataframe is the topology of the network.

Source Target Interaction
a b +
b c -
c b -
b b OPU
c c OPU

Suppose we also have some information of what cell types have been observed. For example, there is a cell type that expresses b, but not a or c and an other cell type that expresses c, but not a or b. There might exist a third cell type that has not been fully characterized where we know that the cell expresses no a or c but we have NO information on b. This dataframe is the attractors of the network.

a b c
0 1 0
0 0 1
0 * 0

We can then use this information to create a query. rGriffin (Martinez-Sanchez, Muñoz, Carrillo, Azpeitia, et al., 2019) can include other types of information like transition between cell type, cycles, transitions between cell types or mutant cell types.

## Install using:
# devtools::install_github('mar-esther23/rgriffin')
## Note that the package depends on rJava

library('rGriffin')
## Loading required package: rJava
genes = c('a','b','c')
inter = data.frame(source=c('a','b','c', 'b','c'), 
                  target=c('b', 'c', 'b', 'b', 'c'), 
                  type=c('+','-','-','OPU','OPU'),
                    stringsAsFactors = F )
q = create.gquery.graph(inter, genes)
attr = data.frame(a=c(0,'*',0), 
                 b=c(0,1,0), 
                 c=c(0,0,1),
                 stringsAsFactors = F )
q = add.gquery.attractors(q, attr)

Then we can use Griffin to find the networks that behave according with our biological information.

nets = run.gquery(q)
nets
## [1] "targets,factors\na,false\nb,((((!a&b)&!c)|((a&!b)&!c))|((a&b)&!c))\nc,(!b&c)\n"                         
## [2] "targets,factors\na,false\nb,(((((!a&b)&!c)|((a&!b)&!c))|((a&b)&!c))|((a&b)&c))\nc,(!b&c)\n"             
## [3] "targets,factors\na,false\nb,((((((!a&b)&!c)|((!a&b)&c))|((a&!b)&!c))|((a&b)&!c))|((a&b)&c))\nc,(!b&c)\n"
## [4] "targets,factors\na,false\nb,((((!a&b)&!c)|((a&b)&!c))|((a&b)&c))\nc,(!b&c)\n"                           
## [5] "targets,factors\na,false\nb,((((((!a&b)&!c)|((a&!b)&!c))|((a&!b)&c))|((a&b)&!c))|((a&b)&c))\nc,(!b&c)\n"

There are multiple options to integrate BoolNet and rGriffin (Martinez-Sanchez, Muñoz, Carrillo, Azpeitia, et al., 2019). The function get.net.topology() can obtain the topology with interaction signs of a BoolNet network. The function attractor2dataframe() can be used to export a BoolNet attractor as a dataframe that rGriffin (Martinez-Sanchez, Muñoz, Carrillo, Azpeitia, et al., 2019) can use. The function run.gquery() includes the option return=’BoolNet’, that return the inferred networks as BoolNet networks.

History

The development of Griffin began in 2013 as a PAPIIT (Programa de Apoyo a Proyectos de Investigación e Innovación Tecnológica) project to solve the inference of Boolean Network models for the Arabidopsis thaliana root stem cell niche. It continued in 2015 with support of Conacyt grant 221341.

In January, 2017 we organized a course in C3-UNAM to teach biologist how to use Griffin. We received two main comments: the input format was too complicated and it was uncomfortable to use the output with other packages. After some consideration we decided to create an R wrapper that could export and import BoolNet networks. We selected BoolNet as it has an good documentation and the package BoolFilter had been designed to work with it.

The development of rGriffin (Martinez-Sanchez, Muñoz, Carrillo, Azpeitia, et al., 2019) began during the EOBM 2017 in CUIB. For the following year we continued developing rGriffin (Martinez-Sanchez, Muñoz, Carrillo, Azpeitia, et al., 2019) as our schedules allowed. There were multiple challenges during the development: defining user-friendly inputs, using Rjava, and structuring the package. In August 2018, we attended the TIB2018-BCDW where we received valuable guidance from Martin Morgan and Benilton S Carvalho. It was during this workshop that the first version of rGriffin (Martinez-Sanchez, Muñoz, Carrillo, Azpeitia, et al., 2019) was finished.

Acknowledgments

Here you can find the tweet about the original blog post:

This blog post was made possible thanks to:

References

[1] C. Boettiger. knitcitations: Citations for ‘Knitr’ Markdown Files. R package version 1.0.8. 2017. URL: https://CRAN.R-project.org/package=knitcitations.

[2] M. Martinez-Sanchez, S. Muñoz, M. Carrillo, E. Azpeitia, et al. rGriffin: Gene Regulatory Interaction Formulator For Inquiring Networks. R package version 0.1. 2019.

[3] H. Wickham, J. Hester, and W. Chang. devtools: Tools to Make Developing R Packages Easier. R package version 2.0.2. 2019. URL: https://CRAN.R-project.org/package=devtools.

[4] Y. Xie, A. P. Hill, and A. Thomas. blogdown: Creating Websites with R Markdown. ISBN 978-0815363729. Boca Raton, Florida: Chapman and Hall/CRC, 2017. URL: https://github.com/rstudio/blogdown.

Reproducibility

## ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────
##  setting  value                                      
##  version  R version 3.5.2 Patched (2019-02-17 r76113)
##  os       macOS Mojave 10.14.4                       
##  system   x86_64, darwin15.6.0                       
##  ui       X11                                        
##  language (EN)                                       
##  collate  en_US.UTF-8                                
##  ctype    en_US.UTF-8                                
##  tz       America/New_York                           
##  date     2019-04-10                                 
## 
## ─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────
##  package       * version date       lib source                            
##  assertthat      0.2.1   2019-03-21 [1] CRAN (R 3.5.2)                    
##  backports       1.1.3   2018-12-14 [1] CRAN (R 3.5.0)                    
##  bibtex          0.4.2   2017-06-30 [1] CRAN (R 3.5.0)                    
##  BiocManager     1.30.4  2018-11-13 [1] CRAN (R 3.5.0)                    
##  BiocStyle     * 2.10.0  2018-10-30 [1] Bioconductor                      
##  blogdown        0.11.1  2019-04-05 [1] Github (rstudio/blogdown@5179caf) 
##  bookdown        0.9     2018-12-21 [1] CRAN (R 3.5.0)                    
##  callr           3.2.0   2019-03-15 [1] CRAN (R 3.5.2)                    
##  cli             1.1.0   2019-03-19 [1] CRAN (R 3.5.2)                    
##  colorout      * 1.2-0   2019-02-18 [1] Github (jalvesaq/colorout@cc5fbfa)
##  crayon          1.3.4   2017-09-16 [1] CRAN (R 3.5.0)                    
##  desc            1.2.0   2018-05-01 [1] CRAN (R 3.5.0)                    
##  devtools      * 2.0.2   2019-04-08 [1] CRAN (R 3.5.2)                    
##  digest          0.6.18  2018-10-10 [1] CRAN (R 3.5.0)                    
##  evaluate        0.13    2019-02-12 [1] CRAN (R 3.5.2)                    
##  fs              1.2.7   2019-03-19 [1] CRAN (R 3.5.2)                    
##  glue            1.3.1   2019-03-12 [1] CRAN (R 3.5.2)                    
##  htmltools       0.3.6   2017-04-28 [1] CRAN (R 3.5.0)                    
##  httr            1.4.0   2018-12-11 [1] CRAN (R 3.5.0)                    
##  jsonlite        1.6     2018-12-07 [1] CRAN (R 3.5.0)                    
##  knitcitations * 1.0.8   2017-07-04 [1] CRAN (R 3.5.0)                    
##  knitr           1.22    2019-03-08 [1] CRAN (R 3.5.2)                    
##  lubridate       1.7.4   2018-04-11 [1] CRAN (R 3.5.0)                    
##  magrittr        1.5     2014-11-22 [1] CRAN (R 3.5.0)                    
##  memoise         1.1.0   2017-04-21 [1] CRAN (R 3.5.0)                    
##  pkgbuild        1.0.3   2019-03-20 [1] CRAN (R 3.5.2)                    
##  pkgload         1.0.2   2018-10-29 [1] CRAN (R 3.5.0)                    
##  plyr            1.8.4   2016-06-08 [1] CRAN (R 3.5.0)                    
##  prettyunits     1.0.2   2015-07-13 [1] CRAN (R 3.5.0)                    
##  processx        3.3.0   2019-03-10 [1] CRAN (R 3.5.2)                    
##  ps              1.3.0   2018-12-21 [1] CRAN (R 3.5.0)                    
##  R6              2.4.0   2019-02-14 [1] CRAN (R 3.5.2)                    
##  Rcpp            1.0.1   2019-03-17 [1] CRAN (R 3.5.2)                    
##  RefManageR      1.2.12  2019-04-03 [1] CRAN (R 3.5.2)                    
##  remotes         2.0.3   2019-04-09 [1] CRAN (R 3.5.2)                    
##  rGriffin      * 0.1     2019-04-10 [1] local                             
##  rJava         * 0.9-11  2019-03-29 [1] CRAN (R 3.5.2)                    
##  rlang           0.3.4   2019-04-07 [1] CRAN (R 3.5.2)                    
##  rmarkdown       1.12    2019-03-14 [1] CRAN (R 3.5.2)                    
##  rprojroot       1.3-2   2018-01-03 [1] CRAN (R 3.5.0)                    
##  sessioninfo     1.1.1   2018-11-05 [1] CRAN (R 3.5.0)                    
##  stringi         1.4.3   2019-03-12 [1] CRAN (R 3.5.2)                    
##  stringr         1.4.0   2019-02-10 [1] CRAN (R 3.5.2)                    
##  testthat        2.0.1   2018-10-13 [1] CRAN (R 3.5.0)                    
##  usethis       * 1.5.0   2019-04-07 [1] CRAN (R 3.5.2)                    
##  withr           2.1.2   2018-03-15 [1] CRAN (R 3.5.0)                    
##  xfun            0.6     2019-04-02 [1] CRAN (R 3.5.2)                    
##  xml2            1.2.0   2018-01-24 [1] CRAN (R 3.5.0)                    
##  yaml            2.2.0   2018-07-25 [1] CRAN (R 3.5.0)                    
## 
## [1] /Library/Frameworks/R.framework/Versions/3.5/Resources/library

  1. I’m re-posting their blog post here with their permission so that their post will be shared more widely via R-Bloggers and R Weekly among other sites since the CDSB blog is currently not linked to those aggregators. The original blog post has been edited so that it evaluates the R code and includes all the information needed for reproducibility.

Leonardo Collado-Torres
Leonardo Collado-Torres
Investigator @ LIBD, Assistant Professor, Department of Biostatistics @ JHBSPH

#rstats @Bioconductor/🧠 genomics @LieberInstitute/@lcgunam @jhubiostat @jtleek @andrewejaffe alumni/@LIBDrstats @CDSBMexico co-founder

comments powered by Disqus