resampleGenome: resampleGenome

View source: R/resampleGenome.R

resampleGenomeR Documentation

resampleGenome

Description

Fast alternative to randomizeRegions. It creates a tiling (binning) of the whole genome with tiles the mean size of the regions in A and then places the regions by sampling a length(A) number of tiles and placing the resampled regions there.

Usage

resampleGenome(A, simple = FALSE, per.chromosome = FALSE, genome="hg19", min.tile.width=1000, ...)

Arguments

A

an object of class GenomigRanges

simple

logical, if TRUE the randomization process will not take into account the specific width of each region in A. (defalut = FALSE)

per.chromosome

logical, if TRUE the randomization will be perform by chromosome. (default = TRUE)

genome

character or GenomicRanges, genome using for the randomization

min.tile.width

integer, the minimum size of the genome tiles. If they are too small, the functions gets very slow and may even fail to work. (default = 1000, 1kb tiles)

...

further arguments to be passed to other methods.

Value

a GenomicRanges object. A sample from the universe with the same length as A.

See Also

toDataframe, toGRanges, randomizeRegions, createRandomRegions

Examples


A <- data.frame(chr=1, start=c(2,12,28,35), end=c(5,25,33,43))

B <- resampleGenome(A)
B
width(B)

B2 <- resampleGenome(A, simple=TRUE)
B2
width(B2)

resampleGenome(A, per.chromosome=TRUE)



bernatgel/regioneR documentation built on Sept. 10, 2023, 12:03 a.m.