Datasets:
|
Download README.md from Synthyra/AtlasFold-Data: direct link, hf CLI and curl.
- Browser
- Download file 29.7 kB
-
https://huggingface.co/datasets/Synthyra/AtlasFold-Data/resolve/main/README.md
- Command line
-
hf download hf://datasets/Synthyra/AtlasFold-Data/README.md
-
curl -L -o README.md https://huggingface.co/datasets/Synthyra/AtlasFold-Data/resolve/main/README.md
29.7 kB
| license: other | |
| license_name: atlasfold-data | |
| license_link: https://github.com/SeonghwanSeo/atlasfold/blob/444f376d85b9954a5f2f5f3f8b3cbcae1201ebb1/LICENSE | |
| pretty_name: AtlasFold-Data | |
| tags: | |
| - biology | |
| - protein | |
| - protein-structure | |
| - structure-prediction | |
| - alphafold | |
| - pdb | |
| size_categories: | |
| - 10M<n<100M | |
| configs: | |
| - config_name: rcsb | |
| data_files: | |
| - split: train | |
| path: data/rcsb/train-* | |
| default: true | |
| - config_name: rcsb_multimer | |
| data_files: | |
| - split: train | |
| path: data/rcsb_multimer/train-* | |
| - config_name: rcsb_multimer_templates | |
| data_files: | |
| - split: train | |
| path: data/rcsb_multimer_templates/train-* | |
| - config_name: rcsb_multimer_template_hits | |
| data_files: | |
| - split: train | |
| path: data/rcsb_multimer_template_hits/train-* | |
| - config_name: cameo_val | |
| data_files: | |
| - split: validation | |
| path: data/cameo_val/validation-* | |
| - config_name: rcsb_multimer_val | |
| data_files: | |
| - split: validation | |
| path: data/rcsb_multimer_val/validation-* | |
| - config_name: disordered_pdb_af2 | |
| data_files: | |
| - split: train | |
| path: data/disordered_pdb_af2/train-* | |
| - config_name: disordered_pdb_afm | |
| data_files: | |
| - split: train | |
| path: data/disordered_pdb_afm/train-* | |
| - config_name: mgnify_short | |
| data_files: | |
| - split: train | |
| path: data/mgnify_short/train-* | |
| - config_name: mgnify_long | |
| data_files: | |
| - split: train | |
| path: data/mgnify_long/train-* | |
| - config_name: rcsb_index | |
| data_files: | |
| - split: train | |
| path: data/rcsb_index/train-* | |
| - config_name: rcsb_multimer_index | |
| data_files: | |
| - split: train | |
| path: data/rcsb_multimer_index/train-* | |
| - config_name: cameo_val_index | |
| data_files: | |
| - split: validation | |
| path: data/cameo_val_index/validation-* | |
| - config_name: rcsb_multimer_val_index | |
| data_files: | |
| - split: validation | |
| path: data/rcsb_multimer_val_index/validation-* | |
| - config_name: disordered_pdb_af2_index | |
| data_files: | |
| - split: train | |
| path: data/disordered_pdb_af2_index/train-* | |
| - config_name: disordered_pdb_afm_index | |
| data_files: | |
| - split: train | |
| path: data/disordered_pdb_afm_index/train-* | |
| - config_name: mgnify_short_index | |
| data_files: | |
| - split: train | |
| path: data/mgnify_short_index/train-* | |
| - config_name: mgnify_long_index | |
| data_files: | |
| - split: train | |
| path: data/mgnify_long_index/train-* | |
| # AtlasFold-Data | |
| AtlasFold-Data is a Parquet conversion of the structures that | |
| [AtlasFold](https://github.com/SeonghwanSeo/atlasfold) released for training its monomer and | |
| complex models ([preprint](https://www.biorxiv.org/content/10.64898/2026.09.04.749352v2)). The | |
| original release is nine `.tar.zst` archives of LMDB databases in a | |
| [Google Drive folder](https://drive.google.com/drive/folders/1EiRTKSUL3iD_MQ_0qmj5Sb-2KMh-3kmS). | |
| This repository holds the same entries as typed Parquet that `datasets`, pyarrow, DuckDB, and | |
| Polars can stream, plus index tables that reproduce AtlasFold's training sampler exactly. | |
| No value was changed. Each Parquet row was read back and compared bit for bit with its LMDB value, | |
| and each manifest entry was rebuilt from its row and compared with the original entry. | |
| ## Subsets | |
| | Config | Structures | Rows | Samples | Split | Parquet | AtlasFold use | | |
| | --- | --- | ---: | ---: | --- | ---: | --- | | |
| | `rcsb` | PDB chains released by 2020-05-01, resolution at most 9 Å | 490,703 | | train | 11.35 GiB | Monomer stages 1 to 4 | | |
| | `rcsb_multimer` | PDB first biological assemblies released by 2021-09-30, at most 20 chains | 177,363 | 1,125,363 | train | 10.40 GiB | Multimer stages 1 to 3 | | |
| | `cameo_val` | CAMEO targets | 362 | | validation | 0.01 GiB | Monomer validation | | |
| | `rcsb_multimer_val` | PDB complexes released 2021-10-01 to 2023-01-12 with low-homology interfaces | 512 | 3,647 | validation | 0.03 GiB | Multimer validation | | |
| | `disordered_pdb_af2` | AlphaFold2 (ColabFold) predictions for PDB chains with many unresolved residues | 11,828 | | train | 0.34 GiB | Monomer stages 1 to 4 | | |
| | `disordered_pdb_afm` | AlphaFold-Multimer predictions of PDB complexes | 29,431 | 176,472 | train | 1.79 GiB | Multimer stages 1 to 3 | | |
| | `mgnify_short` | AlphaFold2 predictions of MGnify sequences shorter than 200 residues (OpenFold3) | 430,418 | | train | 5.04 GiB | All stages | | |
| | `mgnify_long` | AlphaFold2 predictions of MGnify sequences of 200 or more residues (OpenFold3) | 16,099,404 | | train | 526.45 GiB | All stages | | |
| | `rcsb_multimer_templates` | Template chains for `rcsb_multimer` (OpenFold3) | 950,691 | | train | 16.91 GiB | Multimer stages 1 to 3 | | |
| | `rcsb_multimer_template_hits` | Template alignments per `rcsb_multimer` entity | 89,255 | | train | 0.07 GiB | Multimer stages 1 to 3 | | |
| `disordered_pdb_esm` is not included: the released AtlasFold configurations do not use it, and its ESMFold predictions of PDB chains with unresolved regions duplicate what `disordered_pdb_af2` covers. | |
| "Samples" counts the chain and interface samples that AtlasFold draws from each complex. Every | |
| subset also has a `<subset>_index` config with one row per training sample in AtlasFold's order. | |
| Small original files (msgpack and JSON manifests, FASTA, cluster CSVs, the ColabFold PDB tarball of | |
| `disordered_pdb_af2`) are stored unchanged under `source/<subset>/`. | |
| ## Load | |
| ```bash | |
| pip install "datasets>=4,<6" "huggingface_hub>=1" pyarrow numpy | |
| ``` | |
| Stream a subset without downloading it: | |
| ```python | |
| from datasets import load_dataset | |
| rows = load_dataset("Synthyra/AtlasFold-Data", "rcsb_multimer_val", split="validation", streaming=True) | |
| row = next(iter(rows.with_format("numpy"))) | |
| print(row["id"], row["num_chains"], row["atom14_positions"].shape) # (l, 14, 3) | |
| ``` | |
| Download a subset and its index when you need random access or exact sampling: | |
| ```bash | |
| hf download Synthyra/AtlasFold-Data --repo-type dataset --local-dir AtlasFold-Data --include "data/rcsb/*" "data/rcsb_index/*" | |
| ``` | |
| Large training jobs should download rather than stream: every remote read counts against the Hub's | |
| request limits. | |
| ## Structure columns | |
| | Column | Type | Meaning | | |
| | --- | --- | --- | | |
| | `id` | string | AtlasFold entry key: `{pdb}_{label_asym_id}` for PDB chains, `{pdb}` for complexes, file stems for predictions | | |
| | `subset` | string | Config name | | |
| | `manifest_index` | int64 | Position of the entry in the original `manifest.msgpack` | | |
| | `num_chains`, `num_residues` | int32 | Chain count and total residues | | |
| | `sequence` | string | One-letter sequence over `ARNDCQEGHILKMFPSTWYVX`; chains are joined with `:` | | |
| | `chains` | list of struct | Per-chain manifest fields: `id`, `num_residues`, `label_asym_id`, `auth_asym_id`, `entity_id`, `asym_id`, `sym_id`, `cluster_id`, `cluster_size`, `is_low_homology` | | |
| | `interfaces` | list of struct | Chain pairs (`chain_a`, `chain_b`, 0-based) with a resolved Cα–Cα distance below 15 Å, with `cluster_id`, `cluster_size`, `is_low_homology` | | |
| | `exp_pdb_id`, `exp_release_date`, `exp_method`, `exp_resolution` | string, string, string, float64 | PDB entry, first release date, method, and resolution in Å | | |
| | `pred_model`, `pred_plddt` | string, float64 | Predictor and mean Cα pLDDT of a predicted structure | | |
| | `in_manifest_confidence` | bool | Entry appears in AtlasFold's `manifest_confidence.msgpack` (resolution 0.1 to 3.0 Å) | | |
| | `in_manifest_plddt70` | bool | Entry appears in `manifest_plddt70.msgpack` | | |
| | `atom14_positions` | Array3D (l, 14, 3) float32 | Heavy-atom coordinates in Å, atom14 order; NaN for slots a residue type lacks and for unresolved atoms | | |
| | `atom14_b_factors` | Array2D (l, 14) float32 | Per-atom B-factor column; NaN where coordinates are absent | | |
| A null manifest field means AtlasFold omitted that key; a null `is_low_homology` means false. A null | |
| `in_manifest_*` column means the subset has no such manifest. Chain `id`s can repeat within a complex | |
| because AtlasFold removed digits from assembly copy names, so identify chains by position. | |
| `atom14_b_factors` holds experimental B-factors for the PDB-derived subsets, pLDDT (0 to 100) for | |
| `disordered_pdb_af2` and the MGnify subsets, and a constant 20.0 for `disordered_pdb_afm`, whose | |
| predictions carry no pLDDT. The released MGnify manifests are not filtered by pLDDT. | |
| Atom14 slot order per residue type, the same as AlphaFold2 except that `X` keeps five slots: | |
| ```python | |
| import numpy as np | |
| RESTYPES = "ARNDCQEGHILKMFPSTWYVX" | |
| RESIDUE_ATOMS = { | |
| "A": ("N", "CA", "C", "O", "CB"), | |
| "R": ("N", "CA", "C", "O", "CB", "CG", "CD", "NE", "CZ", "NH1", "NH2"), | |
| "N": ("N", "CA", "C", "O", "CB", "CG", "OD1", "ND2"), | |
| "D": ("N", "CA", "C", "O", "CB", "CG", "OD1", "OD2"), | |
| "C": ("N", "CA", "C", "O", "CB", "SG"), | |
| "Q": ("N", "CA", "C", "O", "CB", "CG", "CD", "OE1", "NE2"), | |
| "E": ("N", "CA", "C", "O", "CB", "CG", "CD", "OE1", "OE2"), | |
| "G": ("N", "CA", "C", "O"), | |
| "H": ("N", "CA", "C", "O", "CB", "CG", "ND1", "CD2", "CE1", "NE2"), | |
| "I": ("N", "CA", "C", "O", "CB", "CG1", "CG2", "CD1"), | |
| "L": ("N", "CA", "C", "O", "CB", "CG", "CD1", "CD2"), | |
| "K": ("N", "CA", "C", "O", "CB", "CG", "CD", "CE", "NZ"), | |
| "M": ("N", "CA", "C", "O", "CB", "CG", "SD", "CE"), | |
| "F": ("N", "CA", "C", "O", "CB", "CG", "CD1", "CD2", "CE1", "CE2", "CZ"), | |
| "P": ("N", "CA", "C", "O", "CB", "CG", "CD"), | |
| "S": ("N", "CA", "C", "O", "CB", "OG"), | |
| "T": ("N", "CA", "C", "O", "CB", "OG1", "CG2"), | |
| "W": ("N", "CA", "C", "O", "CB", "CG", "CD1", "CD2", "NE1", "CE2", "CE3", "CZ2", "CZ3", "CH2"), | |
| "Y": ("N", "CA", "C", "O", "CB", "CG", "CD1", "CD2", "CE1", "CE2", "CZ", "OH"), | |
| "V": ("N", "CA", "C", "O", "CB", "CG1", "CG2"), | |
| "X": ("N", "CA", "C", "O", "CB"), | |
| } | |
| ATOM37_NAMES = ( | |
| "N", "CA", "C", "CB", "O", "CG", "CG1", "CG2", "OG", "OG1", "SG", "CD", "CD1", "CD2", "ND1", | |
| "ND2", "OD1", "OD2", "SD", "CE", "CE1", "CE2", "CE3", "NE", "NE1", "NE2", "OE1", "OE2", "CH2", | |
| "NH1", "NH2", "OH", "CZ", "CZ2", "CZ3", "NZ", "OXT", | |
| ) | |
| ATOM14_EXISTS = np.zeros((21, 14), dtype=bool) # (restype, slot) | |
| ATOM14_TO_ATOM37 = np.zeros((21, 14), dtype=np.int64) # (restype, slot) atom37 index | |
| for restype_index, restype in enumerate(RESTYPES): | |
| atoms = RESIDUE_ATOMS[restype] | |
| ATOM14_EXISTS[restype_index, : len(atoms)] = True | |
| ATOM14_TO_ATOM37[restype_index, : len(atoms)] = [ATOM37_NAMES.index(atom) for atom in atoms] | |
| def restype_indices(sequence): | |
| """Residue type index per residue, shape (l,); chain separators are skipped.""" | |
| return np.array([RESTYPES.index(letter) for letter in sequence.replace(":", "")]) | |
| def chain_bounds(sequence): | |
| """(start, end) residue offsets of each chain in the concatenated arrays.""" | |
| ends = np.cumsum([len(chain) for chain in sequence.split(":")]) | |
| return list(zip(np.concatenate([[0], ends[:-1]]).tolist(), ends.tolist())) | |
| def derived_chain_ids(sequence): | |
| """Entity, asym, and sym ids per chain, assigned as AtlasFold's ProteinMultimer does.""" | |
| entity_ids, sym_ids, entity_of, copies = [], [], {}, {} | |
| for chain in sequence.split(":"): | |
| entity_of.setdefault(chain, len(entity_of) + 1) | |
| copies[chain] = copies.get(chain, 0) + 1 | |
| entity_ids.append(entity_of[chain]) | |
| sym_ids.append(copies[chain]) | |
| return entity_ids, list(range(1, len(entity_ids) + 1)), sym_ids | |
| def atom14_to_atom37(positions, sequence): | |
| """Scatter (l, 14, 3) atom14 coordinates into (l, 37, 3) atom37 slots; empty slots stay NaN.""" | |
| restypes = restype_indices(sequence) # (l,) | |
| atom37 = np.full((len(restypes), 37, 3), np.nan, dtype=positions.dtype) # (l, 37, 3) | |
| residues, slots = np.nonzero(ATOM14_EXISTS[restypes]) # (n_atom,), (n_atom,) | |
| atom37[residues, ATOM14_TO_ATOM37[restypes[residues], slots]] = positions[residues, slots] | |
| return atom37 | |
| ``` | |
| The resolved-atom mask is `np.isfinite(row["atom14_positions"]).all(-1)`, shape (l, 14). | |
| ## Index and template columns | |
| `<subset>_index` rows follow AtlasFold's sampling order and point into the structure files: rows of | |
| `data/<subset>/` sorted by file name, where `file_index` selects the file and `row_index` the row. | |
| | Config kind | Columns | | |
| | --- | --- | | |
| | Monomer subsets | `manifest_index`, `id`, `num_residues`, `cluster_size`, `plddt`, `resolution`, `file_index`, `row_index` | | |
| | Complex subsets | `sample_index`, `manifest_index`, `kind` (`chain` or `interface`), `chain_a`, `chain_b`, `cluster_size`, `file_index`, `row_index` | | |
| `rcsb_multimer_templates` stores the 950,691 template chains of `template.lmdb` (`template_id`, | |
| `manifest_index`, `num_residues`, `sequence`, `atom14_positions`). Their stored b-factors are NaN in | |
| every slot, so that column is omitted. `rcsb_multimer_template_hits` stores `template_mapping.lmdb`: | |
| `mapping_key` (`{pdb}_{entity_id}`), `pdb_id`, `entity_id`, and `hits` with `template_id`, `index`, | |
| `release_date`, and 1-based aligned residue indices `entry_indices` and `template_indices`. AtlasFold | |
| already removed templates released less than 60 days before their entry. | |
| ## Reproduce AtlasFold's training sampler | |
| AtlasFold draws every training example with replacement from one weight vector. Weights are | |
| normalized within a subset, multiplied by the subset's stage weight, and concatenated in config order. | |
| - Monomer subsets multiply per-entry factors: `length` gives `min(max(num_residues, 256), 512)`, | |
| `cluster` gives `1 / cluster_size`, and `plddt` gives `min(max(plddt - 30, 0), 40)`. | |
| - `rcsb_multimer` and `disordered_pdb_afm` draw chains with weight `1 / cluster_size` and | |
| interfaces with `2 / cluster_size`, a missing size counting as 1, in float32. | |
| - MGnify subsets in multimer stages are uniform. | |
| - The sampler seeds NumPy with `0 + epoch`. An epoch is 256,000 draws for monomer stages and | |
| 128,000 for multimer stages, and a draw that fails cropping is replaced by a uniform draw from the | |
| same subset. | |
| - Confidence losses use only non-distillation entries with resolution from 0.1 to 3.0 Å. | |
| | Monomer stage | Crop / LM tokens | `rcsb` | `disordered_pdb_af2` | `mgnify_long` | `mgnify_short` | | |
| | --- | --- | --- | --- | --- | --- | | |
| | 1 | 256 / 512 | 0.120 length, cluster | 0.005 length, cluster | 0.865 length, plddt | 0.010 length, plddt | | |
| | 2 | 384 / 768 | 0.123 length, cluster | 0.002 length, cluster | 0.865 length, plddt | 0.010 length, plddt | | |
| | 3 | 512 / 1024 | 0.240 length, cluster | 0.010 length, cluster | 0.740 plddt | 0.010 plddt | | |
| | 4 | 640 / 1280 | 0.240 length, cluster | 0.010 length, cluster | 0.740 plddt | 0.010 plddt | | |
| | Multimer stage | Crop / LM tokens | `rcsb_multimer` | `disordered_pdb_afm` | `mgnify_long` | `mgnify_short` | | |
| | --- | --- | --- | --- | --- | --- | | |
| | 1 | 384 / 768 | 0.73 | 0.02 | 0.245 | 0.005 | | |
| | 2 | 640 / 1280 | 0.490 | 0.010 | 0.495 | 0.005 | | |
| | 3 | 768 / 1536 | 0.490 | 0.010 | 0.495 | 0.005 | | |
| Multimer stages use templates for `rcsb_multimer` with probability 0.4 and at most two per chain. | |
| The stage settings come from `configs/{monomer,multimer}/train_stage*.yaml` at commit `444f376`. | |
| The following code reproduces the index sequence of AtlasFold's `DistributedWeightedSampler` from a | |
| local download that includes the needed `data/*_index/` folders: | |
| ```python | |
| import math | |
| import numpy as np | |
| import pyarrow.parquet as pq | |
| from pathlib import Path | |
| MONOMER_STAGES = { | |
| 1: [("rcsb", 0.120, ("length", "cluster")), ("disordered_pdb_af2", 0.005, ("length", "cluster")), | |
| ("mgnify_long", 0.865, ("length", "plddt")), ("mgnify_short", 0.010, ("length", "plddt"))], | |
| 2: [("rcsb", 0.123, ("length", "cluster")), ("disordered_pdb_af2", 0.002, ("length", "cluster")), | |
| ("mgnify_long", 0.865, ("length", "plddt")), ("mgnify_short", 0.010, ("length", "plddt"))], | |
| 3: [("rcsb", 0.240, ("length", "cluster")), ("disordered_pdb_af2", 0.010, ("length", "cluster")), | |
| ("mgnify_long", 0.740, ("plddt",)), ("mgnify_short", 0.010, ("plddt",))], | |
| 4: [("rcsb", 0.240, ("length", "cluster")), ("disordered_pdb_af2", 0.010, ("length", "cluster")), | |
| ("mgnify_long", 0.740, ("plddt",)), ("mgnify_short", 0.010, ("plddt",))], | |
| } | |
| MULTIMER_STAGES = { | |
| 1: [("rcsb_multimer", 0.73), ("disordered_pdb_afm", 0.02), ("mgnify_long", 0.245), ("mgnify_short", 0.005)], | |
| 2: [("rcsb_multimer", 0.490), ("disordered_pdb_afm", 0.010), ("mgnify_long", 0.495), ("mgnify_short", 0.005)], | |
| 3: [("rcsb_multimer", 0.490), ("disordered_pdb_afm", 0.010), ("mgnify_long", 0.495), ("mgnify_short", 0.005)], | |
| } | |
| COMPLEX_SUBSETS = {"rcsb_multimer", "disordered_pdb_afm", "rcsb_multimer_val"} | |
| def read_index(root, subset): | |
| return pq.read_table(next(Path(root, "data", f"{subset}_index").glob("*.parquet"))) | |
| def monomer_weights(index, strategies): | |
| """TrainingDataset.get_sampling_weights with the same float64 operations.""" | |
| weights = np.ones(index.num_rows) | |
| for strategy in strategies: | |
| if strategy == "length": | |
| weights *= np.minimum(np.maximum(index["num_residues"].to_numpy().astype(np.float64), 256), 512) | |
| elif strategy == "cluster": | |
| if index["cluster_size"].null_count: | |
| raise ValueError("AtlasFold raises on a missing cluster_size") | |
| sizes = index["cluster_size"].to_numpy().astype(np.float64) | |
| weights *= 1 / np.where(sizes == 0, 1, sizes) | |
| elif strategy == "plddt": | |
| weights *= np.minimum(np.maximum(index["plddt"].fill_null(0.0).to_numpy() - 30, 0), 40) | |
| return weights / weights.sum() | |
| def complex_sample_weights(index): | |
| """RCSBTrainingDataset weights: chains 1 / cluster_size, interfaces 2 / cluster_size, float32.""" | |
| sizes = index["cluster_size"].fill_null(0).to_numpy().astype(np.float64) | |
| kind = np.where(index["kind"].to_numpy(zero_copy_only=False) == "interface", 2.0, 1.0) | |
| weights = (1.0 / np.where(sizes == 0, 1, sizes) * kind).astype(np.float32) | |
| return weights / weights.sum() | |
| def stage_weights(root, mode, stage): | |
| """Return the stage weight vector, its subset names, and cumulative subset sizes.""" | |
| parts, subsets = [], [] | |
| if mode == "monomer": | |
| for subset, weight, strategies in MONOMER_STAGES[stage]: | |
| parts.append(monomer_weights(read_index(root, subset), strategies) * weight) | |
| subsets.append(subset) | |
| else: | |
| for subset, weight in MULTIMER_STAGES[stage]: | |
| index = read_index(root, subset) | |
| if subset in COMPLEX_SUBSETS: | |
| base = complex_sample_weights(index) | |
| else: | |
| base = np.full(index.num_rows, 1 / index.num_rows, dtype=np.float32) | |
| parts.append(base * weight) | |
| subsets.append(subset) | |
| return np.concatenate(parts), subsets, np.cumsum([len(part) for part in parts]) | |
| def sampled_indices(weights, epoch, rank=0, world_size=1, seed=0): | |
| """Indices that DistributedWeightedSampler yields to `rank` for `epoch`.""" | |
| probabilities = weights.astype(np.float64) | |
| probabilities = probabilities / probabilities.sum() | |
| total = math.ceil(len(probabilities) / world_size) * world_size | |
| indices = np.random.default_rng(seed + epoch).choice(len(probabilities), total, p=probabilities, replace=True) | |
| return indices[rank:total:world_size] | |
| def locate(index_value, subsets, cumulative): | |
| """Map a global sampler index to its subset and index-table row.""" | |
| position = int(np.searchsorted(cumulative, index_value, side="right")) | |
| return subsets[position], int(index_value - (cumulative[position - 1] if position else 0)) | |
| ``` | |
| For example, `weights, subsets, cumulative = stage_weights("AtlasFold-Data", "multimer", 1)`, then | |
| `locate(sampled_indices(weights, epoch=0)[0], subsets, cumulative)` names the first sample of the | |
| first multimer epoch. The index row gives the structure file, row, and for complexes the chain or | |
| interface that AtlasFold uses to center its crop. | |
| Read indexed structures from a local download: | |
| ```python | |
| import datasets # registers the Array2D and Array3D column types with pyarrow | |
| import pyarrow as pa | |
| import pyarrow.parquet as pq | |
| from pathlib import Path | |
| ARRAY_SHAPES = {"atom14_positions": (-1, 14, 3), "atom14_b_factors": (-1, 14)} | |
| def row_arrays(batch, index): | |
| """One row of a record batch as Python values, with structure columns as NumPy arrays.""" | |
| row = {} | |
| for name in batch.schema.names: | |
| column = batch[name] | |
| if name not in ARRAY_SHAPES: | |
| row[name] = column[index].as_py() | |
| continue | |
| values = (column.storage if isinstance(column, pa.ExtensionArray) else column)[index].values | |
| while pa.types.is_list(values.type): | |
| values = values.flatten() | |
| row[name] = values.to_numpy(zero_copy_only=False).reshape(ARRAY_SHAPES[name]) | |
| return row | |
| def read_structure(root, subset, file_index, row_index): | |
| """Return the structure row that an index table points to.""" | |
| path = sorted(Path(root, "data", subset).glob("*.parquet"))[file_index] | |
| parquet = pq.ParquetFile(path) | |
| start = 0 | |
| for group in range(parquet.num_row_groups): | |
| rows_in_group = parquet.metadata.row_group(group).num_rows | |
| if row_index < start + rows_in_group: | |
| batch = parquet.read_row_group(group).combine_chunks().to_batches()[0] | |
| return row_arrays(batch, row_index - start) | |
| start += rows_in_group | |
| raise IndexError(f"{path.name} has no row {row_index}") | |
| ``` | |
| ## Use AtlasFold's own trainer | |
| Row-group reads are slow for random access over `mgnify_long`. To train with AtlasFold's code, rebuild | |
| its native layout (`manifest.msgpack` plus `structure.lmdb`) from a local download. The rebuilt LMDB | |
| values decode to arrays identical to the original release; the NPZ bytes differ only in zip metadata. | |
| ```python | |
| import io | |
| import lmdb | |
| import numpy as np | |
| import pickle | |
| import pyarrow.parquet as pq | |
| import shutil | |
| from pathlib import Path | |
| def compact_arrays(sequence, positions, b_factors): | |
| """Keep only existing atom14 slots, as AtlasFold's DataPipeline stores them.""" | |
| exists = ATOM14_EXISTS[restype_indices(sequence)] # (l, 14) | |
| return positions[exists], b_factors[exists] # (n_atom, 3), (n_atom,) | |
| def npz_bytes(arrays): | |
| buffer = io.BytesIO() | |
| np.savez_compressed(buffer, **arrays) | |
| return buffer.getvalue() | |
| def rebuild_native_subset(root, subset, output_root, is_complex): | |
| target = Path(output_root, subset) | |
| target.mkdir(parents=True, exist_ok=True) | |
| for source in Path(root, "source", subset).iterdir(): | |
| shutil.copyfile(source, target / source.name) | |
| environment = lmdb.open(str(target / "structure.lmdb"), map_size=1 << 41) | |
| columns = ["id", "chains", "sequence", "atom14_positions", "atom14_b_factors"] | |
| for path in sorted(Path(root, "data", subset).glob("*.parquet")): | |
| for batch in pq.ParquetFile(path).iter_batches(batch_size=256, columns=columns): | |
| with environment.begin(write=True) as transaction: | |
| for index in range(batch.num_rows): | |
| row = row_arrays(batch, index) | |
| arrays = {"name": np.array([row["id"]], dtype="S")} | |
| chains = list(zip(row["chains"], row["sequence"].split(":"), chain_bounds(row["sequence"]))) | |
| if is_complex: | |
| arrays["num_chains"] = np.array([len(chains)], dtype=np.int64) | |
| for chain_index, (chain, sequence, (start, end)) in enumerate(chains): | |
| prefix = f"{chain_index}." if is_complex else "" | |
| coordinates, b_factors = compact_arrays( | |
| sequence, row["atom14_positions"][start:end], row["atom14_b_factors"][start:end] | |
| ) | |
| arrays[f"{prefix}name"] = np.array([chain["id"]], dtype="S") | |
| arrays[f"{prefix}sequence"] = np.array([sequence], dtype="S") | |
| arrays[f"{prefix}coordinates"] = coordinates | |
| arrays[f"{prefix}b_factors"] = b_factors | |
| transaction.put(row["id"].encode(), npz_bytes(arrays)) | |
| environment.close() | |
| def rebuild_native_templates(root, output_root): | |
| """Restore `template.lmdb` and `template_mapping.lmdb` for `rcsb_multimer`.""" | |
| target = Path(output_root, "rcsb_multimer") | |
| target.mkdir(parents=True, exist_ok=True) | |
| templates = lmdb.open(str(target / "template.lmdb"), map_size=1 << 41) | |
| for path in sorted(Path(root, "data", "rcsb_multimer_templates").glob("*.parquet")): | |
| for batch in pq.ParquetFile(path).iter_batches(batch_size=512, columns=["template_id", "sequence", "atom14_positions"]): | |
| with templates.begin(write=True) as transaction: | |
| for index in range(batch.num_rows): | |
| row = row_arrays(batch, index) | |
| positions = row["atom14_positions"] # (l, 14, 3) | |
| coordinates, b_factors = compact_arrays(row["sequence"], positions, np.full(positions.shape[:2], np.nan, np.float32)) | |
| arrays = { | |
| "name": np.array([row["template_id"]], dtype="S"), | |
| "sequence": np.array([row["sequence"]], dtype="S"), | |
| "coordinates": coordinates, | |
| "b_factors": b_factors, | |
| } | |
| transaction.put(row["template_id"].encode(), npz_bytes(arrays)) | |
| templates.close() | |
| mapping = lmdb.open(str(target / "template_mapping.lmdb"), map_size=1 << 40) | |
| for path in sorted(Path(root, "data", "rcsb_multimer_template_hits").glob("*.parquet")): | |
| with mapping.begin(write=True) as transaction: | |
| for row in pq.read_table(path).to_pylist(): | |
| hits = [ | |
| { | |
| "template_id": hit["template_id"], | |
| "index": hit["index"], | |
| "release_date": hit["release_date"], | |
| "entry_indices": np.array(hit["entry_indices"], dtype=np.uint16), | |
| "template_indices": np.array(hit["template_indices"], dtype=np.uint16), | |
| } | |
| for hit in row["hits"] | |
| ] | |
| transaction.put(row["mapping_key"].encode(), pickle.dumps(hits, protocol=pickle.HIGHEST_PROTOCOL)) | |
| mapping.close() | |
| ``` | |
| Call `rebuild_native_subset(root, subset, output_root, subset in COMPLEX_SUBSETS)` for each subset | |
| and `rebuild_native_templates(root, output_root)` for multimer training, then set AtlasFold's | |
| `train.data.data_root` to `output_root`. | |
| ## License and attribution | |
| AtlasFold's code, weights, and released datasets are distributed under the MIT License | |
| (Copyright (c) 2026 Seonghwan Seo); this conversion keeps that license. The structures come from | |
| upstream resources with their own terms: PDB entries (CC0 1.0), MGnify sequences (CC0 1.0), and the | |
| OpenFold3 training data behind `mgnify_long`, `mgnify_short`, and the `rcsb_multimer` templates | |
| (CC BY 4.0, [OpenFold Consortium](https://registry.opendata.aws/openfold3/)). AtlasFold's | |
| documentation asks users to check the upstream terms before redistribution or commercial use. | |
| ```bibtex | |
| @article{seo2026atlasfold, | |
| author = {Seo, Seonghwan and Kim, Hyeongwoo and Moon, Seokhyun and Kim, Woo Youn and {Team KAIST}}, | |
| title = {AtlasFold: Protein structure prediction with metagenomic-scale language models}, | |
| year = {2026}, | |
| doi = {10.64898/2026.09.04.749352}, | |
| URL = {https://www.biorxiv.org/content/10.64898/2026.09.04.749352v2}, | |
| journal = {bioRxiv} | |
| } | |
| ``` | |
| ## Build record | |
| Converted from the AtlasFold release at commit `444f376d85b9954a5f2f5f3f8b3cbcae1201ebb1` with the `atlasfold_data` | |
| package in [Synthyra/DatasetDev](https://github.com/Synthyra/DatasetDev). | |
| `mgnify_long` could not be downloaded from the release Drive folder because of | |
| Google Drive download quotas, so it was rebuilt from the same source AtlasFold used: the OpenFold3 | |
| AlphaFold2 MGnify predictions on the AWS Registry of Open Data. The rebuild parses each entry's | |
| `best_structure_relaxed.pdb` with AtlasFold's own reader (`scripts/preprocess/af2/a1_process.py`) and | |
| writes the released LMDB and manifest formats. The same procedure reproduced the released `mgnify_short` | |
| exactly: all 430,418 LMDB values byte for byte, `manifest.msgpack` byte for byte, and | |
| the uncompressed `manifest.json.zst` text. | |
| | Subset | Source | SHA-256 | Converted with | | |
| | --- | --- | --- | --- | | |
| | `rcsb` | Drive file `1TEH73v9oxA1oYYnsPZntHqES_04vEz8P` | archive `905b248e1baee4e7e8b7a3536e5596af9c7cbf2c249b30b50fa7c45f5ebd9562` | pyarrow 25.0.1, datasets 4.8.5, NumPy 2.5.3 | | |
| | `rcsb_multimer` | Drive file `1aN9zUL4JokQc0L6AWVUNlsnftQBi8pjr` | archive `c29a7cf85dc9a4ca46523fa65b74e2a19dd382c90d08c2f15a209e86686b682a` | pyarrow 25.0.1, datasets 4.8.5, NumPy 2.5.3 | | |
| | `cameo_val` | Drive file `10fhgH7nnVA022nvN-v3bTg1Xor97t2Ne` | archive `0e9c635b9a1196630d5c540e1a2b5abb718b5325163b9443da2608405629857c` | pyarrow 25.0.1, datasets 4.8.5, NumPy 2.5.3 | | |
| | `rcsb_multimer_val` | Drive file `17meo4uBvvFfB2M-uor17KWwqQDYdSGFI` | archive `be0300ebee91c93b92d9a5ebcd8c1b94c41e26e0261b139607630435ce0f2ac4` | pyarrow 25.0.1, datasets 4.8.5, NumPy 2.5.3 | | |
| | `disordered_pdb_af2` | Drive file `1f79fRsVOK5SloBo-wVYLuAXDyBX5bOTR` | archive `3adc4928e7da6cf22eaed2462bb1728eb914cb307f85703a3524a1ba428c8c69` | pyarrow 25.0.1, datasets 4.8.5, NumPy 2.5.3 | | |
| | `disordered_pdb_afm` | Drive file `1f7pw1T7Bdho3r2P7cT5KTv4AvkY4joqb` | archive `589ea53a7a18cc19d854b75c1c8e398a11487fdc829970431880a26e65d95c10` | pyarrow 25.0.1, datasets 4.8.5, NumPy 2.5.3 | | |
| | `mgnify_short` | Drive file `1VN9XQsd9d5ulsyO4XICXhIMYqqVk7Ag_` | archive `b7da9a2f9ce2453fa57428060e0ab47afe3939a0153dae0cd3cc8adfbccc1879` | pyarrow 25.0.1, datasets 4.8.5, NumPy 2.5.3 | | |
| | `mgnify_long` | rebuilt from `s3://openfold3-data/monomer_distillation_sets_v2/long_monomers/raw/` | entry list `6c9697f29f845180ea37fd795d561c3f67bc179ff4eecc75f0a7f9b5747846b6` | pyarrow 25.0.1, datasets 4.8.5, NumPy 2.5.3 | | |