test_enrichment: Test enrichment

View source: R/test_enrichment.R

test_enrichmentR Documentation

Test enrichment

Description

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

Usage

test_enrichment(
  grlist1,
  grlist2,
  ntimes = 100,
  genome = "hg19",
  alternative = "auto",
  min.parallel = 1000,
  force.parallel = NULL,
  seed = 2022,
  mc.set.seed = FALSE,
  save_path = tempfile(fileext = "_test_enrichment.rds"),
  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."

save_path

Path to save results to as an RDS file. Set to NULL to skip this step.

verbose

Print messages.

...

Arguments passed on to regioneR::overlapPermTest

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

Value

data.frame

Source

See section "3.7A note on reproducibility" for info on setting the seed.

Examples

dat <- echodata::get_Nalls2019_merged() 
grlist1 <- dat[P<5e-8,]
grlist2 <- dat[Support>0,] 
enrich <- test_enrichment(grlist1 = grlist1,
                          grlist2 = grlist2,  
                          ntimes = 25,
                          force.parallel = FALSE) 

RajLabMSSM/echoannot documentation built on Oct. 26, 2023, 2:41 p.m.