Add combined retrieval guide
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146# Structures for the GPBridge expanded-GO dataset
One structure per sequence for **322,992 sequences**, assembled from threesources. They are meant to be used together, so the first thing to read is`structure_index.tsv`: it resolves any `seq_id` to a file, whichever sourceprovides it.
Sequence ids are `seq_<sha256(sequence)[:20]>`, so an id always identifies anexact sequence.
## Coverage
| Source | Sequences | What it is ||---|---:|---|| `gpbridge/afdb/` | 304,787 | AlphaFold DB, **AlphaFold 2**, model v6 || `gpbridge/pdb/` | 11,495 | experimental structures from RCSB || `predictions/missing_pdb_afdb/` | 6,540 | **AlphaFold 3**, predicted here || no structure | 11,075 | neither source has one |
10,904 sequences have both an AFDB model and a PDB entry — the index exposesboth so you can choose per use case.
**These come from three different methods.** AF2, AF3 and experiment are notinterchangeable, and the split is not random: see *Provenance* below beforetraining on the union.
## Resolve a sequence to a file
`structure_index.tsv` — one row per sequence, all sources on the same row:
```seq_id length split best af3_archive afdb_archive afdb_file pdb_archive pdb_file pdb_all_ids note```
`best` is a suggested default, not a judgement: `af3` where one was predicted,otherwise `afdb`, otherwise `pdb`. That ordering follows the source bundle's ownguidance — AFDB is the workhorse, while a PDB hit may be a construct, a singledomain, or one chain of a complex and is not guaranteed to cover the fullsequence. For experimental ground truth, prefer `pdb_archive` explicitly.
```pythonimport csv, io, json, tarfile, zstandardfrom huggingface_hub import hf_hub_downloadREPO = "tonynzh2/afdb"
idx = {r["seq_id"]: r for r in csv.DictReader( open(hf_hub_download(REPO, "structure_index.tsv", repo_type="dataset")), delimiter="\t")}
def structure(seq_id, prefer=None): """Returns (source, text). prefer='pdb' to force experimental when present.""" r = idx[seq_id] order = [prefer] if prefer else [] order += ["af3", "afdb", "pdb"] for src in order: if src == "af3" and r["af3_archive"]: return "af3", _from_zst(r["af3_archive"], seq_id) if src == "afdb" and r["afdb_archive"]: return "afdb", _from_tar(r["afdb_archive"], r["afdb_file"], gz=True) if src == "pdb" and r["pdb_archive"]: return "pdb", _from_tar(r["pdb_archive"], r["pdb_file"], gz=True) return "none", None
def _from_tar(archive, member, gz=False): import gzip path = hf_hub_download(REPO, archive, repo_type="dataset") with tarfile.open(path) as tar: # plain tar, members are .gz raw = tar.extractfile(member).read() return gzip.decompress(raw).decode() if gz else raw.decode()
def _from_zst(archive, seq_id): path = hf_hub_download(REPO, archive, repo_type="dataset") with open(path, "rb") as fh: stream = zstandard.ZstdDecompressor().stream_reader(fh) with tarfile.open(fileobj=stream, mode="r|") as tar: for m in tar: if m.isfile() and m.name == f"{seq_id}/{seq_id}_model.cif": return tar.extractfile(m).read().decode() return None```
The AFDB and PDB archives are plain `.tar` holding already-gzipped `.cif.gz`members; the AF3 archives are `.tar.zst` holding whole output directories. Bothare bundled by shard because 350,000+ loose objects would make the repounusable.
## Provenance — read before combining
The three sources differ in method, and **which source a sequence gets is notrandom**:
- Reconstructed ancestral sequences have no UniProt accession, so they can never have an AFDB model. They are predicted or nothing.- Well-studied proteins are the ones with PDB entries.- The 6,540 AF3 predictions are, by construction, the sequences with *neither* a PDB entry nor an AFDB model — i.e. the thinnest-homology corner of the dataset.
So source correlates with sequence properties. If a model trained on the unionbehaves differently on AF2-labelled versus AF3-labelled sequences, that isconfounded with those properties and not attributable to the structures alone.Record which source each label came from — the index's `best` column does this —and check it as a covariate rather than assuming exchangeability.
Version details worth recording: AFDB files are **model v6** (not the v4 manypapers cite), and the AF3 predictions use v3.0.4 with stock settings, seed20260916, 5 diffusion samples, 10 recycles, full 4-database MSA and templatesearch. Per-shard details are in `predictions/missing_pdb_afdb/README.md`.
## Known gaps
| Issue | Count | Handling ||---|---:|---|| AFDB accession linked but **no model exists** at any version | 1,508 | in `gpbridge/afdb_no_model_needs_af3.fasta`; not in any fetch list and not in `missing_pdb_afdb_training.fasta` either — they need prediction || PDB entries **withdrawn** by RCSB | 7 | fetched into `gpbridge/pdb_obsolete/`, flagged in the index's `note` || No structure from any source | 11,075 | `best = none` |
The 1,508 are worth emphasising: the source bundle's coverage table counts themas having an AlphaFold DB model. They do not — they are live UniProt entries ofordinary length returning 404 on both v6 and v4. Nothing in the originalpipeline covered them.
## Layout
```structure_index.tsv every sequence -> its file(s)gpbridge/join.tsv.gz original join table from the source bundlegpbridge/coverage.csv source bundle's coverage, all 13 populationsgpbridge/BUNDLE_README.md source bundle's own documentationgpbridge/afdb/<2-char>.tar 211 archives, AF2 model v6gpbridge/pdb/<2-char>.tar 1,088 archives, experimentalgpbridge/pdb_obsolete/ 7 withdrawn entriesgpbridge/afdb_no_model.tsv the 1,508, with their 404sgpbridge/afdb_no_model_needs_af3.fasta their sequencespredictions/missing_pdb_afdb/ AF3 output + its own README and index```
## Terms of use
AlphaFold 3 output in `predictions/` is subject to the[AlphaFold 3 Output Terms of Use](OUTPUT_TERMS_OF_USE.md) — non-commercial, andredistribution must carry the terms. AlphaFold DB structures are CC-BY-4.0 fromEMBL-EBI. PDB entries are in the public domain.
Cite AlphaFold 3: Abramson, J. et al. *Nature* **630**, 493–500 (2024).Cite AlphaFold DB: Varadi, M. et al. *Nucleic Acids Research* (2024).STRUCTURES.mdAdded+146