Applies a single QC pass to a QtlSumStats or GwasSumStats
collection: per-row sanity checks via .applySanityChecks (drop
rows with out-of-range / zero P, BETA == 0, SE <= 0, NA in vital
columns; clamp tiny P; normalize CHR; coerce signed columns to
numeric), variant-content filters (MAF / INFO / N) via
.applyContentFilters, optional skipRegion drop, optional
PIP screen, panel-vs-sumstats allele harmonization against the
ldSketch via harmonizeAlleles (which handles indels,
strand-ambiguous variants, sign / strand flips, and duplicate drops in
a single sweep), optional SLALOM/DENTIST LD-mismatch QC, and optional
RAISS imputation. No Bioconductor genome / dbSNP packages required.
Usage
summaryStatsQc(
sumstats,
removeIndels = FALSE,
removeStrandAmbiguous = TRUE,
mafCutoff = 0,
infoCutoff = 0,
nCutoff = 5,
keepVariants = NULL,
skipRegion = NULL,
pipCutoffToSkip = 0,
zMismatchQc = c("none", "slalom", "dentist"),
alleleFlipKriging = FALSE,
effectiveN = TRUE,
impute = FALSE,
imputeOpts = list(rcond = 0.01, r2Threshold = 0.6, minimumLd = 5, lamb = 0.01),
matchMinProp = 0,
coerceNumeric = TRUE,
normalizeChr = TRUE,
dropNonstandardChr = TRUE,
dropMissData = TRUE,
dropPOutOfRange = TRUE,
clampSmallP = TRUE,
smallPFloor = 4.94065645841247e-324,
dropZeroEffect = TRUE,
dropNonpositiveSe = TRUE
)Arguments
- sumstats
A
QtlSumStatsorGwasSumStatscollection.- removeIndels
Logical (length 1). When
TRUE, drop indels during panel harmonization. DefaultFALSE.- removeStrandAmbiguous
Logical (length 1). When
TRUE, drop A/T and C/G strand-ambiguous variants. DefaultTRUE.- mafCutoff
Numeric (length 1). MAF threshold (variants with
MAF < mafCutoffare dropped). Default 0. RequiresMAForFRQcolumn when non-zero.- infoCutoff
Numeric (length 1). INFO score threshold. Default 0. Requires
INFOcolumn when non-zero.- nCutoff
Numeric (length 1). Sample-size deviation threshold: drop variants whose
Nis more thannCutoffmedian-absolute-deviations from the median. Set to 0 to disable. Default 5.- keepVariants
Optional character vector of variant IDs (SNP column) to retain prior to harmonization.
- skipRegion
Optional character vector of
"chr:start-end"strings, or aGRanges, of regions to drop.- pipCutoffToSkip
Numeric (length 1). When
!= 0, run an LD-independent single-effect SER screen and skip the entry if no PIP exceeds the cutoff.< 0resolves to3 / nVariants. Default 0 (no screen).- zMismatchQc
One of
"none"(default),"slalom","dentist".- alleleFlipKriging
Logical (length 1). Opt-in kriging LD-consistency prefilter run before SLALOM/DENTIST. Default
FALSE.- effectiveN
Logical (length 1). When
TRUE(default) and the input carries case/control counts — per-variantN_CASE/N_CONTROLmcols, else the study-levelnCase/nControlscalars — the working per-variantNis set to the effective sample sizeeffectiveN(nCase, nControl)BEFORE the N-cutoff filter, so the filter, kriging, and the downstream fit all useN_eff. When both counts and anNcolumn are present the counts win:Nis overridden and the override is logged. Inputs with no counts (quantitative traits) are unchanged. The escape hatcheffectiveN = FALSErestores the rawNcolumn (or, when there is noN, the raw totalnCase + nControl) with no override.qcInfo$options$effectiveNrecords the setting and each entry'snSourceis one of"effective","column","total", orNA.- impute
Logical (length 1). Run RAISS imputation against the
ldSketch. DefaultFALSE. (Note: RAISS against the sketch is not yet fully wired for the new path; the option is accepted but currently emits a warning and is skipped.)- imputeOpts
Named list of RAISS parameters.
- matchMinProp
Minimum proportion of LD panel variants that must be matched by the sumstats; default 0.
- coerceNumeric
Logical. Coerce signed columns (Z/BETA/SE/OR/LOG_ODDS/SIGNED_SUMSTAT/P/MAF/FRQ/INFO/N) to numeric. Default
TRUE.- normalizeChr
Logical. Strip
"chr"prefix, uppercase the chromosome label, and map 23->X, 24->Y, M->MT. DefaultTRUE.- dropNonstandardChr
Logical. Drop variants whose CHR (after normalization) is outside 1..22, X, Y, MT. Default
TRUE.- dropMissData
Logical. Drop rows with NA in any vital column (chrom, pos, A1, A2, and at least one of Z / BETA). Default
TRUE.- dropPOutOfRange
Logical. Drop rows where
P < 0orP > 1. DefaultTRUE.- clampSmallP
Logical. Floor non-negative P values below
smallPFloortosmallPFloorso-log10(P)stays finite. Applied to both input and Z-derived P values. DefaultTRUE.- smallPFloor
Numeric (length 1). Floor for
clampSmallP. Default5e-324(R's smallest positive double).- dropZeroEffect
Logical. Drop rows where any effect column is exactly 0 (
BETA,LOG_ODDS,SIGNED_SUMSTAT) orORis exactly 1. DefaultTRUE.- dropNonpositiveSe
Logical. Drop rows where
SE <= 0. DefaultTRUE.
Details
The returned collection has its qcInfo slot populated with a
per-entry audit record (variant counts, drop counts at each step,
which filters fired, etc.). Fine-mapping and TWAS-weights pipelines
reject SumStats inputs where length(getQcInfo(x)) == 0L.
Column-availability error contract: a non-zero mafCutoff
requires every entry to carry a MAF column; non-zero
infoCutoff requires INFO; non-zero nCutoff
requires N. Missing column with a non-zero cutoff is a hard
error.