plotHelix: Plots helices in arc diagram

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/plot.R

Description

Plots a helix data frame as an arc diagram, with styling possible with properly named additional columns on the data frame.

Usage

1
2
3
4
5
6
7
    plotHelix(helix, x = 0, y = 0, flip = FALSE, line = FALSE, arrow = FALSE,
        add = FALSE, shape = "circle", ...)
    plotDoubleHelix(top, bot, line = TRUE, arrow = FALSE, add = FALSE, ...)
    plotOverlapHelix(predict, known, miss = "black", line = TRUE,
        arrow = FALSE, add = FALSE, overlap.cutoff = 1, ...)
    plotArcs(i, j, length, x = 0, y = 0, flip = FALSE, shape = "circle", ...)
    plotArc(i, j, x = 0, y = 0, flip = FALSE, shape = "circle", ...)

Arguments

helix, top, bot, predict, known

Helix data.frames, with the four mandatory columns. Any other column will be considered a styling column, and will be used for styling the helix. See example for styling usage. See Details for exact usage of each helix.

x, y

The coordinate of the left bottom corner of the plot, useful for manually positioning figure elements.

flip

If TRUE, flips the arcs upside down about the y-axis.

line

If TRUE, a horizontal line representing the sequence is plotted.

arrow

If TRUE, an arrow is played on the right end of the line.

add

If TRUE, graphical elements are added to the active plot device, else a new plot device is created for the plot.

shape

One of "circle", "triangle", or "square", specifying the shape of the arcs.

miss

The colour for unpredicted arcs in overlapping diagrams, see details for more information.

overlap.cutoff

Decimal between 0 and 1 indicating the percentage of basepairs within a helix that have to be overlapping for the entire helix to count as overlapping. Default is 1, or 100

i, j

The starting and ending position of the arc along the x-axis

length

The total number of arcs to draw by incrementing i and decrementing j. Used to draw helices.

...

Any additional parameters passed to par

Details

plotHelix creates a arc diagram with all arcs on top, plotDoubleHelix creates a diagram with arcs on the top and bottom. plotOverlapHelix is slight trickier, and given two structures predict and known, plots the predicted helices that are known on top, predicted helices that are not known on the bottom, and finally plots unpredicted helices on top in the colour defined by miss.

plotArc and plotArcs are the core functions that make everything work, and may be used for extreme fine-tuning and customization.

Value

Not intended to return a value, will plot to GUI or file if specific.

Author(s)

Daniel Lai

See Also

colourByCount

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
26
27
28
29
30
31
32
    data(helix)

    # Plot helix plain
    plotHelix(known)

    # Apply global appearance options
    plotHelix(known, line = TRUE, arrow = TRUE, col = "blue", lwd = 1.5)

    # Add extra column with styling options
    known$lty <- 1:4
    known$lwd <- 1:2
    known$col <- c(rgb(1, 0, 0), "orange", "yellow", "#00FF00", 4, "purple")
    plotHelix(known)

    # Manually colour helices according to value
    helix$col <- "red"
    helix$col[which(helix$value < 1e-3)] <- "orange"
    helix$col[which(helix$value < 1e-4)] <- "green"
    helix$col[which(helix$value < 1e-5)] <- "blue"
    plotHelix(helix)

    # Automatically creating a similar plot with legend
    coloured <- colourByValue(helix, log = TRUE, get = TRUE)
    plotHelix(coloured, line = TRUE, arrow = TRUE)
    legend("topleft", legend = attr(coloured, "legend"),
        fill = attr(coloured, "fill"), title = "P-value", text.col = "black")    

    # Plot both helices with styles
    plotDoubleHelix(helix, known)

    # Overlap helix
    plotOverlapHelix(helix, known)

Example output

Loading required package: Biostrings
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

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

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

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

    IQR, mad, sd, var, xtabs

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

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colMeans, colSums, colnames, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int,
    pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply,
    setdiff, sort, table, tapply, union, unique, unsplit, which,
    which.max, which.min

Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

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

    expand.grid

Loading required package: IRanges
Loading required package: XVector

Attaching package: 'Biostrings'

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

    strsplit

R4RNA documentation built on Nov. 8, 2020, 5:15 p.m.