# R Gene Regulatory Interaction Formulator For Inquiring Networks

**Fellgernon Bit - rstats**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

*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., 2018) 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., 2018). 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., 2018) 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., 2018) 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., 2018) 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., 2018) 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., 2018). 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., 2018) 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., 2018) began during the EOBM 2017 in CUIB. For the following year we continued developing *rGriffin* (Martinez-Sanchez, Muñoz, Carrillo, Azpeitia, et al., 2018) 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., 2018) was finished.

### Acknowledgements

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

Check our first contributed blog post: R Gene Regulatory Interaction Formulator For Inquiring Networkshttps://t.co/9azbElGZGH

ME Martinez-Sanchez, S Muñoz, M Carrillo, E Azpeitia, D Rosenblueth

Thx @mt_morgan @benilton!#CDSBMexico #TIB2018 #LatAmBioc18 #rstats #TIB #blog pic.twitter.com/TbJv37fkWQ

— ComunidadBioInfo (@CDSBMexico) August 21, 2018

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. 2018.

[3] H. Wickham, J. Hester and W. Chang. *devtools: Tools to Make Developing R Packages Easier*. R package version 1.13.6. 2018. 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.1 (2018-07-02)
## system x86_64, darwin15.6.0
## ui X11
## language (EN)
## collate en_US.UTF-8
## tz America/New_York
## date 2018-09-13
```

`## Packages --------------------------------------------------------------------------------------------------------------`

```
## package * version date source
## backports 1.1.2 2017-12-13 cran (@1.1.2)
## base * 3.5.1 2018-07-09 local
## bibtex 0.4.2 2017-06-30 CRAN (R 3.5.0)
## BiocManager 1.30.2 2018-08-24 CRAN (R 3.5.0)
## BiocStyle * 2.9.6 2018-08-19 Bioconductor
## blogdown 0.8 2018-07-15 CRAN (R 3.5.0)
## bookdown 0.7 2018-02-18 CRAN (R 3.5.0)
## colorout * 1.2-0 2018-05-03 Github (jalvesaq/[email protected])
## compiler 3.5.1 2018-07-09 local
## datasets * 3.5.1 2018-07-09 local
## devtools * 1.13.6 2018-06-27 CRAN (R 3.5.0)
## digest 0.6.16 2018-08-22 CRAN (R 3.5.0)
## evaluate 0.11 2018-07-17 CRAN (R 3.5.0)
## graphics * 3.5.1 2018-07-09 local
## grDevices * 3.5.1 2018-07-09 local
## htmltools 0.3.6 2017-04-28 cran (@0.3.6)
## httr 1.3.1 2017-08-20 CRAN (R 3.5.0)
## jsonlite 1.5 2017-06-01 CRAN (R 3.5.0)
## knitcitations * 1.0.8 2017-07-04 CRAN (R 3.5.0)
## knitr 1.20 2018-02-20 cran (@1.20)
## lubridate 1.7.4 2018-04-11 CRAN (R 3.5.0)
## magrittr 1.5 2014-11-22 cran (@1.5)
## memoise 1.1.0 2017-04-21 CRAN (R 3.5.0)
## methods * 3.5.1 2018-07-09 local
## plyr 1.8.4 2016-06-08 cran (@1.8.4)
## R6 2.2.2 2017-06-17 CRAN (R 3.5.0)
## Rcpp 0.12.18 2018-07-23 CRAN (R 3.5.1)
## RefManageR 1.2.0 2018-04-25 CRAN (R 3.5.0)
## rGriffin * 0.1 2018-09-13 Github (mar-esther23/[email protected])
## rJava * 0.9-10 2018-05-29 CRAN (R 3.5.0)
## rmarkdown 1.10 2018-06-11 CRAN (R 3.5.0)
## rprojroot 1.3-2 2018-01-03 cran (@1.3-2)
## stats * 3.5.1 2018-07-09 local
## stringi 1.2.4 2018-07-20 CRAN (R 3.5.0)
## stringr 1.3.1 2018-05-10 CRAN (R 3.5.0)
## tools 3.5.1 2018-07-09 local
## utils * 3.5.1 2018-07-09 local
## withr 2.1.2 2018-03-15 CRAN (R 3.5.0)
## xfun 0.3 2018-07-06 CRAN (R 3.5.0)
## xml2 1.2.0 2018-01-24 CRAN (R 3.5.0)
## yaml 2.2.0 2018-07-25 CRAN (R 3.5.0)
```

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.↩

**leave a comment**for the author, please follow the link and comment on their blog:

**Fellgernon Bit - rstats**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.