Skip to contents

Follows the sample-QC stages of Marees et al. (2018): individuals are flagged when their genotype call rate is below callrate_min (Marees step 1, missingness above 0.02) and when their heterozygosity rate deviates more than het_sd standard deviations from the sample mean (Marees step 5).

Usage

Smplqc(G, callrate_min = 0.98, het_sd = 3, small_sample = FALSE)

Arguments

G

Genotype matrix, individuals by variants, coded 0/1/2; any other value is treated as missing.

callrate_min

Call-rate flag threshold (default 0.98).

het_sd

Heterozygosity flag width in standard deviations.

small_sample

Apply the N/(N-1) multiplier to expected homozygosity.

Value

List with estimate (number of samples passing), callrate, het_rate, F, obs_hom, exp_hom, n_obs, flag_callrate, flag_het, pass_qc, het_mean, het_sd, freq, n, m, method.

Details

Per individual i over its non-missing variants: call rate \(n_i / m\); observed homozygote count \(O_i\); expected homozygote count under Hardy-Weinberg \(E_i = \sum_j (1 - 2 p_j (1 - p_j) c_j)\) with \(c_j = N_j/(N_j - 1)\) when small_sample is TRUE (Nei's unbiased form; PLINK restores it via its small-sample modifier); the method-of-moments inbreeding coefficient \(F_i = (O_i - E_i)/(n_i - E_i)\) (PLINK 1.9 het report); and the heterozygosity rate \((n_i - O_i)/n_i\) used by Marees et al.

References

Marees, A. T., de Kluiver, H., Stringer, S., et al. (2018). A tutorial on conducting genome-wide association studies. International Journal of Methods in Psychiatric Research 27(2), e1608, Table 1 steps 1 and 5. PLINK 1.9 basic statistics documentation, het and missing reports (cog-genomics.org/plink/1.9/basic_stats). Nei, M. (1978). Genetics 89(3), 583-590.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Smplqc(V)
#> $estimate
#> [1] 2
#> 
#> $callrate
#> [1] 1 1 0 0 0 0 0 0
#> 
#> $het_rate
#> [1]   1   0 NaN NaN NaN NaN NaN NaN
#> 
#> $F
#> [1] -1.666667  1.000000       NaN       NaN       NaN       NaN       NaN
#> [8]       NaN
#> 
#> $obs_hom
#> [1] 0 1 0 0 0 0 0 0
#> 
#> $exp_hom
#> [1] 0.625 0.625 0.000 0.000 0.000 0.000 0.000 0.000
#> 
#> $n_obs
#> [1] 1 1 0 0 0 0 0 0
#> 
#> $flag_callrate
#> [1] FALSE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
#> 
#> $flag_het
#> [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> 
#> $pass_qc
#> [1]  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE
#> 
#> $het_mean
#> [1] 0.5
#> 
#> $het_sd
#> [1] 0.7071068
#> 
#> $freq
#> [1] 0.75
#> 
#> $n
#> [1] 8
#> 
#> $m
#> [1] 1
#> 
#> $method
#> [1] "Sample QC (Marees 2018 steps 1+5; PLINK --het F)"
#>