| umxGSEM_GWAS | R Documentation |
Expands the LDSC genetic covariance structure with each SNP (using prepared
betas from umxGSEM_sumstats()), fits DWLS/WLS, and returns SNP-level results.
For a default common-factor model, estimates F1 ~ SNP.
umxGSEM_GWAS(
covstruc,
SNPs,
model = NULL,
estimation = c("DWLS", "WLS", "ULS"),
traits = NULL,
GC = c("standard", "conserv", "none"),
uncertainty = c("MLR", "SE"),
SnpSamplingError = 5e-04,
maxSNPs = NULL,
snpEffect = "SNP_to_F1",
quiet = TRUE,
fix_measurement = TRUE,
force_fallback = FALSE
)
covstruc |
LDSC list with |
SNPs |
Data frame from |
model |
Optional lavaan/umx string or mxModel. If |
estimation |
|
traits |
Trait names. Default: colnames of |
GC |
Genomic control for SNP sampling variances: |
uncertainty |
Whether to compute the robust sandwich SE ( |
SnpSamplingError |
SE used for SNP variance (treated as nearly fixed; default 5e-4). |
maxSNPs |
Optional limit for smoke tests. |
snpEffect |
Character; path label to extract from the model (default |
quiet |
Suppress per-SNP messages. |
fix_measurement |
Logical; if TRUE (default), fixes the non-SNP measurement model parameters to their base optimized values when evaluating each SNP (only applies if analytic engine is bypassed). |
force_fallback |
Logical; internal use for testing to force the non-vectorized analytic path (default |
The LDSC object is the usual GenomicSEM-style list (S, V, preferably I);
see e.g. Psych_LDSC for a packaged example and field definitions.
A data.frame of SNP results (SNP, CHR, BP, MAF, est, se, Z, P, status, ...).
umxGSEM_sumstats(), umxGSEM(), Psych_LDSC
Other GSEM:
Anthro_LDSC,
Psych_LDSC,
plot.umx_GWAS(),
umxGSEM(),
umxGSEM_dl_tutorial_files(),
umxGSEM_label_ldsc(),
umxGSEM_ldsc(),
umxGSEM_munge(),
umxGSEM_std(),
umxGSEM_sumstats(),
umxSummary.MxDataStatic(),
umxSummary.list()
## Not run:
1. load data
data(Psych_LDSC)
# Have a quick look if you like
# Psych_LDSC fields: S, V, I, N, m (see ?Psych_LDSC). V pairs are named var_SCZ, poly_BIP_SCZ, ...
umxSummary(Psych_LDSC)
#' # 2. build the snp data structure from your SNP data txt files, e.g.
dir = "~/bin/umx/inst/developer/GenomicSEM"
snps = umxGSEM_sumstats(
files = file.path(dir, c("SCZ_subset.txt", "BIP_subset.txt", "MDD_subset.txt")),
ref = file.path(dir, "reference.1000G.subset.txt"),
trait.names = c("SCZ", "BIP", "MDD"), se.logit = TRUE
)
# 3. Run the GWAS on your trait measurement model adding SNP effects into the latent structure
GWAS = umxGSEM_GWAS(covstruc = Psych_LDSC, SNPs = snps,
traits = c("SCZ", "BIP", "MDD"), maxSNPs = 20)
# 4. Examine results and make a new drug or something useful!
head(GWAS)
# Manhattan Plot (default)
plot(gwas_res)
plot(example_gwas, chromosomes= 1, label_top_n= 4, title="IQ GWAS") + theme_plos()
volcano_plot(example_gwas, size_by = "AF", label_top_n = 3)
# Q-Q Plot
plot(gwas_res, type = "qq")
# ================
# = Another demo =
# ================
# 1. Load the reference LDSC covariance structure
data(Psych_LDSC, package = "umx")
# 2. Generate a million simulated SNPs
traits = c("SCZ", "BIP", "MDD")
t0 = Sys.time()
snps = umxGSEM_sim_snps(n = 1e6, traits = traits)
print(Sys.time() - t0)
# 3. Run the GWAS and time it
t0 = Sys.time()
gwas_res = umxGSEM_GWAS(covstruc = Psych_LDSC, SNPs = snps, traits = traits)
print(Sys.time() - t0)
# 4. View the results
head(gwas_res)
# Manhattan Plot (default)
plot(gwas_res)
plot(example_gwas, chromosomes= 1, label_top_n= 4, title="IQ GWAS") + theme_plos()
volcano_plot(example_gwas, size_by = "AF", label_top_n = 3)
# Q-Q Plot
plot(gwas_res, type = "qq")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.