R: Create LaTeX table of state sequences

sequenceToLaTeX {BoolNet} | R Documentation

## Create LaTeX table of state sequences

### Description

Exports tables of state sequences (corresponding to the plot generated by `plotSequence` with `mode="table"`) to a LaTeX document.

### Usage

    sequenceToLaTeX(network,
                    startState,
                    includeAttractorStates = c("all","first","none"),
                    sequence,
                    title = "",
                    grouping = list(),
                    plotFixed = TRUE,
                    onColor="[gray]{0.9}",
                    offColor="[gray]{0.6}",
                    highlightAttractor=TRUE,
                    reverse = FALSE,
                    file="sequence.tex")

### Arguments

`network` | An object of class `BooleanNetwork` or `SymbolicBooleanNetwork` for which a sequence of state transitions is calculated
`startState` | The start state of the sequence
`includeAttractorStates` | Specifies whether the actual attractor states are included in the table or not (see also `getPathToAttractor`). If `includeAttractorStates = "all"` (which is the default behaviour), the sequence ends when the attractor was traversed once. If `includeAttractorStates = "first"`, only the first state of attractor is added to the sequence. If includeAttractorStates = "none", the sequence ends with the last non-attractor state.
`sequence` | The alternative call to `sequenceToLaTeX` requires the specification of the sequence itself instead of the network and the start state. The sequence must be provided as a data frame with the genes in the columns and the successive states in the rows. For example, sequences can be obtained using `getPathToAttractor` or `getAttractorSequence` (however, the specialized function `attractorsToLaTeX` exists for attractors).
`title` | An optional title for the table
`plotFixed` | If this is true, genes with fixed values are included in the plot. Otherwise, these genes are not shown.
`grouping` | This optional parameter specifies a structure to form groups of genes in the table. 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 tabke. index A list with the same length as `class`. Each element is a vector of gene names or gene indices belonging to the group.
`onColor` | An optional color value for the 1/ON values in the table. Defaults to dark grey.
`offColor` | An optional color value for the 0/OFF values in the table. Defaults to light grey.
`highlightAttractor` | If set to true, the attractor states are highlighted in the plot by drawing a line at the begin of the attractor and labeling the states correspondingly. Information on the attractor must be supplied in the attribute `attractor` of the sequence, which is a vector of indices of the states that belong to the attractor. This attribute is usually present if the sequence was obtained using `getPathToAttractor`.
`reverse` | Specifies the order of the genes in the plot. By default, the first gene is placed in the first row of the table. If `reverse=TRUE`, the first gene in the network is placed in the bottom row of the table.
`file` | The file to which the LaTeX document is written. Defaults to "sequence.tex".

### Details

This function creates a LaTeX table that visualizes a sequence of states in a synchronous network. The output file does not contain a document header and requires the inclusion of the packages `tabularx` and `colortbl`. The tables have the genes in the rows and the successive states of the sequence in the columns. If not specified otherwise, cells of the table are light grey for 0/OFF values and dark grey 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 function can be called with different types of inputs: The user can specify the parameters `network`, `startState` and `includeAttractorStates`), in which case `getPathToAttractor` is called to obtain the sequence. Alternatively, the sequence can be supplied directly as a data frame in the `sequence` parameter.

### Value

Returns a matrix corresponding to the table. The matrix has the genes in the rows and the states of the attractors in the columns. If `sequence` was supplied, this corresponds to the transposed input whose rows may be rearranged if `grouping` was set.

### See Also

`attractorsToLaTeX`, `plotSequence`, `plotAttractors`, `getPathToAttractor`, `getAttractorSequence`.

### Examples

    # load example data
    data(cellcycle)

    # alternative 1: supply network and start state
    # and export sequence to LaTeX
    sequenceToLaTeX(network=cellcycle,
                    startState=rep(1,10),
                    includeAttractorStates="all",
                    file="sequence.txt")

    # alternative 2: calculate sequence in advance
    sequence <- getPathToAttractor(cellcycle,
                                   state=rep(1,10),
                                   includeAttractorStates="all")

    sequenceToLaTeX(sequence=sequence,
                    file="sequence.txt")

[Package BoolNet version 2.1.4 Index]