asebind 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. asebind/__init__.py +3 -0
  2. asebind/__main__.py +4 -0
  3. asebind/ase/__init__.py +1 -0
  4. asebind/ase/betabinom.py +173 -0
  5. asebind/benchmark/__init__.py +1 -0
  6. asebind/benchmark/asbdata.py +107 -0
  7. asebind/benchmark/clean.py +38 -0
  8. asebind/benchmark/features.py +71 -0
  9. asebind/benchmark/metrics.py +69 -0
  10. asebind/benchmark/models.py +151 -0
  11. asebind/benchmark/retest.py +183 -0
  12. asebind/benchmark/splits.py +61 -0
  13. asebind/cli.py +302 -0
  14. asebind/cli_model.py +539 -0
  15. asebind/config.py +340 -0
  16. asebind/data/asebind.example.yaml +56 -0
  17. asebind/finemap.py +86 -0
  18. asebind/haplotype.py +141 -0
  19. asebind/io/__init__.py +1 -0
  20. asebind/io/variants.py +107 -0
  21. asebind/model/__init__.py +1 -0
  22. asebind/model/adastra.py +113 -0
  23. asebind/model/classifier.py +122 -0
  24. asebind/model/context.py +60 -0
  25. asebind/model/features.py +201 -0
  26. asebind/model/other_motifs.py +168 -0
  27. asebind/model/train.py +331 -0
  28. asebind/motifs/__init__.py +1 -0
  29. asebind/motifs/escore.py +112 -0
  30. asebind/motifs/pwm.py +203 -0
  31. asebind/mpra.py +94 -0
  32. asebind/predict.py +163 -0
  33. asebind/resources/__init__.py +1 -0
  34. asebind/resources/ancestral.py +74 -0
  35. asebind/resources/conservation.py +77 -0
  36. asebind/resources/fetch.py +227 -0
  37. asebind/resources/genome.py +93 -0
  38. asebind/resources/registry.py +304 -0
  39. asebind/runrecord.py +108 -0
  40. asebind/tools.py +170 -0
  41. asebind-0.1.0.dist-info/METADATA +138 -0
  42. asebind-0.1.0.dist-info/RECORD +45 -0
  43. asebind-0.1.0.dist-info/WHEEL +4 -0
  44. asebind-0.1.0.dist-info/entry_points.txt +2 -0
  45. asebind-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,227 @@
