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.
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.
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.
References
Davison, A. C. and Hinkley, D. V. (1997) Bootstrap methods and their application, Cambridge University Press, United Kingdom, 156-160
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/permTest.Rd_%03d_medium.png", width=480, height=480)
> ### Name: permTest
> ### Title: Permutation Test
> ### Aliases: 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))
>
>
> pt2 <- permTest(A=A, B=B, ntimes=10, alternative="auto", verbose=TRUE, genome=genome, evaluate.function=meanDistance, randomize.function=randomizeRegions, non.overlapping=FALSE)
[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(pt2)
Permutation tests: 1
Significant permutation tests: 0
Iterations: 10
Randomization Function: randomizeRegions
Tests Results:
pvalue zscore test
meanDistance 0.09090909 -2.0205 less
> plot(pt2)
> plot(pt2, plotType="Tailed")
>
>
>
>
>
>
> dev.off()
null device
1
>