pgx
PGX — Lightweight Postgres for AI agents. Written in Rust. Thousands of isolated databases in one runtime. 🐘
Translation pending
Functions for building reproducible multi-cohort GWAS meta-analysis pipelines using the targets framework. Supports binary and quantitative traits with LDSC intercept correction, IVW meta-analysis, lo
DataRGitHub @mglev1nOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
No updates detected yet. GitHub releases will appear here.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
GWAS meta-analysis pipeline functions
Translation pending
Taken from the repository README
Loading the full README. The saved excerpt is shown below.
gwastargets provides a suite of functions for building reproducible multi-cohort GWAS meta-analysis pipelines using the targets framework. It supports both binary (case/control) and quantitative traits and handles the full workflow from raw summary statistics through meta-analysis and downstream quality-control.
The package is organized around two complementary use cases:
1. Generating a targets pipeline — given a cohort manifest and trait metadata, produce the complete _targets.R code for a reproducible analysis:Read the full README ↗gwastargets provides a suite of functions for building reproducible multi-cohort GWAS meta-analysis pipelines using the targets framework. It supports both binary (case/control) and quantitative traits and handles the full workflow from raw summary statistics through meta-analysis and downstream quality-control.
# install.packages("pak")
pak::pkg_install("mglev1n/gwastargets")
The package is organized around two complementary use cases:
1. Generating a targets pipeline — given a cohort manifest and trait metadata, produce the complete _targets.R code for a reproducible analysis:
library(gwastargets)
manifest <- data.frame(
path = c("/data/UKBB_EUR.txt.gz", "/data/MVP_AFR.txt.gz", "/data/BBJ_EAS.txt.gz"),
file = c("UKBB_EUR.txt.gz", "MVP_AFR.txt.gz", "BBJ_EAS.txt.gz"),
cohort = c("UKBB", "MVP", "BBJ"),
ancestry = c("EUR", "AFR", "EAS"),
study = c("UKBB_EUR", "MVP_AFR", "BBJ_EAS"),
stringsAsFactors = FALSE
)
code <- generate_gwas_meta_pipeline(
trait = "CAD",
trait_type = "binary",
n_col = "EffectiveN",
manifest_df = manifest
)
cat(code)
2. Using the pipeline functions directly — each stage is available as a standalone exported function for interactive use or integration into existing workflows:
| Function | Purpose |
|---|---|
prep_gwas() | Clean, harmonize, and LDSC-correct one cohort's summary statistics |
summarize_sumstats() | Per-cohort QC summary (N, MAF range, median SE, precision) |
meta_analyze_ivw() | Fixed-effects IVW meta-analysis across cohorts |
extract_loci() | Clump significant variants into independent loci with gene annotation |
extract_common_variants() | Identify variants present across all studies (for MR-MEGA) |
calculate_mr_mega_mds() | Compute MR-MEGA MDS coordinates from cross-cohort effect estimates |
snp_match_munge() | Match summary statistics to a reference panel and munge for LDSC |
harmonize_sumstats_headers() | Standardize column names across GWAS file formats |
Raw summary stats (per cohort)
│
▼
prep_gwas() ← clean, match HM3, LDSC intercept correction
│
├──── ldsc_h2() per-cohort heritability (via ldscr)
│
├──── summarize_sumstats() per-cohort QC table
│
├──── meta_analyze_ivw() per-ancestry IVW meta-analysis
│ └── extract_loci()
│
└──── meta_analyze_ivw() all-populations IVW meta-analysis
├── extract_loci()
└── extract_common_variants()
└── calculate_mr_mega_mds()
generate_gwas_meta_pipeline() validates the manifest before generating any code. The required columns are:
| Column | Description |
|---|---|
path | Full path to the raw summary statistics file |
file | Basename of the file (used to join back to per-cohort summaries) |
cohort | Human-readable cohort label (e.g. "UKBB") |
ancestry | Ancestry label matching ldscr reference panels (e.g. "EUR", "AFR", "EAS") |
study | Unique identifier used as the tar_map target name — no spaces or special characters |
Additional columns are preserved in the serialized output and can be used downstream.
ldscr — LDSC heritability and genetic correlation in RtidyGWAS — GWAS summary statistics cleaninggwasRtools — GWAS loci extraction and annotationtargets — reproducible pipeline toolkit