CellNOpt Documentation Center (CNODocs) (0.1.6)

1. Tutorials

Section author: Thomas Cokelaer, 2013

This page contains a quick tutorial on how to use CellNOptR to optimise MIDAS (data) to prior knowledge network (model) using Boolean Logic formalism.

1.1. Manipulating MIDAS file

authors:Thomas Cokelaer
date:Jan 2013
version:cellnopt 1.5.17

First, load the library:


First, let us get some data from (cellnopt.data), load it and convert it to a CNOlist data structure, which is the common data structure used in CellNOptR.:

cnolist = CNOlist(CNOdata("MD-ToyMMB.csv"))


The CNOdata function search for the file on the cellnopt.data repository. If not found, it looks on your local directory.

Then, we can look at the content of the cnolist variable using the plotting function:


The columns contains each species that has been measured. Each row correspond to different conditions summarized in the last column (cues).

You can get some information about the cnolist variable by printing it:

>>> print(cnolist)
class: CNOlist
cues: EGF TNFa Raf PI3K
inhibitors: Raf PI3K
stimuli: EGF TNFa
timepoints: 0 10
signals: Akt Hsp27 NFkB Erk p90RSK Jnk cJun
variances: Akt Hsp27 NFkB Erk p90RSK Jnk cJun
To see the values of any data contained in this instance, just use the
method (e.g., getCues(cnolist), getSignals(cnolist), getVariances(cnolist), ...

And access to one of the field (e.g. signals) by typing:

>>> cnolist@signals

1.2. Manipulating PKN (prior knowledge network)

authors:Thomas Cokelaer
date:Jan 2013
version:cellnopt 1.5.17

Let us first load a model that should be in SIF format (3 columns CSV like):

pknmodel = readSIF(CNOdata("PKN-ToyMMB.sif"))

and plot it:

plotModel(pknmodel, output="PNG")

The red edges indicates an inhibitor whereas other black edges are normal links. As we will see in the next section, you can add a cnolist as an argument to colorize this plot.

Using the previous CNOlist data structure, you can color the nodes according to their functions:

cnolist = CNOlist(CNOdata("MD-ToyMMB.csv"))
plotModel(pknmodel, cnolist)

Red correspond to inhibitors, green to ligands and blue to measurements.

1.3. Boolean logic (one steady state)

authors:Thomas Cokelaer
date:oct 2012
version:cellnopt 1.4.0
version:cellnopt 1.5.17

Let us now optimise a MIDAS data set to a PKN network. First, let us load the data provided within CellNOpt:

library(CellNOptR)              # load the library
data(CNOlistToy, package="CellNOptR")                # load the data
cnolist = CNOlist(CNOlistToy)   # convert to a CNOlist instance
data(ToyModel, package="CellNOptR")                  # load the model
pknmodel = ToyModel             # rename it

You can visualize the Network (with data information) as follows:

plotModel(pknmodel, cnolist)

Preprocess the data before the optimisation:

model = preprocessing(cnolist, pknmodel, compression=TRUE)


the preprocessing performs 3 tasks. First, it removes nodes that are not connected to any cues (green nodes) or readouts (blue nodes). Second, it compresses nodes that are not cues, readouts or inhibitors (red nodes) except those that have multiple inputs AND ouputs (e.g. Mek node in this case). Finally, it expands the nodes that have multiple inputs by adding “and” gates.

As an exercice, you can plot the new processed model.

Now, let us optimise the model against the data with a Genetic Algorithm. There are many optimisation method available in the literature but a GA is good enough for this toy problem. In the following statement with use the gaBinaryT1 function that performs a boolean optimisation on the first time point only:

opt = gaBinaryT1(cnolist, model, verbose=TRUE)

and look at the scores over time:


Since it has converged, we can now plot a figure that decomposes the fit of the best model against the data:

cutAndPlot(cnolist, model, bStrings=list(opt$bString))

In the resulting figure we can see that the specy NFkB has a high mismatch, which is indicated by the colored boxes


1.4. Boolean logic (two steady state)

authors:Thomas Cokelaer
date:Nov 2012
version:cellnopt 1.5.4

Finally, we can repeat the previous procedure by including an analysis on a second time point. This can be done with a new set of data that includes 2 time points.

library(CellNOptR)              # load the library
cnolist = CNOlist(CNOlistToy2)
data(ToyModel2, package="CellNOptR")
pknmodel = ToyModel2

# the preprocessing
model = preprocessing(cnolist, pknmodel, compression=TRUE)
optT1 = gaBinaryT1(cnolist, model, verbose=FALSE)
optT2 = gaBinaryTN(cnolist, model, verbose=FALSE, bStrings=list(optT1$bString))

As before, we can look at the first time points results using:

# looking at the results
cutAndPlot(cnolist, model, bStrings=list(optT1$bString))

The second optimisation results can be shown using the same function but providing the two optimisation bitstrings:

# looking at the results for 2 time points
cutAndPlot(cnolist, model, bStrings=list(optT1$bString, optT2$bString))