Currently the 'permutation' approach is implemented. If output is specified, the resampling matrix will be written to disk, and can be connected to with resamplingFile, otherwise a matrix is returned. Can be used in combination with assocTest to perform resampling tests.

buildResamplingFile(
  nSamples,
  nResampling = 1000,
  memlimit = 1000,
  methodResampling = "permutation",
  output = NULL
)

Arguments

nSamples

Number of samples.

nResampling

Number of resamplings. Defaults to 1000.

memlimit

Maximum number of resamplings to generate at a time (chunk size). Relevant when writing to output to manage memory usage. Defaults to 1000.

methodResampling

Resampling method, currently 'permutation' is implemented.

output

File path (.gz extension) to write output to. If not specified, a matrix with resamplings is returned.

Value

If output is NULL, returns a matrix of dimensions nSamples x nResampling. If output is specified, the function writes to the file and returns NULL.

Examples

library(rvatData)
# build and connect to a resamplingFile
file <- tempfile(fileext = ".gz")
buildResamplingFile(nSamples = 25000, nResampling = 100, output = file)
resamplingfile <- resamplingFile(file)

# perform resampled association tests
gdb <- create_example_gdb()
assoc <- assocTest(
  gdb,
  VAR_id = 1:10,
  cohort = "pheno",
  pheno = "pheno",
  covar = paste0("PC", 1:4),
  test = c("skat"),
  resamplingFile = resamplingfile,
  verbose = FALSE
)