Learn R Programming

regioneR (version 1.4.0)

numOverlaps: Number Of Overlaps

Description

Returns the number of regions in A overlapping any region in B

Usage

numOverlaps(A, B, count.once=FALSE, ...)

Arguments

A
a region set in any of the formats accepted by toGRanges (GenomicRanges, data.frame, etc...)
B
a region set in any of the formats accepted by toGRanges (GenomicRanges, data.frame, etc...)
count.once
boolean indicating whether the overlap of multiple B regions with a single A region should be counted once or multiple times
...
any additional parameters needed

Value

It returns a numeric value that is the number of regions in A overlapping at least one region in B.

See Also

overlapPermTest, permTest

Examples

Run this code

genome <- filterChromosomes(getGenome("hg19"), keep.chr="chr1")
A <- createRandomRegions(nregions=20, length.mean=10000000, length.sd=20000, genome=genome, non.overlapping=FALSE) 
B <- c(A, createRandomRegions(nregions=10, length.mean=10000, length.sd=20000, genome=genome, non.overlapping=FALSE))

numOverlaps(A, B)
numOverlaps(A, B, count.once=TRUE)
 

Run the code above in your browser using DataLab