Skip to contents

DENTIST (Detecting Errors iN analyses of summary staTISTics) is a quality control tool for GWAS summary data. It uses linkage disequilibrium (LD) information from a reference panel to identify and correct problematic variants by comparing observed GWAS statistics to predicted values. It can detect errors in genotyping/imputation, allelic errors, and heterogeneity between GWAS and LD reference samples.

Usage

dentist(
  sumStat,
  R = NULL,
  X = NULL,
  nSample = NULL,
  windowSize = 2e+06,
  windowMode = c("distance", "count"),
  pValueThreshold = 5.0369e-08,
  propSVD = 0.4,
  gcControl = FALSE,
  nIter = 10,
  gPvalueThreshold = 0.05,
  duprThreshold = 0.99,
  ncpus = 1,
  correctChenEtAlBug = TRUE,
  minDim = 2000,
  ldMethod = "sample"
)

Arguments

sumStat

A data frame containing summary statistics, including 'pos' or 'position' and 'z' or 'zscore' columns.

R

Square LD correlation matrix. Provide either R or X.

X

Genotype matrix (samples x SNPs). If provided, LD is computed via computeLd(X) and nSample defaults to nrow(X).

nSample

The number of samples in the LD reference panel (NOT the GWAS sample size). This controls the SVD truncation rank K = min(idx_size, nSample) * propSVD. Required when R is provided; inferred from X when X is provided.

windowSize

The size of the window for dividing the genomic region in distance mode (base pairs). Default is 2000000 (2 Mb). Only used when windowMode = "distance".

windowMode

Character string specifying the windowing strategy: "distance" (default) creates windows by physical distance using segmentByDist (C++ --wind-dist), and "count" creates windows by variant count using segmentByCount (C++ --wind).

pValueThreshold

The p-value threshold for significance. Default is 5e-8.

propSVD

The proportion of singular value decomposition (SVD) to use. Default is 0.4.

gcControl

Logical indicating whether genomic control should be applied. Default is FALSE.

nIter

The number of iterations for the Dentist algorithm. Default is 10.

gPvalueThreshold

The genomic p-value threshold for significance. Default is 0.05.

duprThreshold

The absolute correlation r value threshold to be considered duplicate. Default is 0.99.

ncpus

The number of CPU cores to use for parallel processing. Default is 1.

correctChenEtAlBug

Logical indicating whether to correct the Chen et al. bug. Default is TRUE.

minDim

In distance mode: minimum number of SNPs per block (default 2000). In count mode: the number of variants per window (i.e., the window size).

ldMethod

Character string specifying the LD computation method when X is provided. Passed to computeLd. One of "sample" (default), "population", or "gcta". Ignored when R is provided directly.

Value

A data frame containing the imputed result and detected outliers.

The returned data frame includes the following columns:

original_z

The original z-score values from the input sumStat.

imputed_z

The imputed z-score values computed by the Dentist algorithm.

rsq

The coefficient of determination (R-squared) between original and imputed z-scores.

iter_to_correct

The number of iterations required to correct the z-scores, if applicable.

index_within_window

The index of the observation within the window.

index_global

The global index of the observation.

outlier_stat

The computed statistical value based on the original and imputed z-scores and R-squared.

outlier

A logical indicator specifying whether the observation is identified as an outlier based on the statistical test.

Details

Windowing supports two modes matching the original DENTIST C++ binary:

  • "distance" (default): Uses the segmentingByDist algorithm (C++ --wind-dist), implemented in segmentByDist. Windows span a fixed physical distance (windowSize bp).

  • "count": Uses the segmentedQCed algorithm (C++ --wind), implemented in segmentByCount. Windows contain a fixed number of variants (minDim). Useful when regions have sparse variants where distance-based windows would create windows with too few variants.

The correctChenEtAlBug parameter affects the iterative filtering in two ways:

  1. Comparison between iteration index t and nIter (explained in source code)

  2. The !grouping_tmp operator bug (explained in source code)

Examples

# Example usage of dentist
dentist(sumStat, R = ldMat, nSample = nSample)
#> Error: object 'ldMat' not found