hc_layer-HilbertCurve-method: Add a new layer to the Hilbert curve

Description Usage Arguments Details Value Author(s) Examples

Description

Add a new layer to the Hilbert curve

Usage

1
2
3
4
## S4 method for signature 'HilbertCurve'
hc_layer(object, ir, x1 = NULL, x2 = x1, col = "red", border = NA,
    mean_mode = c("w0", "absolute", "weighted"), grid_line = 0,
    grid_line_col = "black", overlay = default_overlay)

Arguments

object

A HilbertCurve-class object.

ir

an IRanges object which specifies the input intervals.

x1

if start positions are not integers, they can be set by x1.

x2

if end positions are not integers, they can be set by x2.

col

a scalar or a vector of colors which correspond to intervals in ir (or x1 and x2).

border

a scalar or a vector of colors for the borders of intervals. Set it to NA if borders are suppressed.

mean_mode

Under 'pixel' mode, each pixel represents a small window. This argument provides methods to summarize value for the small window if the input intervals can not completely overlap with the window. See explanation in hc_points,HilbertCurve-method.

grid_line

whether add grid lines to show blocks of the Hilber curve. It should be an integer number and there will be 2^(grid_line-1)-1 horizontal and vertical grid lines.

grid_line_col

color for the grid lines

overlay

a self-defined function which defines how to overlay new layer to the plot. By default it is default_overlay. Let's assume the red channel for the layers which are already in the plot is r0, the red channel for the new layer is r and the alpha channel is alpha, the overlayed color is calculated as r*alpha + r0*(1-alpha). This self-defined function should accept 7 arguments which are: vectors of r, g, b channels which correspond to the layers that are already in the plot, and r, g, b, alpha channels which corresponds to the new layer. All the values passed into are between 0 to 1. The returned value for this function should be a list which contains r, g, b channels which correspond to the overlayed colors. Note that these 7 arguments only correspond to the pixels which are covered by the new layer.

Details

This function only works under 'pixel' mode.

Under "pixel" mode, color is the only graphic representation of values in the input intervals. To make a more precise and robust color mapping, users may consider colorRamp2 to create a color mapping function.

If you want to add more than one layers to the curve, remember to set colors with transparency.

overlay argument is useful for changing color themes for the overlapped areas, please refer to the vignette to see examples of how to swith color themes in easy ways.

Value

No value is returned.

Author(s)

Zuguang Gu <z.gu@dkfz.de>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
hc = HilbertCurve(1, 100, level = 9, mode = "pixel")

x = sort(sample(100, 20))
s = x[1:10*2 - 1]
e = x[1:10*2]
ir = IRanges(s, e)

hc_layer(hc, ir)

hc = HilbertCurve(1, 100, level = 9, mode = "pixel")
hc_layer(hc, ir, grid_line = 3)

hc = HilbertCurve(1, 100, level = 9, mode = "pixel")
hc_layer(hc, ir, border = "black")

eilslabs/HilbertCurve documentation built on May 16, 2019, 1:23 a.m.