This example uses gact summaries and a matching EUR reference
prepared with gbase. gmap retains the familiar sets,
method, nit and nburn
arguments.
library(gact)
library(gbase)
library(gmap)
library(gscore)
GAlist <- readRDS("C:/Users/gact/hsa.0.0.1/GAlist_hsa.0.0.1.rds")
Glist <- readRDS(file.path(GAlist$dirs["marker"], "Glist_1000G_eur_filtered.rds"))
stat <- getMarkerStat(GAlist=GAlist, studyID="GWAS1")
stat <- checkStat(Glist=Glist, stat=stat, excludeMAF=0.05,
excludeMAFDIFF=0.05, excludeINFO=0.8, excludeCGAT=TRUE,
excludeINDEL=TRUE, excludeDUPS=TRUE, excludeMHC=FALSE,
excludeMISS=0.05, excludeHWE=1e-12)
# Prepare the same marker selection used in the summary statistics.
Glist <- gprep(study=Glist$study, bedfiles=Glist$bedfiles,
bimfiles=Glist$bimfiles, famfiles=Glist$famfiles, rsids=stat$rsids)
sets <- getMarkerSets(GAlist=GAlist, feature="Genesplus")
genes <- c("ENSG00000099204", "ENSG00000118972", "ENSG00000145996", "ENSG00000140718")
fit <- gmap(Glist=Glist, stat=stat, sets=sets[genes], method="bayesR",
nit=1000, nburn=100, nrun=2, updateE=FALSE)
head(fit$post)
head(fit$conv)
head(fit$stat)
fit$cs
The dense route reads regional LD on demand. For GWAS summaries from
a different sample than the reference panel, residual variance learning
is disabled with updateE=FALSE.
Glist <- gprep(Glist, task="sparseld", msize=1000,
ldfiles=file.path(GAlist$dirs["marker"], "t2d-finemapping.ld"), nthreads=4)
fit <- gmap(Glist=Glist, stat=stat, sets=sets[genes], method="bayesR",
algorithm="mcmc-eigen", eigen_threshold=0.99,
nit=1000, nburn=100, nrun=2, updateE=FALSE)
fit$cs
Use one eigen threshold per fit. A smaller retained mass changes the fitted likelihood; inspect its diagnostics along with the posterior and convergence tables.
ldscores <- getLDscores(Glist, chr="17")
sets <- createLDsets(ldscores=ldscores, msize=200, maxsize=2000, nsplit=200)
fit <- gmap(Glist=Glist, stat=stat, sets=sets, method="bayesC",
nit=1000, nburn=100, nrun=2, updateE=FALSE)
pgs <- gscore(Glist=Glist, stat=fit$stat)
head(pgs$scores)
createLDsets() supplies candidate regions at low rolling
LD scores. It does not certify independence for genome-wide block-eigen
models. Scoring applies the posterior effects to the reference
individuals; it does not validate risk prediction in an independent
cohort.