Last data update: 2014.03.03

R: Permutation Test for Overlap
overlapPermTestR Documentation

Permutation Test for Overlap

Description

Performs a permutation test to see if there is an association in overlap between a region set A and a region set B creating random regions through the genome.

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)

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

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(regioneR)
Loading required package: memoise
Loading required package: GenomicRanges
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: IRanges
Loading required package: GenomeInfoDb
Loading required package: BSgenome
Loading required package: Biostrings
Loading required package: XVector
Loading required package: rtracklayer
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/regioneR/overlapPermTest.Rd_%03d_medium.png", width=480, height=480)
> ### Name: overlapPermTest
> ### Title: Permutation Test for Overlap
> ### Aliases: overlapPermTest
> 
> ### ** 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)
[1] "Note: The minimum p-value with only 10 permutations is 0.0909090909090909. You should consider increasing the number of permutations."
   |                                                                               |                                                                      |   0%   |                                                                               |=======                                                               |  10%   |                                                                               |==============                                                        |  20%   |                                                                               |=====================                                                 |  30%   |                                                                               |============================                                          |  40%   |                                                                               |===================================                                   |  50%   |                                                                               |==========================================                            |  60%   |                                                                               |=================================================                     |  70%   |                                                                               |========================================================              |  80%   |                                                                               |===============================================================       |  90%   |                                                                               |======================================================================| 100%> summary(pt)
Permutation tests: 1
Significant permutation tests: 0
Iterations: 10
Randomization Function: randomizeRegions
Tests Results:
               pvalue zscore    test
numOverlaps 0.2727273 1.1177 greater
> plot(pt)
> plot(pt, plotType="Tailed")  
>  
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>