View source: R/randomizeRegions.R
randomizeRegions | R Documentation |
Given a set of regions A and a genome, this function returns a new set of regions randomly distributted in the genome.
randomizeRegions(A, genome="hg19", mask=NULL, allow.overlaps=TRUE, per.chromosome=FALSE, ...)
A |
The set of regions to randomize. A region set in any of the accepted formats by |
genome |
The reference genome to use. A valid genome object. Either a |
mask |
The set of regions specifying where a random region can not be (centromeres, repetitive regions, unmappable regions...). A region set in any of the accepted formats by |
allow.overlaps |
A boolean stating whether the random regions can overlap (FALSE) or not (TRUE). |
per.chromosome |
Boolean. If TRUE, the regions will be created in a per chromosome maner -every region in A will be moved into a random position at the same chromosome where it was originally-. |
... |
further arguments to be passed to or from methods. |
The new set of regions will be created with the same sizes of the original ones, and optionally placed in the same chromosomes.
In addition, they can be made explicitly non overlapping and a mask can be provided so no regions fall in an undesirable part of the genome.
It returns a GenomicRanges
object with the regions resulting from the randomization process.
randomizeRegions assumes that chromosomes start at base 1. If a chromosome starts at another base number, for example at base 1000, random regions might appear in the [1:1000] interval. This should not affect most uses of randomizeRegions, but might be important in some advanced analysis involving artificially contructed genomes.
toDataframe
, toGRanges
, getGenome
, getMask
, getGenomeAndMask
, characterToBSGenome
, maskFromBSGenome
, resampleRegions
, createRandomRegions
, circularRandomizeRegions
A <- data.frame("chr1", c(1, 10, 20, 30), c(12, 13, 28, 40))
mask <- data.frame("chr1", c(20000000, 100000000), c(22000000, 130000000))
genome <- data.frame(c("chr1", "chr2"), c(1, 1), c(180000000, 20000000))
randomizeRegions(A)
randomizeRegions(A, genome=genome, mask=mask, per.chromosome=TRUE, allow.overlaps=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.