plotAttractors: Plot state tables or transition graphs of attractors

Description Usage Arguments Details Value See Also Examples

View source: R/plotAttractors.R

Description

Visualizes attractors, either by drawing a table of the involved states in two colors, or by drawing a graph of transitions between the states of the attractor.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
plotAttractors(attractorInfo, 
               subset, 
               title = "", 
               mode = c("table","graph"),
               grouping = list(), 
               plotFixed = TRUE, 
               onColor = "#4daf4a",
               offColor = "#e41a1c",
               layout = layout.circle, 
               drawLabels = TRUE,
               drawLegend = TRUE,
               ask = TRUE,
               reverse = FALSE,
               borderColor = "black",
               eps = 0.1, 
               allInOnePlot = FALSE,
               ...) 

Arguments

attractorInfo

An object of class AttractorInfo, as returned by getAttractors, or an object of class SymbolicSimulation, as returned by simulateSymbolicModel.

subset

An subset of attractors to be plotted. This is a vector of attractor indices in attractorInfo.

title

An optional title for the plot

mode

Switches between two kinds of attractor plots. See Details for more information. Default is "table".

grouping

This optional parameter is only used if mode="table" and specifies a structure to form groups of genes in the plot. This is a list with the following elements:

class

A vector of names for the groups. These names will be printed in the region belonging to the group in the plot.

index

A list with the same length as class. Each element is a vector of gene names or gene indices belonging to the group.

plotFixed

This optional parameter is only used if mode="table". If this is true, genes with fixed values are included in the plot. Otherwise, these genes are not drawn.

onColor

This optional parameter is only used if mode="table" and specifies the color value for the 1/ON values in the table. Defaults to greenish color.

offColor

This optional parameter is only used if mode="table" and specifies the color value for the 0/OFF values in the table. Defaults to reddish color.

layout

If mode="graph", this parameter specifies a layouting function that determines the placement of the nodes in the graph. Please refer to the layout manual entry in the igraph package for further details. By default, the circle layout is used.

drawLabels

This parameter is only relevant if mode="graph". It determines whether the nodes of the graph are annotated with the corresponding values of the genes in the attractor states.

drawLegend

Specifies whether a color key for the ON/OFF states is drawn if mode="table". Defaults to TRUE.

ask

If set to true, the plot function will prompt for a user input for each new plot that is shown on an interactive device (see link{par("ask")}).

reverse

Specifies the order of the genes in the plot. By default, the first gene is placed in the first row of the plot. If reverse=TRUE (which was the default until BoolNet version 2.0.2), the first gene in the network is placed in the bottom row of the plot.

borderColor

Specifies the border or seprating color of states in an attractor. Defaults to "black".

eps

Specifies plotting margin for the sequence of states. Defaults to 0.1.

allInOnePlot

If this is TRUE then all attractors, with mode = "table", are plotted in one plot as specified internally by par$mfrow parameter. Previous value of the par$mfrow parameter is preserved. Defaults to FALSE, meaning the plots for more than one attractor will be switched interactively or all plotted in an non-interactive graphical device.

...

Further graphical parameters to be passed to plot.igraph if mode="graph".

Details

This function comprises two different types of plots:

The "table" mode visualizes the gene values of the states in the attractor and is only suited for synchronous or steady-state attractors. Complex asynchronous attractors are omitted in this mode. Attractors in attractorInfo are first grouped by length. Then, a figure is plotted to the currently selected device for each attractor length (i.e. one plot with all attractors consisting of 1 state, one plot with all attractors consisting of 2 states, etc.). If ask=TRUE and the standard X11 output device is used, the user must confirm that the next plot for the next attractor size should be shown. The figure is a table with the genes in the rows and the states of the attractors in the columns. Cells of the table are (by default) red for 0/OFF values and green for 1/ON values. If grouping is set, the genes are rearranged according to the indices in the group, horizontal separation lines are plotted between the groups, and the group names are printed.

The "graph" mode visualizes the transitions between different states. It creates a graph in which the vertices are the states in the attractor and the edges are state transitions among these states. This mode can visualize all kinds of attractors, including complex/loose attractors. One plot is drawn for each attractor. As before, this means that on the standard output device, only the last plot is displayed unless you set par(mfrow=c(...)) accordingly.