1
+ """Download resources into ``<root>/<name>/`` and write a manifest (I-3).
2
+
3
+ Every file: URL, size, sha256 (and the provider's md5, which is checked when known), date, release, licence.
4
+ Downloaded archives are untrusted: zip members are checked against path traversal before extraction, and nothing
5
+ downloaded is ever imported or executed.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import datetime as _dt
11
+ import gzip
12
+ import hashlib
13
+ import json
14
+ import shutil
15
+ import tarfile
16
+ import urllib.request
17
+ import zipfile
18
+ from collections.abc import Callable
19
+ from pathlib import Path, PurePosixPath
20
+
21
+ from asebind import __version__
22
+ from asebind.resources.registry import RESOURCES, FileSpec, Resource
23
+
24
+ CHUNK = 1 << 20
25
+ MANIFEST = "manifest.json"
26
+
27
+
28
+ class FetchError(RuntimeError):
29
+ pass
30
+
31
+
32
+ def _filename(url: str) -> str:
33
+ parts = PurePosixPath(url.split("?")[0]).parts
34
+ return parts[-2] if parts[-1] == "content" else parts[-1] # Zenodo: .../files/<name>/content
35
+
36
+
37
+ def file_hashes(path: Path) -> tuple[str, str]:
38
+ md5, sha = hashlib.md5(), hashlib.sha256()
39
+ with open(path, "rb") as fh:
40
+ while block := fh.read(CHUNK):
41
+ md5.update(block)
42
+ sha.update(block)
43
+ return md5.hexdigest(), sha.hexdigest()
44
+
45
+
46
+ def _download(url: str, dest: Path, log: Callable[[str], None]) -> None:
47
+ tmp = dest.with_name(dest.name + ".part")
48
+ req = urllib.request.Request(url, headers={"User-Agent": f"asebind/{__version__}"})
49
+ with urllib.request.urlopen(req, timeout=120) as resp, open(tmp, "wb") as out:
50
+ total = int(resp.headers.get("Content-Length") or 0)
51
+ done, next_report = 0, 0.0
52
+ while block := resp.read(CHUNK):
53
+ out.write(block)
54
+ done += len(block)
55
+ if total and done / total >= next_report:
56
+ log(f" {dest.name}: {done / 1e6:,.0f} / {total / 1e6:,.0f} MB")
57
+ next_report += 0.25
58
+ tmp.replace(dest)
59
+
60
+
61
+ def safe_unzip(archive: Path, outdir: Path) -> list[str]:
62
+ outdir = outdir.resolve()
63
+ names = []
64
+ with zipfile.ZipFile(archive) as zf:
65
+ for m in zf.infolist():
66
+ target = (outdir / m.filename).resolve()
67
+ if outdir not in target.parents and target != outdir:
68
+ raise FetchError(f"{archive}: member {m.filename!r} would be written outside {outdir}")
69
+ if m.is_dir():
70
+ continue
71
+ names.append(m.filename)
72
+ zf.extractall(outdir, members=[m for m in zf.infolist() if not m.is_dir()])
73
+ return names
74
+
75
+
76
+ def safe_untar(archive: Path, outdir: Path) -> list[str]:
77
+ """Extract regular files only (no links or devices), each inside ``outdir``."""
78
+ outdir = outdir.resolve()
79
+ names = []
80
+ with tarfile.open(archive, "r:*") as tf:
81
+ members = []
82
+ for m in tf.getmembers():
83
+ if m.isdir():
84
+ continue
85
+ if not m.isfile():
86
+ raise FetchError(f"{archive}: member {m.name!r} is not a regular file")
87
+ target = (outdir / m.name).resolve()
88
+ if outdir not in target.parents:
89
+ raise FetchError(f"{archive}: member {m.name!r} would be written outside {outdir}")
90
+ members.append(m)
91
+ names.append(m.name)
92
+ for m in members:
93
+ target = outdir / m.name
94
+ target.parent.mkdir(parents=True, exist_ok=True)
95
+ src = tf.extractfile(m)
96
+ assert src is not None
97
+ with src, open(target, "wb") as fo:
98
+ shutil.copyfileobj(src, fo, CHUNK)
99
+ return names
100
+
101
+
102
+ def _gunzip(src: Path) -> Path:
103
+ dest = src.with_suffix("")
104
+ with gzip.open(src, "rb") as fi, open(dest.with_name(dest.name + ".part"), "wb") as fo:
105
+ shutil.copyfileobj(fi, fo, CHUNK)
106
+ dest.with_name(dest.name + ".part").replace(dest)
107
+ return dest
108
+
109
+
110
+ def _now() -> str:
111
+ return _dt.datetime.now(_dt.timezone.utc).isoformat(timespec="seconds")
112
+
113
+
114
+ def _write_manifest(rdir: Path, res: Resource, entries: list[dict], mode: str) -> Path:
115
+ man = {
116
+ "resource": res.name,
117
+ "description": res.description,
118
+ "release": res.release,
119
+ "licence": res.licence,
120
+ "mode": mode,
121
+ "asebind_version": __version__,
122
+ "written": _now(),
123
+ "files": entries,
124
+ }
125
+ p = rdir / MANIFEST
126
+ p.write_text(json.dumps(man, indent=2) + "\n", encoding="utf-8")
127
+ return p
128
+
129
+
130
+ def fetch(
131
+ name: str, root: Path, force: bool = False, log: Callable[[str], None] = print, keep_archive: bool = True
132
+ ) -> Path:
133
+ """Download one resource (skipping files whose recorded checksum still matches) and write its manifest."""
134
+ if name not in RESOURCES:
135
+ raise FetchError(f"unknown resource {name!r}; known: {', '.join(RESOURCES)}")
136
+ res = RESOURCES[name]
137
+ if not res.files:
138
+ raise FetchError(f"{name}: no direct download ({res.note}). Use --register PATH.")
139
+ rdir = root / name
140
+ rdir.mkdir(parents=True, exist_ok=True)
141
+ entries = []
142
+ for spec in res.files:
143
+ entries.append(_fetch_file(spec, rdir, force, log, keep_archive))
144
+ p = _write_manifest(rdir, res, entries, "download")
145
+ log(f"{name}: manifest {p}")
146
+ return rdir
147
+
148
+
149
+ def _fetch_file(spec: FileSpec, rdir: Path, force: bool, log: Callable[[str], None], keep: bool) -> dict:
150
+ dest = rdir / _filename(spec.url)
151
+ if force or not dest.exists():
152
+ log(f"downloading {spec.url}")
153
+ _download(spec.url, dest, log)
154
+ else:
155
+ log(f"{dest.name}: already present, checking")
156
+ md5, sha = file_hashes(dest)
157
+ if spec.md5 and md5 != spec.md5:
158
+ bad = dest.with_name(dest.name + ".bad_md5")
159
+ dest.replace(bad)
160
+ raise FetchError(f"{dest.name}: md5 {md5} != published {spec.md5} (kept as {bad.name})")
161
+ entry = {
162
+ "url": spec.url,
163
+ "file": dest.name,
164
+ "bytes": dest.stat().st_size,
165
+ "md5": md5,
166
+ "md5_published": spec.md5,
167
+ "sha256": sha,
168
+ "downloaded": _now(),
169
+ }
170
+ if spec.unpack == "gunzip":
171
+ out = dest.with_suffix("")
172
+ if force or not out.exists():
173
+ log(f" unpacking {dest.name}")
174
+ out = _gunzip(dest)
175
+ entry["unpacked"] = [out.name]
176
+ if out.suffix in (".fa", ".fasta"):
177
+ from asebind.resources.genome import build_fai
178
+
179
+ fai = build_fai(out)
180
+ entry["index"] = fai.name
181
+ if not keep:
182
+ dest.unlink()
183
+ elif spec.unpack == "unzip":
184
+ log(f" extracting {dest.name}")
185
+ entry["unpacked_count"] = len(safe_unzip(dest, rdir))
186
+ elif spec.unpack == "untar":
187
+ log(f" extracting {dest.name}")
188
+ names = safe_untar(dest, rdir)
189
+ entry["unpacked_count"] = len(names)
190
+ entry["unpacked_dirs"] = sorted({PurePosixPath(n).parts[0] for n in names if "/" in n})
191
+ return entry
192
+
193
+
194
+ def register(name: str, path: Path, root: Path, log: Callable[[str], None] = print) -> Path:
195
+ """Record a file that was obtained by hand (e.g. the CIS-BP E-score table) without copying it."""
196
+ if name not in RESOURCES:
197
+ raise FetchError(f"unknown resource {name!r}")
198
+ path = Path(path)
199
+ if not path.is_file():
200
+ raise FetchError(f"{path}: not a file")
201
+ rdir = root / name
202
+ rdir.mkdir(parents=True, exist_ok=True)
203
+ log(f"hashing {path}")
204
+ md5, sha = file_hashes(path)
205
+ entry = {"path": str(path), "bytes": path.stat().st_size, "md5": md5, "sha256": sha, "registered": _now()}
206
+ p = _write_manifest(rdir, RESOURCES[name], [entry], "registered")
207
+ log(f"{name}: manifest {p}")
208
+ return rdir
209
+
210
+
211
+ def manifest(name: str, root: Path) -> dict | None:
212
+ p = root / name / MANIFEST
213
+ return json.loads(p.read_text(encoding="utf-8")) if p.exists() else None
214
+
215
+
216
+ def resource_file(name: str, root: Path, pattern: str) -> Path:
217
+ """Path of a fetched (or registered) resource file matching ``pattern`` (a glob over the manifest's files)."""
218
+ man = manifest(name, root)
219
+ if man is None:
220
+ raise FetchError(f"{name}: not fetched under {root} (run `asebind fetch {name}`)")
221
+ for e in man["files"]:
222
+ cands = [e.get("path")] if "path" in e else [*e.get("unpacked", []), e["file"]]
223
+ for c in cands:
224
+ p = Path(c) if Path(c).is_absolute() else root / name / c
225
+ if p.match(pattern):
226
+ return p
227
+ raise FetchError(f"{name}: no file matching {pattern!r} in its manifest")
@@ -0,0 +1,93 @@
1
+ """Indexed FASTA access (samtools-compatible ``.fai``), written in Python so no external tool is needed."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+
7
+
8
+ def build_fai(fasta: Path, force: bool = False) -> Path:
9
+ """Write ``<fasta>.fai`` (name, length, offset, bases per line, bytes per line) unless it exists."""
10
+ fasta = Path(fasta)
11
+ fai = fasta.with_name(fasta.name + ".fai")
12
+ if fai.exists() and not force:
13
+ return fai
14
+ rows: list[tuple[str, int, int, int, int]] = []
15
+ name, length, offset, lb, lw = None, 0, 0, 0, 0
16
+ pos = 0
17
+ last_short = False
18
+ with open(fasta, "rb") as fh:
19
+ for line in fh:
20
+ n = len(line)
21
+ if line.startswith(b">"):
22
+ if name is not None:
23
+ rows.append((name, length, offset, lb, lw))
24
+ name = line[1:].split()[0].decode()
25
+ length, offset, lb, lw, last_short = 0, pos + n, 0, 0, False
26
+ else:
27
+ bases = len(line.rstrip(b"\r\n"))
28
+ if lb == 0:
29
+ lb, lw = bases, n
30
+ elif last_short and bases:
31
+ raise ValueError(f"{fasta}: uneven line lengths in {name}")
32
+ last_short = bases < lb
33
+ length += bases
34
+ pos += n
35
+ if name is not None:
36
+ rows.append((name, length, offset, lb, lw))
37
+ tmp = fai.with_name(fai.name + ".part")
38
+ tmp.write_text("".join(f"{r[0]}\t{r[1]}\t{r[2]}\t{r[3]}\t{r[4]}\n" for r in rows))
39
+ tmp.replace(fai)
40
+ return fai
41
+
42
+
43
+ class Fasta:
44
+ """Random access to an indexed FASTA. Coordinates are 0-based half-open; sequence returned upper-case."""
45
+
46
+ def __init__(self, path: str | Path) -> None:
47
+ self.path = Path(path)
48
+ self.index: dict[str, tuple[int, int, int, int]] = {}
49
+ for line in build_fai(self.path).read_text().splitlines():
50
+ name, length, offset, lb, lw = line.split("\t")
51
+ self.index[name] = (int(length), int(offset), int(lb), int(lw))
52
+ self._fh = open(self.path, "rb")
53
+
54
+ def close(self) -> None:
55
+ self._fh.close()
56
+
57
+ def __enter__(self) -> Fasta:
58
+ return self
59
+
60
+ def __exit__(self, *exc: object) -> None:
61
+ self.close()
62
+
63
+ def chrom_name(self, chrom: str) -> str:
64
+ """Accept ``1``/``chr1``/``MT``/``chrM`` whatever the FASTA uses."""
65
+ c = str(chrom)
66
+ if c in self.index:
67
+ return c
68
+ alt = c[3:] if c.startswith("chr") else "chr" + c
69
+ if alt in self.index:
70
+ return alt
71
+ for a, b in (("chrM", "MT"), ("MT", "chrM"), ("M", "chrM"), ("chrMT", "chrM")):
72
+ if c == a and b in self.index:
73
+ return b
74
+ raise KeyError(f"chromosome {chrom!r} not in {self.path.name}")
75
+
76
+ def length(self, chrom: str) -> int:
77
+ return self.index[self.chrom_name(chrom)][0]
78
+
79
+ def fetch(self, chrom: str, start: int, end: int, upper: bool = True) -> str:
80
+ length, offset, lb, lw = self.index[self.chrom_name(chrom)]
81
+ start, end = max(0, start), min(end, length)
82
+ if end <= start:
83
+ return ""
84
+ first = offset + (start // lb) * lw + start % lb
85
+ last = offset + ((end - 1) // lb) * lw + (end - 1) % lb
86
+ self._fh.seek(first)
87
+ raw = self._fh.read(last - first + 1)
88
+ s = raw.replace(b"\n", b"").replace(b"\r", b"").decode()
89
+ return s.upper() if upper else s
90
+
91
+ def base(self, chrom: str, pos1: int) -> str:
92
+ """Reference base at a 1-based position."""
93
+ return self.fetch(chrom, pos1 - 1, pos1)
@@ -0,0 +1,304 @@
1
+ """What ``asebind fetch`` can download. Each resource goes into ``<resources dir>/<name>/`` with a manifest.
2
+
3
+ Checksums: when the provider publishes one (UCSC md5sum.txt, Zenodo md5) it is checked; sha256 is always recorded.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ from dataclasses import dataclass, field
9
+
10
+
11
+ @dataclass(frozen=True)
12
+ class FileSpec:
13
+ url: str
14
+ md5: str | None = None
15
+ unpack: str | None = None # None | "gunzip" | "unzip" | "untar"
16
+
17
+
18
+ @dataclass(frozen=True)
19
+ class Resource:
20
+ name: str
21
+ description: str
22
+ release: str
23
+ licence: str
24
+ files: tuple[FileSpec, ...]
25
+ note: str = ""
26
+ tags: tuple[str, ...] = field(default_factory=tuple)
27
+
28
+
29
+ _UCSC = "https://hgdownload.soe.ucsc.edu/goldenPath"
30
+ _H12 = "https://hocomoco12.autosome.org/final_bundle/hocomoco12/H12CORE"
31
+ _ZEN = "https://zenodo.org/api/records/14174114/files"
32
+ _GEO = "https://ftp.ncbi.nlm.nih.gov/geo/series"
33
+ _REL = "https://github.com/AlsammanAlsamman/ASEbind/releases/download/v0.1.0"
34
+ _GEUV = "https://ftp.ebi.ac.uk/biostudies/fire/E-GEUV-/001/E-GEUV-1/Files/E-GEUV-1"
35
+
36
+ RESOURCES: dict[str, Resource] = {
37
+ r.name: r
38
+ for r in [
39
+ Resource(
40
+ "asebind_model",
41
+ "ASEbind trained binding model v2 (asebind+oth, 275 TFs, trained on ADASTRA Mabel v6.1)",
42
+ "v0.1.0",
43
+ "MIT (this repository); trained on ADASTRA, HOCOMOCO v12, JASPAR 2024 and CIS-BP data",
44
+ (
45
+ FileSpec(f"{_REL}/model.joblib", md5="aa7864b7cacb89108311ca6f99682ebb"),
46
+ FileSpec(f"{_REL}/model.json", md5="1f53941ead59edbabdb7d96fa5c1cdc1"),
47
+ ),
48
+ note="joblib files run code when loaded: the md5 is checked before use",
49
+ tags=("model",),
50
+ ),
51
+ Resource(
52
+ "hocomoco_v12",
53
+ "HOCOMOCO v12 CORE human PWMs (MEME format) and motif annotation",
54
+ "v12 H12CORE",
55
+ "CC-BY 4.0 (HOCOMOCO terms)",
56
+ (
57
+ FileSpec(f"{_H12}/formatted_motifs/H12CORE_meme_format.meme"),
58
+ FileSpec(f"{_H12}/H12CORE_annotation.jsonl"),
59
+ ),
60
+ tags=("motifs",),
61
+ ),
62
+ Resource(
63
+ "jaspar2024",
64
+ "JASPAR 2024 CORE vertebrates non-redundant PFMs (MEME format)",
65
+ "2024",
66
+ "CC-BY 4.0",
67
+ (
68
+ FileSpec(
69
+ "https://jaspar.elixir.no/download/data/2024/CORE/JASPAR2024_CORE_vertebrates_non-redundant_pfms_meme.txt"
70
+ ),
71
+ ),
72
+ tags=("motifs",),
73
+ ),
74
+ Resource(
75
+ "hg19",
76
+ "UCSC hg19 (GRCh37) genome FASTA, unpacked and indexed",
77
+ "hg19",
78
+ "public (UCSC)",
79
+ (
80
+ FileSpec(
81
+ f"{_UCSC}/hg19/bigZips/hg19.fa.gz",
82
+ md5="806c02398f5ac5da8ffd6da2d1d5d1a9",
83
+ unpack="gunzip",
84
+ ),
85
+ ),
86
+ tags=("genome",),
87
+ ),
88
+ Resource(
89
+ "hg38",
90
+ "UCSC hg38 (GRCh38) genome FASTA, unpacked and indexed",
91
+ "hg38",
92
+ "public (UCSC)",
93
+ (
94
+ FileSpec(
95
+ f"{_UCSC}/hg38/bigZips/hg38.fa.gz",
96
+ md5="1c9dcaddfa41027f17cd8f7a82c7293b",
97
+ unpack="gunzip",
98
+ ),
99
+ ),
100
+ tags=("genome",),
101
+ ),
102
+ Resource(
103
+ "adastra_mabel_v6.1",
104
+ "ADASTRA allele-specific TF binding, release Mabel v6.1 (hg38; every tested heterozygous SNV per TF)",
105
+ "v6.1 Mabel (2024-11-16)",
106
+ "CC-BY 4.0",
107
+ (
108
+ FileSpec(
109
+ f"{_ZEN}/ADASTRA.v.6.1.Mabel.zip/content",
110
+ md5="4a3672e8261c49c37d8d2297393b0069",
111
+ unpack="unzip",
112
+ ),
113
+ FileSpec(
114
+ f"{_ZEN}/readme.ADASTRA.Mabel.v6.1.txt/content", md5="45e7b826c1b4043bf2b28d10d2e1b134"
115
+ ),
116
+ ),
117
+ note="Zenodo may refuse cluster IP ranges; fetch from a workstation into the shared resources dir.",
118
+ tags=("labels",),
119
+ ),
120
+ Resource(
121
+ "geuvadis",
122
+ "Geuvadis LCL RNA-seq (Lappalainen 2013): ASE counts (GD462, coverage >= 8), EUR373 gene eQTLs, "
123
+ "phased genotypes of the RNA-seq samples (1000 Genomes phase 1, GRCh37)",
124
+ "E-GEUV-1 (BioStudies)",
125
+ "public (EBI)",
126
+ (
127
+ FileSpec(
128
+ f"{_GEUV}/analysis_results/GD462.ASE.COV8.ANNOT_PTV.txt.gz",
129
+ md5="ec176464c087ce6038bbfc33c477b90d",
130
+ ),
131
+ FileSpec(
132
+ f"{_GEUV}/analysis_results/EUR373.gene.cis.FDR5.all.rs137.txt.gz",
133
+ md5="801d9b92d6c4dadb76fe3565076bfe86",
134
+ ),
135
+ FileSpec(
136
+ f"{_GEUV}/analysis_results/EUR373.gene.cis.FDR5.best.rs137.txt.gz",
137
+ md5="3b22c8f7311fe4678f9bbf44263ef0cc",
138
+ ),
139
+ FileSpec(
140
+ f"{_GEUV}/analysis_results/GeuvadisRNASeqAnalysisFiles_README.txt",
141
+ md5="97c7c5febe0d33dca9900ae58f18bea7",
142
+ ),
143
+ FileSpec(
144
+ f"{_GEUV}/genotypes/Phase1.Geuvadis_dbSnp137_idconvert.txt.gz",
145
+ md5="6ee5c01707f4092f7ac0d2fa5d82a1c5",
146
+ ),
147
+ FileSpec(
148
+ f"{_GEUV}/genotypes/GEUVADIS.chr1.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
149
+ md5="195b2159b626937c14f268b073d6399a",
150
+ ),
151
+ FileSpec(
152
+ f"{_GEUV}/genotypes/GEUVADIS.chr2.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
153
+ md5="75d8eecfdf2fa604c508afbc79c0c553",
154
+ ),
155
+ FileSpec(
156
+ f"{_GEUV}/genotypes/GEUVADIS.chr3.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
157
+ md5="4d46f6ec74cf424b34cfa8bd1eb9d4c5",
158
+ ),
159
+ FileSpec(
160
+ f"{_GEUV}/genotypes/GEUVADIS.chr4.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
161
+ md5="4aec8ad8b53dd6c32ac040859a5779e8",
162
+ ),
163
+ FileSpec(
164
+ f"{_GEUV}/genotypes/GEUVADIS.chr5.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
165
+ md5="f031246d68cf7f38be55685b43b4114c",
166
+ ),
167
+ FileSpec(
168
+ f"{_GEUV}/genotypes/GEUVADIS.chr6.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
169
+ md5="900aec0863f36214fcd77c8f9047257c",
170
+ ),
171
+ FileSpec(
172
+ f"{_GEUV}/genotypes/GEUVADIS.chr7.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
173
+ md5="b8312afa11594aa5a1e70663bcb86985",
174
+ ),
175
+ FileSpec(
176
+ f"{_GEUV}/genotypes/GEUVADIS.chr8.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
177
+ md5="53008d07ab8a2bbc27e3e2fe747870d9",
178
+ ),
179
+ FileSpec(
180
+ f"{_GEUV}/genotypes/GEUVADIS.chr9.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
181
+ md5="ed50819e920cde4bb365fdf66c5b749f",
182
+ ),
183
+ FileSpec(
184
+ f"{_GEUV}/genotypes/GEUVADIS.chr10.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
185
+ md5="5aaf58b19191e64d3360c9e3e8991b05",
186
+ ),
187
+ FileSpec(
188
+ f"{_GEUV}/genotypes/GEUVADIS.chr11.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
189
+ md5="275e7c14e79675ad628c6aaed576d7ca",
190
+ ),
191
+ FileSpec(
192
+ f"{_GEUV}/genotypes/GEUVADIS.chr12.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
193
+ md5="3f0882b54e287fab061c6ff89bb491e5",
194
+ ),
195
+ FileSpec(
196
+ f"{_GEUV}/genotypes/GEUVADIS.chr13.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
197
+ md5="1a01f756e2a35b891630a7f1d6960fda",
198
+ ),
199
+ FileSpec(
200
+ f"{_GEUV}/genotypes/GEUVADIS.chr14.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
201
+ md5="d37d0d471bbe36acaa38013e38da1a2a",
202
+ ),
203
+ FileSpec(
204
+ f"{_GEUV}/genotypes/GEUVADIS.chr15.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
205
+ md5="ef368400d3678824c94d874780bcec79",
206
+ ),
207
+ FileSpec(
208
+ f"{_GEUV}/genotypes/GEUVADIS.chr16.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
209
+ md5="fe251a7f82953a0b4d997a827819d81c",
210
+ ),
211
+ FileSpec(
212
+ f"{_GEUV}/genotypes/GEUVADIS.chr17.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
213
+ md5="a82477edffd73bedeb4e73700db5cfd4",
214
+ ),
215
+ FileSpec(
216
+ f"{_GEUV}/genotypes/GEUVADIS.chr18.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
217
+ md5="13346cf3e268743f0a7dea6bc8988591",
218
+ ),
219
+ FileSpec(
220
+ f"{_GEUV}/genotypes/GEUVADIS.chr19.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
221
+ md5="b4bcd1b92ec25f51b8772200f0190ee9",
222
+ ),
223
+ FileSpec(
224
+ f"{_GEUV}/genotypes/GEUVADIS.chr20.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
225
+ md5="83b32dfb10e6d1d072421964e201a778",
226
+ ),
227
+ FileSpec(
228
+ f"{_GEUV}/genotypes/GEUVADIS.chr21.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
229
+ md5="1ac8e4b74c4236f8ec5ff29b8151669b",
230
+ ),
231
+ FileSpec(
232
+ f"{_GEUV}/genotypes/GEUVADIS.chr22.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz",
233
+ md5="25ed20e8cb1d4dab14892a92a9965c03",
234
+ ),
235
+ ),
236
+ note="Real-data tests of I-36 (haplotype score vs ASE) and I-37 (eQTL loci of the Tewhey MPRA).",
237
+ tags=("validation",),
238
+ ),
239
+ Resource(
240
+ "tewhey2016_mpra",
241
+ "Tewhey et al. 2016 (Cell 165:1519) MPRA of Geuvadis LCL eQTL variants: GEO counts + supplementary tables",
242
+ "GSE75661 (processed counts)",
243
+ "public (GEO; journal supplementary data)",
244
+ tuple(
245
+ [
246
+ FileSpec(f"{_GEO}/GSE75nnn/GSE75661/suppl/GSE75661_{s}_collapsed_counts.txt.gz")
247
+ for s in ("79k", "7.5k")
248
+ ]
249
+ ),
250
+ note="No published md5; the manifest records ours. The journal supplements are not open access "
251
+ "(PMC serves a browser check), so emVars are called from the counts. Truth set for I-37 (I-23).",
252
+ tags=("validation",),
253
+ ),
254
+ Resource(
255
+ "ancestral_grch38",
256
+ "Ensembl ancestral alleles for GRCh38 (EPO primate alignments; upper case = high confidence)",
257
+ "Ensembl current_fasta (file dated 2022-03-19)",
258
+ "public (Ensembl)",
259
+ (
260
+ FileSpec(
261
+ "https://ftp.ensembl.org/pub/current_fasta/ancestral_alleles/homo_sapiens_ancestor_GRCh38.tar.gz",
262
+ md5="d29338514407ac418643404d8e8471f5",
263
+ unpack="untar",
264
+ ),
265
+ ),
266
+ tags=("evolution",),
267
+ ),
268
+ Resource(
269
+ "phylop100_hg38",
270
+ "UCSC phyloP 100-way vertebrate conservation, hg38 (bigWig)",
271
+ "hg38 phyloP100way",
272
+ "public (UCSC)",
273
+ (
274
+ FileSpec(
275
+ f"{_UCSC}/hg38/phyloP100way/hg38.phyloP100way.bw", md5="43858006bdf98145b6fd239490bd0478"
276
+ ),
277
+ ),
278
+ tags=("evolution",),
279
+ ),
280
+ Resource(
281
+ "zoonomia241_phylop_hg38",
282
+ "Zoonomia 241-mammal Cactus phyloP, hg38 (bigWig, UCSC copy)",
283
+ "hg38 cactus241way",
284
+ "public (UCSC / Zoonomia)",
285
+ (
286
+ FileSpec(
287
+ f"{_UCSC}/hg38/cactus241way/cactus241way.phyloP.bw",
288
+ md5="fffa7057e9afa1e177090108775d6418",
289
+ ),
290
+ ),
291
+ note="UCSC md5sum.txt names it hg38.cactus241way.phyloP.bw; same md5 (checked 2026-12-01).",
292
+ tags=("evolution",),
293
+ ),
294
+ Resource(
295
+ "cisbp_escores_3.10",
296
+ "CIS-BP 3.10 PBM 8-mer E-scores (all species); register a local copy with `asebind fetch --register`",
297
+ "3.10",
298
+ "CIS-BP terms (academic use)",
299
+ (),
300
+ note="CIS-BP bulk downloads go through a web form; download by hand, then register the file.",
301
+ tags=("escores",),
302
+ ),
303
+ ]
304
+ }