#!/bin/sh
set -eu
export MPLBACKEND=Agg
export MPLCONFIGDIR="$AUTOPKGTEST_TMP/matplotlib"
export XDG_CACHE_HOME="$AUTOPKGTEST_TMP/cache"
cd "$AUTOPKGTEST_TMP"
oncoref version
oncoref cancer-type prostate > prostate.json
oncoref tmb FL > tmb.txt
oncoref plot apd1-vs-tmb --out apd1_vs_tmb.png
python3 - <<'END'
import json
from pathlib import Path

import adjustText
import matplotlib_venn
import oncoref

assert json.loads(Path("tmb.txt").read_text()) == 5.05
assert "PRAD" in Path("prostate.json").read_text()
assert oncoref.canonical_gene_id("TP53") == "ENSG00000141510"
assert not oncoref.driver_gene_evidence_df().empty
assert Path("apd1_vs_tmb.png").read_bytes().startswith(b"\x89PNG\r\n\x1a\n")
END