Value

If mode="table", a list of matrices corresponding to the tables is returned. Each of these matrices has the genes in the rows and the states of the attractors in the columns.

If mode="graph", a list of objects of class igraph is returned. Each of these objects describes the graph for one attractor.

See Also

getAttractors, simulateSymbolicModel, attractorsToLaTeX, plotSequence, sequenceToLaTeX

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# load example data
data(cellcycle)

# get attractors
attractors <- getAttractors(cellcycle)

# calculate number of different attractor lengths, 
# and plot attractors side by side in "table" mode
par(mfrow=c(1, length(table(sapply(attractors$attractors,
                          function(attractor)
                          {
                            length(attractor$involvedStates)
                          })))))
plotAttractors(attractors)

# plot attractors in "graph" mode
par(mfrow=c(1, length(attractors$attractors)))
plotAttractors(attractors, mode="graph")

# identify asynchronous attractors
attractors <- getAttractors(cellcycle, type="asynchronous")

# plot attractors in "graph" mode
par(mfrow=c(1, length(attractors$attractors)))
plotAttractors(attractors, mode="graph")

Example output

$`1`
       Attr1.1
CycD         0
Rb           1
E2F          0
CycE         0
CycA         0
p27          1
Cdc20        0
Cdh1         1
UbcH10       0
CycB         0

$`7`
       Attr2.1 Attr2.2 Attr2.3 Attr2.4 Attr2.5 Attr2.6 Attr2.7
CycD         1       1       1       1       1       1       1
Rb           0       0       0       0       0       0       0
E2F          0       0       0       0       1       1       1
CycE         1       0       0       0       0       1       1
CycA         1       1       1       0       0       0       1
p27          0       0       0       0       0       0       0
Cdc20        0       0       1       1       0       0       0
Cdh1         0       0       0       1       1       1       1
UbcH10       0       1       1       1       1       0       0
CycB         0       1       1       0       0       0       0

Loading required package: igraph

Attaching package: 'igraph'

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union

[[1]]
IGRAPH DN-- 1 1 -- 
+ attr: name (v/c)
+ edge (vertex names):
[1] 0100010100->0100010100

[[2]]
IGRAPH DN-- 7 7 -- 
+ attr: name (v/c)
+ edges (vertex names):
[1] 1001100000->1000100011 1000100011->1000101011 1000101011->1000001110
[4] 1000001110->1010000110 1010000110->1011000100 1011000100->1011100100
[7] 1011100100->1001100000

Using initial states:
0011010101
1000111010
1010000110
1100100010
0111111101
1111001111
0011110100
1001110101
0000110000
1111000100
1010011101
0000000000
0111010000
1100111000
0111100010
0111011010
0111110010
1101010101
1101011000
0111000001
1101101101
1110101110
1101111011
0101111000
1110110000
0111001010
1010111100
0111010111
0100100110
1111010111
1100001000
0000101010
1111011101
1000100100
0110100010
0011001101
0100010110
1101101110
1000011111
0101110101
1100010001
1010101010
1000000100
1100001011
0000110001
1101001110
1001111100
1000000111
0000000010
0101010011
1000110000

[[1]]
IGRAPH DN-- 1 1 -- 
+ attr: name (v/c)
+ edge (vertex names):
[1] 0100010100->0100010100

[[2]]
IGRAPH DN-- 112 338 -- 
+ attr: name (v/c)
+ edges (vertex names):
 [1] 1011101111->1011101110 1011101111->1011001111 1011101111->1001101111
 [4] 1001101111->1001101110 1001101111->1001001111 1001101111->1000101111
 [7] 1010101111->1010101110 1010101111->1010001111 1010101111->1011101111
[10] 1010101111->1000101111 1000101111->1000101110 1000101111->1000001111
[13] 1011001111->1011001110 1011001111->1001001111 1001001111->1001001110
[16] 1001001111->1000001111 1010001111->1010001110 1010001111->1011001111
[19] 1010001111->1000001111 1000001111->1000001110 1011101011->1011101010
[22] 1011101011->1011101111 1011101011->1011001011 1011101011->1001101011
+ ... omitted several edges

BoolNet documentation built on May 29, 2017, 9:59 p.m.