PGx: PharmVar genes (CYP1A2, CYP2A6, CYP2A13, CYP2C8, CYP3A4), CYP2A6 *4 from CN (PGX-001/006)

fetch_sources.sh downloads PharmVar per-gene zips; pgx db build adds core alleles for genes CPIC does not
define (normalised against the FASTA, *1 = reference). Masks re-derived with the new variants. GeT-RM:
CYP3A4 15/15, CYP2A6 7/9; all comparable genes 154/168 (CYP1A2/CYP2C8 definitions differ from GeT-RM's).
This commit is contained in:
kemal committed 2026-09-29 16:50:27 +01:00
1 parent b96ae21c70
commit 9a39ae62fe
9 files changed
+289 -14

No files matched your search

+32 -1
View File
@@ -2,7 +2,9 @@
# Download the public PGx sources for `simurg pgx db build` (spec PGX-001) into a dated folder.
# bash scripts/pgx/fetch_sources.sh [OUT_DIR] (default data/pgx/sources)
# CPIC (CC0): tables from the CPIC API (https://api.cpicpgx.org, PostgREST) as JSON; the newest change-log date is
# recorded as the data version. Never committed (data/ is ignored).
# recorded as the data version. PharmVar (https://www.pharmvar.org; cite Gaedigk et al. 2018 CPT 103:399): per-gene
# zips (haplotype VCFs, GRCh37/GRCh38) for the star-allele genes CPIC does not define. Never committed (data/ is
# ignored); the DB records each source's version and file hashes.
set -euo pipefail
OUT=${1:-data/pgx/sources}
DATE=$(date -u +%Y%m%d)
@@ -25,3 +27,32 @@ files = {p.name: hashlib.sha256(p.read_bytes()).hexdigest() for p in sorted(d.gl
"files": files}, indent=1))
print("CPIC data version", ver)
PY
# ---- PharmVar: star-allele genes without CPIC definitions
PV="$OUT/pharmvar-$DATE"
mkdir -p "$PV"
PV_GENES=${PV_GENES:-"CYP1A2 CYP2A6 CYP2A13 CYP2C8 CYP3A4"} # the PharmVar genes CPIC does not define (2026-09)
for g in $PV_GENES; do
if curl -sSf --retry 3 -o "$PV/$g.zip" \
"https://www.pharmvar.org/get-download-file?name=$g&refSeq=ALL&fileType=zip&version=current"; then
echo "PharmVar $g $(unzip -l "$PV/$g.zip" | awk 'NR==4{print $4}' | cut -d/ -f1)"
else
echo "PharmVar $g: not available"; rm -f "$PV/$g.zip"
fi
done
python3 - "$PV" <<'PY'
import hashlib, json, pathlib, re, sys, zipfile
d = pathlib.Path(sys.argv[1])
vers = set()
for z in sorted(d.glob("*.zip")):
top = zipfile.ZipFile(z).namelist()[0].split("/")[0]
m = re.search(r"-(\d+\.\d+\.\d+)$", top)
if m:
vers.add(m.group(1))
files = {p.name: hashlib.sha256(p.read_bytes()).hexdigest() for p in sorted(d.glob("*.zip"))}
(d / "source.json").write_text(json.dumps({"name": "PharmVar", "version": ",".join(sorted(vers)),
"retrieved": d.name.split("-")[1], "url": "https://www.pharmvar.org",
"license": "PharmVar terms of use (cite Gaedigk et al. 2018)",
"files": files}, indent=1))
print("PharmVar version", ",".join(sorted(vers)))
PY