segmentDensity {nullranges} | R Documentation |
This function allows for various methods (see type
)
of segmenting based on the density of features x
.
segmentDensity(x, n, L_s = 1e+06, exclude = NULL, type = c("cbs", "hmm"))
x |
the input GRanges, e.g. genes |
n |
the number of states |
L_s |
segment length |
exclude |
GRanges of excluded region |
type |
the type of segmentation, either
Circular Binary Segmentation |
a GRanges with metadata columns containing:
state segmentation state
counts average number of genes
n <- 10000 library(GenomicRanges) gr <- GRanges("chr1", IRanges(round( c(runif(n/4,1,991), runif(n/4,1001,3991), runif(n/4,4001,4991), runif(n/4,7001,9991))), width=10), seqlengths=c(chr1=10000)) gr <- sort(gr) exclude <- GRanges("chr1", IRanges(5001,6000), seqlengths=c(chr1=10000)) seg <- segmentDensity(gr, n=3, L_s=100, exclude=exclude, type="cbs")