overlapPermTest: Permutation Test for Overlap

View source: R/overlapPermTest.R

overlapPermTestR Documentation

Permutation Test for Overlap

Description

Performs a permutation test to see if the overlap between two sets of regions A and B is higher (or lower) than expected by chance. It will internally call permTest with the appropiate parameters to perform the permutation test. If B is a list or a GRangesList, it will perform one permutation test per element of the list, testing the overlap between A and each element of B independently.

Usage

overlapPermTest (A, B, alternative="auto", ...)

Arguments

A

a region set in any of the accepted formats by toGRanges (GenomicRanges, data.frame, etc...)

B

a region set in any of the accepted formats by toGRanges (GenomicRanges, data.frame, etc...)

alternative

the alternative hypothesis must be one of "greater", "less" or "auto". If "auto", the alternative will be decided depending on the data.

...

further arguments to be passed to or from methods.

Value

A list of class permTestResults containing the following components:

  • pval the p-value of the test.

  • ntimes the number of permutations.

  • alternative a character string describing the alternative hypotesis.

  • observed the value of the statistic for the original data set.

  • permuted the values of the statistic for each permuted data set.

  • zscore the value of the standard score. (observed-mean(permuted))/sd(permuted)

Note

IMPORTANT: Since it uses link{permTest} internally, it is possible to use most of the parameters of that function in overlapPermTest, including: ntimes, force.parallel, min.parallel and verbose. In addition, this function accepts most parameters of the randomizeRegions function including genome, mask, allow.overlaps and per.chromosome and the parameters of numOverlaps such as count.once.

See Also

overlapGraphicalSummary, overlapRegions, toDataframe, toGRanges, permTest

Examples

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))

pt <- overlapPermTest(A=A, B=B, ntimes=10, genome=genome, non.overlapping=FALSE, verbose=TRUE)
summary(pt)
plot(pt)
plot(pt, plotType="Tailed")  
 
 
C <- c(B, createRandomRegions(nregions=10, length.mean=10000, length.sd=20000, genome=genome, non.overlapping=FALSE))
pt <- overlapPermTest(A=A, B=list(B=B, C=C), ntimes=10, genome=genome, non.overlapping=FALSE, verbose=TRUE)
summary(pt)
plot(pt)
 

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