umxGSEM_sumstats: Prepare multivariate SNP summary statistics for genomic SEM...

View source: R/umxGSEM.R

umxGSEM_sumstatsR Documentation

Prepare multivariate SNP summary statistics for genomic SEM GWAS

Description

Aligns per-trait GWAS summary statistic files to a 1000 Genomes reference (allele match + MAF filter), converts odds ratios to the log scale when needed, and applies the continuous-scale transformation used in Genomic SEM so that effects and standard errors are on a unit-variance phenotype scale. The result is ready for umxGSEM_GWAS().

The returned data.frame has columns SNP, CHR, BP, MAF, A1, A2, and ⁠beta.*⁠ / ⁠se.*⁠ per trait (listwise-complete SNPs present in the reference and in every trait file).

Usage

umxGSEM_sumstats(
  files,
  ref,
  trait.names = NULL,
  se.logit = TRUE,
  OLS = FALSE,
  linprob = FALSE,
  N = NULL,
  info.filter = 0.6,
  maf.filter = 0.01,
  baseDir = getwd()
)

Arguments

files

Character vector of GWAS summary statistic file names or paths (same trait order as LDSC). Relative names are resolved under baseDir (default: working directory).

ref

Path or file name of 1000G reference with columns SNP, CHR, BP, MAF, A1, A2 (resolved under baseDir when relative).

trait.names

Character vector of trait names for output columns (defaults to file basenames).

se.logit

Logical (or vector, one per trait). If TRUE (default), treat effects/SEs as logistic-scale log(OR) and apply the Genomic SEM continuous-scale transform.

OLS

Logical (or vector). If TRUE, treat the trait as continuous OLS and standardize with Z and total N (see Details).

linprob

Logical (or vector). If TRUE, recover continuous-scale effects from Z and effective N for binary traits (see Details).

N

Optional numeric sample sizes (total N for OLS; sum of effective N for linprob). Recycled to length(files).

info.filter

Numeric INFO threshold (default 0.6); applied when INFO is present.

maf.filter

Numeric MAF threshold applied to the reference (default 0.01).

baseDir

Directory for relative files and ref (default getwd()). Absolute paths are left unchanged.

Details

Example input (SCZ subset)

Workshop-style GWAS files are whitespace-separated. A few lines of the package toy file SCZ_subset.txt look like:

SNP Freq.A1 CHR BP A1 A2 OR SE P
rs1000000 0.7763 12 126890980 G A 1.0195 0.011559 0.0954
rs10000010 0.5099 4 21618674 T C 0.9910 0.009582 0.3452
rs1000002 0.5199 3 183635768 C T 1.0048 0.009435 0.6113

Column synonyms are resolved automatically (SNP/rsid, OR/beta/effect, SE/stderr, INFO, N, allele columns, etc.). When the median effect is near 1, values are treated as odds ratios and logged.

Example output

After aligning SCZ, BIP, and MDD to a 1000G reference with se.logit = TRUE (toy subsets under ⁠inst/developer/GenomicSEM/⁠), the first rows resemble:

SNP CHR BP MAF A1 A2 beta.SCZ se.SCZ beta.BIP se.BIP beta.MDD se.MDD
rs1000073 1 157255396 0.417 A G -0.00053 0.00543 0.00696 0.0133 -0.00105 0.00447
rs1000050 1 162736463 0.147 C T 0.00614 0.00742 -0.0150 0.0182 -0.00033 0.00700
rs1000053 2 12790328 0.090 C T 0.00149 0.00915 -0.0187 0.0240 -0.00226 0.00744

Reference alleles and MAF come from ref; betas are flipped so that A1 matches the reference. SNPs that fail allele match, INFO, or listwise merge are dropped.

Scale flags (se.logit, OLS, linprob)

Pass a single logical or a vector recycled to length(files). For each trait, choose the treatment that matches how that GWAS was run:

