A GWAS object is a container for vectors of GWAS data, a correlation matrix, and meta-data regarding quality control procedures applied at the point of object creation / data import.

GWAS(
  dat,
  map = "default",
  drop = FALSE,
  fill = FALSE,
  fill_rsid = FALSE,
  missing_rsid = "fill_CHR:BP",
  parallel_cores = parallel::detectCores(),
  dbsnp_dir = genepi.utils::which_dbsnp_directory(),
  filters = list(beta_invalid = "!is.infinite(beta) & abs(beta) < 20", eaf_invalid =
    "eaf > 0 & eaf < 1", p_invalid = "!is.infinite(p)", se_invalid = "!is.infinite(se)",
    alleles_invalid = "!is.na(ea) & !is.na(oa)", chr_missing = "!is.na(chr)", bp_missing
    = "!is.na(bp)", beta_missing = "!is.na(beta)", se_missing = "!is.na(se)", p_missing =
    "!is.na(p)", eaf_missing = "!is.na(eaf)"),
  reference = NULL,
  ref_map = NULL,
  verbose = TRUE,
  ...
)

Arguments

dat

a valid string file path to be read by data.table::fread or a data.table::data.table object; the GWAS data source

map

a valid input to the ColumnMap class constructor (a predefined map string id, a named list or character vector, or a ColumMap object)

drop

a logical, whether to drop data source columns not in the column map

fill

a logical, whether to add (NAs) missing columns present in the column map but not present in the data source

fill_rsid

either FALSE or a valid argument for the chrpos_to_rsid build argument, e.g. "b37_dbsnp156"

missing_rsid

a string, how to handle missing rsids: one of "fill_CHR:BP", "fill_CHR:BP_OA_EA", "overwrite_CHR:BP", "overwrite_CHR:BP:OA:EA", "none", or "leave"

parallel_cores

an integer, number of cores to used for RSID mapping, default is maximum machine cores

dbsnp_dir

path to the dbsnp directory of fst files see chrpos_to_rsid dbsnp_dir argument

filters

a list of named strings, each to be evaluated as an expression to filter the data during the quality control steps (above)

reference

a valid string file path to be read by data.table::fread or a data.table::data.table object; the reference data

ref_map

a valid input to the ColumnMap class constructor (a predefined map id (a string), a named list or character vector, or a ColumMap object) defining at least columns rsid (or chr, bp), ea, oa and eaf.

verbose

a logical, whether to print details

...

variable capture to be passed to the constructor, e.g. individual vectors for the slots, rather that dat

Value

an S7 class genepi.utils::GWAS object

Slots

rsid

character, variant ID - usually in rs12345 format, however this can be changed with the missing_rsid argument

chr

character, chromosome identifier

bp

integer, base position

ea

character, effect allele

oa

character, other allele

eaf

numeric, effect allele frequency

beta

numeric, effect size

se

numeric, effect size standard error

p

numeric, p-value

n

integer, total number of samples

ncase

integer, number of cases

strand

character, the strand + or -

imputed

logical, whether imputed

info

numeric, the info score

q

numeric, the Q statistic for meta analysis results

q_p

numeric, the Q statistic P-value

i2

numeric, the I2 statistic

trait

character, the GWAS trait

id

character, the GWAS identifier

source

character, data source; either the file path, or "data.table" if loaded directly

correlation

matrix, a correlation matrix of signed R values between variants

map

ColumnMap, a mapping of class ColumnMap

qc

list, a named list of filters; name is the filter expression and value is an integer vector of rows that fail the filter