Conduct permutation enrichment tests between all combinations of two named lists, each containing one or more GRanges objects. Permutation tests are run using overlapPermTest.

test_enrichment(
  grlist1,
  grlist2,
  ntimes = 100,
  genome = "hg19",
  alternative = "auto",
  min.parallel = 1000,
  force.parallel = NULL,
  seed = 2022,
  mc.set.seed = FALSE,
  verbose = TRUE,
  ...
)

Arguments

grlist1

First list of GRanges objects.

grlist2

Second list of GRanges objects.

ntimes

number of permutations

genome

The reference genome to use. A valid genome object. Either a GenomicRanges or data.frame containing one region per whole chromosome or a character uniquely identifying a genome in BSgenome (e.g. "hg19", "mm10" but not "hg"). Internally it uses getGenomeAndMask.

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.

seed

Set the seed for reproducibility.

mc.set.seed

"In order to create reproducible code with functions that use random numbers such as the permutation testing in regioneR , it is necessary to use set.seed. However, since regioneR uses parallel to perform the test it is also necessary to set the mc.set.seed parameter to FALSE to ensure reproducibility."

verbose

Print messages.

...

Additional arguments passed to overlapPermTest.

Value

data.frame

Examples

dat <- echodata::get_Nalls2019_merged() 
grlist1 <- dat[P<5e-8,]
grlist2 <- dat[Support>0,] 
enrich <- test_enrichment(grlist1 = grlist1,
                          grlist2 = grlist2,  
                          ntimes = 25) 
#> 
#> grlist1: item1 
#> + grlist2:  item1
#> [1] "Note: The minimum p-value with only 25 permutations is 0.0384615384615385. You should consider increasing the number of permutations."
#> Auto-setting parallel computing to: TRUE
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |===============================                                       |  44%
  |                                                                            
  |==============================================================        |  88%
  |                                                                            
  |======================================================================| 100%
#> Warning: All permuted values are equal to 0. Z-score is infinite.