addBins: addBins()

View source: R/addBins.R

addBinsR Documentation

addBins()

Description

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

Usage

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

Arguments

rse

a SummarizedExperiment or 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. rse should be sorted first, usually with the addMetricAndArrangeGRanges() function. addBin(rse, bin = vec) is equivalent to rse$bin <- vec, while addBin(rse, nbins = 5) will create 5 bins of equal size based on rse order.

Value

the RangedSummarizedExperiment or GRanges object with a new bin metadata column

See Also

addMetricAndArrangeGRanges plotBinning

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)))

GenEpi-GenPhySE/epistack documentation built on July 27, 2023, 1:09 a.m.