Description Usage Arguments Value Author(s) Examples
Determine the relative enrichment of a set of ranges versus random intervals #' across a set of tiles.
1 | enrichRanges(query, space, tiles)
|
query |
A GRanges object with the regions of interest to check for enrichment. |
space |
The result from using generateSpace. You can use the query ranges width as shown in the example. |
tiles |
The result from using createTiles. |
A list with two components. The first one is a vector with the number of overlaps for each of the query ranges versus the set space ranges for the number of permutations used to create the space.
The second component is a list with a vector for each of the tiles
binSize
. It has the enrichment of the query ranges versus the space
ranges for each of the permutations.
Leonardo Collado-Torres
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | ## Create some input ranges
library('GenomicRanges')
I <- GRanges(c('chr1', 'chrX'), IRanges(c(1e6, 3e6), width = 1e5), strand =
c('+', '-'))
## Intervals of interest to resample from
gr <- GRanges(c('chr1', 'chrX'), IRanges(c(1e6, 3e6), width = 1e3), strand =
c('+', '-'))
## Set the seed if you want to reproduce the random results
set.seed(20140728)
## Obtain 4 random intervals
space <- generateSpace(I, gr, nPermute = 1000)
## Get chr lengths
data(hg19Ideogram, package = 'biovizBase', envir = environment())
seqlengths <- seqlengths(hg19Ideogram)[c("chr1", "chrX")]
## Define some gaps to remove from tiling
gaps <- GRanges(c('chr1', 'chrX'), IRanges(c(2e8, 1e8), width = 1e6))
## Create the tiles
tiles <- createTiles(seqlengths, gaps, binSize = c(1e3, 1e4))
## Build query
query <- GRanges(c('chr1', 'chrX'), IRanges(c(1e6, 3e6), width = c(1234,
4321)), strand = c('+', '-'))
## Get the results
enrich <- enrichRanges(query, space, tiles)
## Number of overlaps between query and space ranges for all permutations
## per query range
head(enrich["Query.vs.Space"])
## Enrichment result for first tiles binSize comparing query overlaps with
## the tiles and space overlaps with the tiles for each permutation
head(enrich[["Query.and.Space.vs.Tiles"]][[1]])
## Should be equal to the number of permutations used
length(enrich[["Query.and.Space.vs.Tiles"]][[1]])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.