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:
1 parent
c1de527d75
commit
4d9efab2fc
9 files changed
+289
-14
No files matched your search
@@ -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
|
||||
@@ -57,7 +57,9 @@ def _ugt2b17(t: str) -> int: # *2 = whole-gene deletion
|
||||
|
||||
|
||||
CN_TRUTH = {"GSTM1": _gstm1, "GSTT1": _gstt1, "UGT2B17": _ugt2b17} # capped: GSTM1 at 1, the others at 2
|
||||
LEGACY_NOMENCLATURE = {"UGT1A1", "SLCO1B1"} # GeT-RM uses pre-2023 names (*60, SLCO1B1 *1B/*17/*21) not in CPIC
|
||||
# GeT-RM uses older names or definitions than the current CPIC/PharmVar ones: UGT1A1 *60 and SLCO1B1 *1B/*17/*21
|
||||
# (pre-2023), CYP1A2 lettered alleles (*1F …), CYP2C8 *19 (PharmVar now defines rs2071426 alone as *19; GeT-RM *1)
|
||||
LEGACY_NOMENCLATURE = {"UGT1A1", "SLCO1B1", "CYP1A2", "CYP2C8"}
|
||||
|
||||
|
||||
def truth_alternatives(text: str) -> list[list[set[str]]]:
|
||||
|
||||
Reference in new issue
Block a user