sampleRandomRegions: Sample random regions of fixed length.

View source: R/sample_random_regions.R

sampleRandomRegionsR Documentation

Sample random regions of fixed length.

Description

Sample random regions from the mappable parts of the genome with a given fraction from CpG islands.

Usage

sampleRandomRegions(allowedRegions = NULL, N = 100L, regWidth = 200L)

Arguments

allowedRegions

An unstranded GRanges object of the "allowed" of the genome, usually the mappable regions.

N

Number of regions to sample.

regWidth

Region width.

Details

In order to make the results deterministic, set the random number seed before calling sampleRandomRegions using set.seed.

Value

A GRanges object with randomly sampled mappable regions of width regWidth with fractionCGI coming from CpG islands.

Examples

regs <- GenomicRanges::GRanges(
  seqnames = rep(c("chr1", "chr2"), each = 2), 
  ranges = IRanges::IRanges(start = 1:4, end = 5:8))
set.seed(123)
sampleRandomRegions(regs, N = 2, regWidth = 3L)


fmicompbio/monaLisa documentation built on Nov. 2, 2024, 1:33 p.m.