Introduction to Patterns: a modeling tool dedicated to biological network modeling

Frédéric Bertrand and Myriam Maumy-Bertrand

Université de Strasbourg et CNRS
frederic.bertrand@math.unistra.fr

2019-11-13

Patterns: a modeling tool dedicated to biological network modeling

It allows for single or joint modeling of, for instance, genes and proteins. It is design to work with patterned data. Famous examples of problems related to patterned data are: * recovering signals in networks after a stimulation (cascade network reverse engineering), * analysing periodic signals.

The weights are viewed as a penalty factors in the penalized regression model: it is a number that multiplies the lambda value in the minimization problem to allow differential shrinkage, Friedman et al. 2010, equation 1 page 3. If equal to 0, it implies no shrinkage, and that variable is always included in the model. Default is 1 for all variables. Infinity means that the variable is excluded from the model. Note that the weights are rescaled to sum to the number of variables.

Due to maximum size requirement for CRAN packages, most of the graphics of the vignette will be created when the code is run.

A word for those that have been using our seminal work, the Cascade package that we created several years ago and that was a very efficient network reverse engineering tool for cascade networks (Jung, N., Bertrand, F., Bahram, S., Vallat, L., and Maumy-Bertrand, M. (2014), https://doi.org/10.1093/bioinformatics/btt705, https://cran.r-project.org/package=Cascade, https://github.com/fbertran/Cascade and https://fbertran.github.io/Cascade/).

The Patterns package is more than (at least) a threeway major extension of the Cascade package :

Hence the Patterns package should be viewed more as a completely new modelling tools than as an extension of the Cascade package.

This website and these examples were created by F. Bertrand and M. Maumy-Bertrand.

Installation

You can install the released version of Patterns from CRAN with:

You can install the development version of Patterns from github with:

Examples

Data management

Import Cascade Data (repeated measurements on several subjects) from the CascadeData package and turn them into a micro array object. The second line makes sure the CascadeData package is installed.

Get a summay and plots of the data:

Gene selection

There are several functions to carry out gene selection before the inference. They are detailed in the vignette of the package.

Data simulation

Let’s simulate some cascade data and then do some reverse engineering.

We first design the F matrix for \(T_i=4\) times and \(Ngrp=4\) groups. The Fmatobject is an array of sizes \((T_i,T-i,Ngrp^2)=(4,4,16)\).

The Patterns function CascadeFinit is an utility function to easily define such an F matrix.

Check if the two matrices Fmat and Fbis are identical.

End of F matrix definition.

We set the seed to make the results reproducible and draw a scale free random network.

Plot the simulated network.

If a gene clustering is known, it can be used as a coloring scheme.

Plot the F matrix, for low dimensional F matrices.

Plot the F matrix using the pixmap package, for high dimensional F matrices.

We simulate gene expression according to the network that was previously drawn

Get a summay and plots of the simulated data:

Network inferrence

We infer the new network using subjectwise leave one out cross-validation (default setting): all measurements from the same subject are removed from the dataset). The inference is carried out with a general Fshape.

Plot of the inferred F matrix

Heatmap of the inferred coefficients of the Omega matrix

Default values fot the \(F\) matrices. The Finit matrix (starting values for the algorithm). In our case, the Finitobject is an array of sizes \((T_i,T-i,Ngrp^2)=(4,4,16)\).

The Fshape matrix (default shape for F matrix the algorithm). Any interaction between groups and times are permitted except the retro-actions (a group on itself, or an action at the same time for an actor on another one).

Any other form can be used. A “0” coefficient is missing from the model. It allows testing the best structure of an “F” matrix and even performing some significance tests of hypothses on the structure of the \(F\) matrix.

The IndicFshape function allows to design custom F matrix for cascade networks with equally spaced measurements by specifying the zero and non zero \(F_{ij}\) cells of the \(F\) matrix. It is useful for models featuring several clusters of actors that are activated at the time. Let’s define the following indicatrix matrix (action of all groups on each other, which is not a possible real modeling setting and is only used as an example):

For that choice, we get those init and shape \(F\) matrices.

Those \(F\) matrices are lower diagonal ones to enforce that an observed value at a given time can only be predicted by a value that was observed in the past only (i.e. neither at the same moment or in the future).

The plotF is convenient to display F matrices. Here are the the displays of the three \(F\) matrices we have just introduced.

We now fit the model with an \(F\) matrix that is designed for cascade networks.

Specific Fshape

Plot of the inferred F matrix

Heatmap of the coefficients of the Omega matrix of the network. They reflect the use of a special \(F\) matrix. It is an example of an F matrix specifically designed to deal with cascade networks.

There are many fitting functions provided with the Patterns package in order to search for specific features for the inferred network such as sparsity, robust links, high confidence links or stable through resampling links. :

  • LASSO, from the lars package
  • LASSO2, from the glmnet package. An unweighted and a weighted version of the algorithm are available
  • SPLS, from the spls package
  • ELASTICNET, from the elasticnet package
  • stability.c060, from the c060 package implementation of stability selection
  • stability.c060.weighted, a new weighted version of the c060 package implementation of stability selection
  • robust, lasso from the lars package with light random Gaussian noise added to the explanatory variables
  • selectboost.weighted, a new weighted version of the selectboost package implementation of the selectboost algorithm to look for the more stable links against resampling that takes into account the correlated structure of the predictors. If no weights are provided, equal weigths are for all the variables (=non weighted case).

Plot of the inferred F matrix

Heatmap of the coefficients of the Omega matrix of the network

We create a weighting vector to perform weighted lasso inference.

Plot of the inferred F matrix

Heatmap of the coefficients of the Omega matrix of the network

Plot of the inferred F matrix

Heatmap of the coefficients of the Omega matrix of the network

Plot of the inferred F matrix

Heatmap of the coefficients of the Omega matrix of the network

Plot of the inferred F matrix

Heatmap of the coefficients of the Omega matrix of the network

Plot of the inferred F matrix

Heatmap of the coefficients of the Omega matrix of the network

Plot of the inferred F matrix

Heatmap of the coefficients of the Omega matrix of the network

Plot of the inferred F matrix

Heatmap of the coefficients of the Omega matrix of the network

Plot of the inferred F matrix

Heatmap of the coefficients of the Omega matrix of the network

###Post inference network analysis Such an analysis is only required if the model was not fitted using the stability selection or the selectboost algorithm.

Create an animation of the network with increasing cutoffs with an animated .gif format or a html webpage. See the the webpage of the Patterns package for the animation results at the .gif and .html formats.

Evolution of some properties of a reverse-engineered network with increasing cut-off values.

We switch to data that were derived from the inferrence of a real biological network and try to detect the optimal cutoff value: the best cutoff value for a network to fit a scale free network. The cutoff was validated only single group cascade networks (number of actors groups = number of timepoints) and for genes dataset. Instead of the cutoff function, manual curation or the stability selection or the selectboost algorithm should be used.

Analyze the network with a cutoff set to the previouly found 0.133 optimal value.

Perform gene selection

Import data.

Select early genes (t1 or t2):

Section genes with first significant differential expression at t1:

Section genes with first significant differential expression at t2:

Select later genes (t3 or t4)

Merge those selections:

Summarize the final selection:

Plot the final selection:

This process could be improved by retrieve a real gene_ID using the bitr function of the ClusterProfiler package or by performing independent filtering using jetset package to only keep at most only probeset (the best one, if there is one good enough) per gene_ID.