knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Introduction

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 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 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 package includes a number of functions to interact with the BoolNet package.

Queries

The first step is to attach rGriffin. This will initialize the Java Virtual Machine and start Griffin with the default JVM options.

library("rGriffin")

If you want to initialize the JVM with different options like more memory see the functions initGriffin(). It is also posible to modify the default parameters changing the file "rGriffin/java/jvm-param.R".

Create a query

All queries start with a topology that describes the nodes and its interactions. The function createGueryGraph() takes a dataframe with columns for: source node, target node, and type of interaction. It also takes a vector with the node names.

Depending on the sign the interactions can positive or negative. If in every condition the regulation will have the same sign the interaction is ambiguous. However, if you are not sure if the regulation is positive or negative in all contexts you can say that the interaction is ambiguous. Depending on the degree of confidence in the existence of the interaction, the interactions can be: mandatory if you are sure the interaction will happen or optional if you suspect the interaction exists but you are not sure.

The valid types of interctions are:

For example, suppose a network where:

We can codify this information as:

genes = c('a','b','c')
inter = data.frame(source=c('a','b','b','c','c'), 
                  target=c('b','b','c','b','c'), 
                  type=c('+','OPU','-','-','OPU'),
                    stringsAsFactors = F )
inter

We then create the query q. This creates an instance of the class query in the JVM.

q = createGqueryGraph(inter, genes)
q

If you want to see the query use the print method.

print(q)

Add restrictions to the query

It is possible to add more restrictions to the query. It is important to remember that if there are more restrictions we expect less networks.

For example, suppose that we have some information about the expected cell types. We can add this restrictions as attractors.

For example, suppose that we know that the attractors are:

We can also add partial attractors where we lack information

We codify this information as:

attr = data.frame(a=c(0,'*',0), 
                 b=c(0,1,0), 
                 c=c(0,0,1),
                 stringsAsFactors = F )
attr

We can add this information to the query with the addGquerySteadyStates() function:

q = addGquerySteadyStates(q, attr)

You can add aditional restrictions like:

Run the query

Once you have created the query with runGquery(). This function will return all the networks that satisfy the restrictions

nets = runGquery(q)
print(nets)

The function runGquery() includes multiple options that can be seen in the documentation. Some of the most important are:

Attractors

Tha package rGriffin can also be used to determine the attractors, basin size and formula using sybolic methods. This allows rGriffin to be more efficient for large networks than other methods.

For example, we can obtain the attractors and basins of the cell cycle network, that includes both steady state and cyclic attractors. The first column corresponds to the attractor number and the second to the state, so that cyclic attractors may occupy more than one row. The basinSize and basinFormula are for the whole attractor. By default rGriffin returns a dataframe, but it can also return BoolNet AttractorInfo objects.

data(cellcycle)
attr = getBasins(cellcycle)
attr

Connect to other packages

BoolNet

The R package includes various functions to import and export data to BoolNet.

It is possible to obtain the topology of a BooleanNetwork object using getNetTopology(). This function determines the sign of each regulation as positive '+', negative '-' or ambiguous 'MA'. All regulations between nodes are considered mandatory. The function can also detect Non-functional regulations 'NR'.

data("cellcycle")
topology <- getNetTopology(cellcycle)
topology

It is also possible to convert an AttractorInfo object into a data.frame using attractor2dataframe.

cc.attr <- getAttractors(cellcycle)
cc.attr <- attractorToDataframe(cc.attr)
cc.attr

This network includes both steady state and cyclic attractors, it is possible to add both at the same time using createGqueryAttractors().

q <- createGqueryGraph(topology, cellcycle$genes)
q <- addGqueryAttractors(q, cc.attr)
print(q)

Once the query has been created griffin determined the networks that satisfy the restriction using the function runGquery(). By default it returns the rules as strings, but it is also possible to export the networks directly to BoolNet with the option return = "BoolNet". This option generates an iterator object, that returns the BooleanNetwork objects one by one using the function iterators::nextElem(). If there are no more available networks the nextElem() method will rise an error: Error in obj$nextElem() : StopIteration.

For big networks rGriffin may return a large number of solutions, in this case we will recover only one.

library(iterators)
net <- runGquery(q, return="BoolNet", return.network.limit=1)
nextElem(net)

Other

It is possible to plot the network topology dataframe with the R package igraph. This dataframe can also be used to import and export the network topology to other resources like the python library networkx or to the software Cytoscape.

It is possible to export the network functions as an SBML file using the BoolNet function toSBML().

References

Muñoz, S., Carrillo, M., Azpeitia, E., & Rosenblueth, D. A. (2018). Griffin: A Tool for Symbolic Inference of Synchronous Boolean Molecular Networks. Frontiers in genetics, 9, 39.



mar-esther23/rgriffin documentation built on May 29, 2021, 10:03 p.m.