regioneR (version 1.4.0)

permTest: Permutation Test

Description

Performs a permutation test to see if there is an association between a region set and some other feature using an evaluation function.

Usage

permTest(A, ntimes=100, randomize.function, evaluate.function, alternative="auto", min.parallel=1000, force.parallel=NULL, randomize.function.name=NULL, evaluate.function.name=NULL, verbose=FALSE, ...)

Arguments

A
a region set in any of the accepted formats by toGRanges (GenomicRanges, data.frame, etc...)
ntimes
number of permutations
randomize.function
function to create random regions. It must return a set of regions.
evaluate.function
function to search for association. It must return a numeric value.
alternative
the alternative hypothesis must be one of "greater", "less" or "auto". If "auto", the alternative will be decided depending on the data.
min.parallel
if force.parallel is not specified, this will be used to determine the threshold for parallel computation. If length(A) * ntimes > min.parallel, it will activate the parallel computation. Single threaded otherwise.
force.parallel
logical indicating if the computation must be paralelized.
randomize.function.name
character. If specified, the permTestResults object will have this name instead of the name of the randomization function used. Useful specially when using unnamed anonymous functions.
evaluate.function.name
character. If specified, the permTestResults object will have this name instead of the name of the evaluation function used. Useful specially when using unnamed anonymous functions.
verbose
a boolean. If verbose=TRUE it creates a progress bar to show the computation progress. When combined with parallel computation, it might have an impact in the total computation time.
...
further arguments to be passed to other 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)
  • randomize.function the randomization function used.
  • randomize.function.name the name of the randomization used.
  • evaluate.function the evaluation function used.
  • evaluate.function.name the name of the evaluation function used.

Details

permTest performs a permutation test of the regions in RS to test the association with the feature evaluated with the evaluation function. The regions are randomized using the randomization.function and the evaluation.function is used to evaluate them. More information can be found in the vignette.

References

Davison, A. C. and Hinkley, D. V. (1997) Bootstrap methods and their application, Cambridge University Press, United Kingdom, 156-160

See Also

overlapPermTest

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

 
pt2 <- permTest(A=A, B=B, ntimes=10, alternative="auto", verbose=TRUE, genome=genome, evaluate.function=meanDistance, randomize.function=randomizeRegions, non.overlapping=FALSE)
summary(pt2)
plot(pt2)
plot(pt2, plotType="Tailed")

Run the code above in your browser using DataLab