addBins {epistack}R Documentation

addBins()

Description

Add an optional bin metadata column to gr, to serve as annotations for the epistack plots.

Usage

addBins(gr, nbins = 5L, bin = NULL)

Arguments

gr

a GRanges object.

nbins

an integer number, the number of bins.

bin

a vector containing pre-determined bins, in the same order as gr.

Details

nbins is taken into account only if bin is NULL. gr should be sorted first, usually with the addMetricAndArrangeGRanges() function. addBin(gr, bin = vec) is equivalent to gr$bin <- vec, while addBin(gr, nbins = 5) will create 5 bins of equal size based on gr order.

Value

the gr GRanges object with a new bin metadata column

See Also

addMetricAndArrangeGRanges

Examples

data("stackepi")
addBins(stackepi)

# 3 bins instead of 5
addBins(stackepi, nbins = 3)

# assign bins using a vector
addBins(stackepi, bin = rep(c("a", "b", "c"),
 length.out = length(stackepi)))

[Package epistack version 1.0.0 Index]