Flag Typical traits What it does
se.logit = TRUE Case/control logistic GWAS (default) Treat effect/SE as log(OR) and SE on the logistic scale; transform both to the continuous scale used by Genomic SEM: divide by sqrt(beta^2 * Var(SNP) + pi^2/3), with Var(SNP) = 2p(1-p).
linprob = TRUE Binary traits lacking usable logistic SEs Reconstruct Z from effect/SE when present, then back out continuous-scale beta and SE using effective sample size N (sum of effective Ns) and the same logistic-to-continuous adjustment.
OLS = TRUE Continuous phenotypes Standardize using Z and total sample size N with SNP variance 2p(1-p).
se.logit = FALSE (and not OLS/linprob) Non-standard OR-scale SEs Alternate SE scaling for odds-ratio reported SEs; prefer se.logit = TRUE for ordinary logistic GWAS.

Other parameters

  • files: Paths (or basenames under baseDir) to one GWAS file per trait, in the same trait order you will use for LDSC / umxGSEM_GWAS().

  • ref: 1000 Genomes (or equivalent) reference table with columns SNP, CHR, BP, MAF, A1, A2. Used for allele alignment, MAF filter, and SNP annotation in the return value.

  • trait.names: Labels for ⁠beta.*⁠ / ⁠se.*⁠ columns (default: file basenames without extension). Must match LDSC trait names when you expand into GWAS.

  • N: Optional sample sizes, one per trait (or recycled). Required for meaningful OLS / linprob transforms (total N for OLS; effective N sum for linprob).

  • info.filter: Drop SNPs with INFO below this value when an INFO column is present (default 0.6). Missing INFO is kept.

  • maf.filter: Drop reference SNPs with MAF below this threshold (default 0.01). MAF is folded so it is at most 0.5.

  • baseDir: Directory prepended to relative files and ref paths. Absolute paths are left unchanged.

Processing is listwise: a SNP must appear in the reference and in every trait file after QC. Expect a message like ⁠umxGSEM_sumstats: N SNPs after listwise merge with reference.⁠

Value

A data.frame with columns SNP, CHR, BP, MAF, A1, A2, and ⁠beta.<trait>⁠ / ⁠se.<trait>⁠ for each trait in trait.names, sorted by CHR/BP.

References

Grotzinger, A. D., Rhemtulla, M., de Vlaming, R., Ritchie, S. J., Mallard, T. T., Hill, W. D., Ip, H. F., Marioni, R. E., McIntosh, A. M., Deary, I. J., Koellinger, P. D., Harden, K. P., Nivard, M. G., & Tucker-Drob, E. M. (2019). Genomic structural equation modelling provides insights into the multivariate genetic architecture of complex traits. Nature Human Behaviour, 3, 513-525. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1038/s41562-019-0566-x")}

Tutorial materials and sumstats conventions follow the Genomic SEM documentation and workshops (see https://github.com/GenomicSEM/GenomicSEM).

See Also

umxGSEM_GWAS(), umxGSEM()

Other GSEM: Anthro_LDSC, Psych_LDSC, plot.umx_GWAS(), umxGSEM(), umxGSEM_GWAS(), umxGSEM_dl_tutorial_files(), umxGSEM_label_ldsc(), umxGSEM_ldsc(), umxGSEM_munge(), umxGSEM_std(), umxSummary.MxDataStatic(), umxSummary.list()

Examples

## Not run: 
# basenames only (files live in baseDir)
snps = umxGSEM_sumstats(
  files = c("SCZ_subset.txt", "BIP_subset.txt", "MDD_subset.txt"),
  ref = "reference.1000G.subset.txt",
  trait.names = c("SCZ", "BIP", "MDD"),
  se.logit = TRUE,
  baseDir = "path/to/umx/inst/developer/GenomicSEM"
)
head(snps)
# columns: SNP, CHR, BP, MAF, A1, A2, beta.SCZ, se.SCZ, beta.BIP, ...

## End(Not run)

umx documentation built on Oct. 11, 2026, 5:07 p.m.