Last data update: 2014.03.03

R: Plots helices in arc diagram
Plot Helix StructuresR Documentation

Plots helices in arc diagram

Description

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

Usage

    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

    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)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(R4RNA)
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, xtabs

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

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, 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, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

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

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: IRanges
Loading required package: XVector
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/R4RNA/plotHelix.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Plot Helix Structures
> ### Title: Plots helices in arc diagram
> ### Aliases: plotHelix plotDoubleHelix plotOverlapHelix plotArcs plotArc
> ### Keywords: aplot
> 
> ### ** Examples
> 
>     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)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>