Download Biomanus-V2/Experiment1/scripts/fetch_second_batch_fixtures.py from czty/BioOcto: direct link, hf CLI and curl.
- Browser
- Download file 1.87 kB
-
https://huggingface.co/datasets/czty/BioOcto/resolve/main/Biomanus-V2/Experiment1/scripts/fetch_second_batch_fixtures.py
- Command line
-
hf download hf://datasets/czty/BioOcto/Biomanus-V2/Experiment1/scripts/fetch_second_batch_fixtures.py
-
curl -L -o fetch_second_batch_fixtures.py https://huggingface.co/datasets/czty/BioOcto/resolve/main/Biomanus-V2/Experiment1/scripts/fetch_second_batch_fixtures.py
1.87 kB
| #!/usr/bin/env python3 | |
| """Fetch versioned upstream fixtures used by second-batch native smoke tests.""" | |
| from __future__ import annotations | |
| import argparse | |
| import hashlib | |
| import json | |
| import urllib.request | |
| from pathlib import Path | |
| USHER_FIXTURES = { | |
| "global_phylo.nh": { | |
| "url": "https://raw.githubusercontent.com/yatisht/usher/master/test/global_phylo.nh", | |
| "sha256": "84797b29b897135ca01aab4297ada5cfa44f66d78eafcce4d707a7ecd20691fd", | |
| }, | |
| "global_samples.vcf": { | |
| "url": "https://raw.githubusercontent.com/yatisht/usher/master/test/global_samples.vcf", | |
| "sha256": "b83581907f313e2f08323c3c72835969a8f99a4ecf1307da55872409616991bb", | |
| }, | |
| "new_samples.vcf": { | |
| "url": "https://raw.githubusercontent.com/yatisht/usher/master/test/new_samples.vcf", | |
| "sha256": "0137f1695f3e42d8338be4bea25c1e7fd71428abd840c195b2902a995d763855", | |
| }, | |
| } | |
| def main() -> int: | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--out", type=Path, default=Path("data/fixtures/usher")) | |
| args = parser.parse_args() | |
| args.out.mkdir(parents=True, exist_ok=True) | |
| provenance = [] | |
| for name, source in USHER_FIXTURES.items(): | |
| target = args.out / name | |
| data = urllib.request.urlopen(source["url"], timeout=60).read() | |
| digest = hashlib.sha256(data).hexdigest() | |
| if digest != source["sha256"]: | |
| raise RuntimeError(f"checksum mismatch for {name}: {digest}") | |
| target.write_bytes(data) | |
| provenance.append({"name": name, **source, "size": len(data)}) | |
| print(f"verified {name} ({len(data)} bytes)") | |
| (args.out / "provenance.json").write_text( | |
| json.dumps({"source": "official UShER repository test data", "files": provenance}, indent=2) + "\n", | |
| encoding="utf-8", | |
| ) | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |