extract_window: Extract and format a window of SNPs to be tested in a SKAT...

View source: R/extract_window.R

extract_windowR Documentation

Extract and format a window of SNPs to be tested in a SKAT kernel

Description

Extract and format a window of SNPs to be tested in a SKAT kernel

Usage

extract_window(
  this_position,
  window_size,
  genodata,
  Chr,
  impute_to_mean = TRUE,
  remove_novar_SNPs = TRUE,
  missing_cutoff = 0.15
)

Arguments

this_position

An integer, indicating the center of a SNP window for which the user wishes to extract SNPs (in base pairs)

window_size

An integer, indicating the size of each SNP window (in base pairs)

genodata

A matrix obtained by reading data from '.traw' format (see (see https://www.cog-genomics.org/plink2/formatsPLINK documentation)) into R

Chr

Integer indicating the chromosome SNPs are being extracted from

impute_to_mean

If 'TRUE', NA values for each SNP are replaced with the mean alternative allele count for the given SNP

remove_novar_SNPs

If 'TRUE', SNPs with no variation will be removed

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

Value

A list containing three objects: an integer of chromosome of origin, an integer of SNP window center position, and a matrix of alternative allele counts for each genotype and SNP within the given window

Examples

small_genodata_path <- system.file("extdata",
                                   "poplar_200genotypes_14490to14520kb.traw",
                                   package = "mtmcskat")
small_genodata <- data.table::fread(small_genodata_path)

extract_window(this_position = 145e5,
  window_size = 3000,
  genodata = small_genodata,
  Chr = 10)


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