mappable_SKAT: Obtain SKAT results, including permuted or empirical...

View source: R/mappable_SKAT.R

mappable_SKATR Documentation

Obtain SKAT results, including permuted or empirical p-values, for a SNP window or chunk of SNP windows

Description

Obtain SKAT results, including permuted or empirical p-values, for a SNP window or chunk of SNP windows

Usage

mappable_SKAT(
  pos_and_SNPs,
  scaffold_ID,
  null_model,
  n_permutations,
  resampling = FALSE,
  return_all_p_vals = FALSE,
  chunk = TRUE,
  missing_cutoff = 0.15,
  ...
)

Arguments

pos_and_SNPs

A list containing SNP data divided into windows, along with metadata (scaffold and SNP window center position) produced by pre_allocate, and if passing chunks of windows rather than individual windows to each worker, broken into chunks using chunk_windows.

scaffold_ID

Integer indicating the chromosome or scaffold of interest

null_model

Object generated by SKAT_Null_Model

n_permutations

Integer indicating the number of permutations used to calculate empirical p-values

resampling

If TRUE, will call calculate_SKAT_empirical_p to calculate an empirical p-value or obtain a vector of permuted p-values. If FALSE, will pass NA in place of an empirical p-value

return_all_p_vals

If 'TRUE', will return a vector of all permuted p-values (useful for when not all permutations can fit into memory available for a single thread); if 'FALSE', will calculate and return the empirical p-value

chunk

Should be TRUE if the list passed by 'pos_and_SNPs' argument has been processed into chunks by 'chunk_windows()', as is done in a standard mtskat workflow

missing_cutoff

A numeric threshold representing the minimum desired missing rate; missing rate is defined for each SNP as the proportion of genotypes missing data for the given SNP. Imputation to mean is performed , either by 'pre_allocate' or 'SKAT' itself, for all remaining missing values

...

Additional parameters passed on to SKAT

Value

A dataframe to be appended to results. If chunking (see above), this will contain multiple rows, one for each SNP window. Otherwise, it will contain a single row for one SNP window. Each row will contain a vector produced by SKAT_one_window (see documentation for that function for further details).

Examples

data("small_pre_allocated_windows_processed")

sample_null_model <- SKAT::SKAT_Null_Model(
  small_phenodata ~ 1 + as.matrix(small_covariates), out_type="C",
  n.Resampling = 1000)

mappable_SKAT(
  pos_and_SNPs = small_pre_allocated_windows[[1]],
  scaffold_ID = small_pre_allocated_windows[[1]][[3]],
  null_model = sample_null_model,
  resampling = TRUE,
  n_permutations = 1000,
  chunk = FALSE)



naglemi/mtmcskat documentation built on Aug. 23, 2023, 5:35 p.m.