This example uses gbase, glma, gmap and gbayes, with the familiar qgg preparation and MCMC arguments. The simulated panel contains 5,000 people and 50,000 markers. The phenotype is shared with the linear and mixed-model example.

Prepare the data

library(gbase)
library(glma)
library(gmap)
library(gbayes)

setwd("C:/Users/Projects/Examples")
url <- "https://github.com/psoerensen/qgdata/raw/main/simulated_human_data/"
base <- "https://psoerensen.github.io/gact/Document/glma-simulated-data/"
download.file(paste0(url, "human.bed"), "human.bed", mode="wb")
download.file(paste0(base, "human.bim"), "human.bim")
download.file(paste0(url, "human.fam"), "human.fam")

Glist <- gprep(study="Simulation", bedfiles="human.bed",
  bimfiles="human.bim", famfiles="human.fam")
rsids <- gfilter(Glist=Glist, excludeMAF=0.05, excludeMISS=0.05,
  excludeCGAT=TRUE, excludeINDEL=TRUE, excludeDUPS=TRUE,
  excludeHWE=1e-12, excludeMHC=FALSE)
Glist <- gprep(study="Simulation", bedfiles="human.bed", rsids=rsids)
Glist$assembly <- "simulated-human-tutorial"

phenotypes <- read.csv(paste0(base, "example-phenotypes.csv"),
  colClasses=c("character", "numeric"))
y <- setNames(phenotypes$phenotype, phenotypes$id)
causal <- readLines(paste0(base, "causal-markers.txt"))
sets <- createMarkerSets(Glist=Glist, rsids=causal, upstream=1000, downstream=1000)

scan <- glma(y=y, Glist=Glist, method="linear")
stat <- checkStat(Glist=Glist, stat=scan$associations)

The supplied BIM corrects 13 invalid genetic-map entries without changing the genotypes, physical positions or alleles. upstream and downstream count markers within each chromosome.

Fit the regions

fit <- gmap(Glist=Glist, stat=stat, sets=sets, method="bayesC",
  nit=1000, nburn=100, nrun=2)
head(fit$post)
head(fit$conv)
head(fit$stat)
fit$cs

The default dense route computes full regional LD directly from BED. Posterior tables include hyperparameters, effects and PIPs; convergence tables contain native R-hat, ESS and status diagnostics. Inspect these before interpreting posterior results. Credible-set grouping uses marginal PIPs.

Fit genome-wide marker effects

Glist <- gprep(Glist, task="sparseld", msize=1000, ldfiles="human.ld", nthreads=4)
fit <- gbayes(Glist=Glist, stat=stat, method="bayesC", nit=100, nburn=0, nrun=2,
  control=list(threads=1, max_ld_entries=1e8))
head(fit$stat)

Genome-wide fitting reuses sparse LD. An eigen route is also available for verified independent LD blocks; regional eigen fitting can be selected with gmap(..., algorithm="mcmc-eigen", eigen_threshold=0.99) after sparse-LD preparation. These routes have different likelihood and variance conventions; the common argument names do not imply identical qgg posterior draws.

See recorded tutorial timings.

The assembly label identifies this synthetic tutorial panel; it is not a claim of a specific human reference assembly. The explicit LD-entry budget supports the previously prepared sparse descriptor. The benchmark overview distinguishes earlier one-chain repeats from current two-chain checks and records any failed preparation guards. Successful execution does not establish convergence.