File size: 6,782 Bytes
12c61b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
---
license: cc-by-4.0
pretty_name: ProteinChameleon Structure–Function Dataset
language:
- en
size_categories:
- 100K<n<1M
task_categories:
- text-generation
tags:
- protein
- biology
- protein-structure
- protein-function
- structure-tokens
- geobpe
- multimodal
configs:
- config_name: alignment
  data_files:
  - split: train
    path: alignment/train.parquet
  - split: validation
    path: alignment/val.parquet
  - split: test
    path: alignment/test.parquet
- config_name: interleaved
  data_files:
  - split: train
    path: interleaved/train.parquet
  - split: validation
    path: interleaved/val.parquet
  - split: test
    path: interleaved/test.parquet
---

# ProteinChameleon Structure–Function Dataset

A leakage-free protein dataset pairing **3D-structure tokens** and amino-acid
sequences with **natural-language function descriptions**. It was built to train and
evaluate [ProteinChameleon](https://github.com/), an early-fusion protein–text model
that ingests discrete structure tokens alongside sequence. Structure is encoded with
**GeoBPE**, a geometric byte-pair tokenizer that turns a protein's 3D backbone into a
sequence of ~2,100 discrete tokens (merged multi-residue structural motifs plus
quantized dihedral/angle bins).

The distinguishing feature of this release is its **split protocol**: train / validation
/ test are separated by *connected components* over both sequence homology and function
text, so the test set measures genuine generalization rather than near-neighbor recall.

## Configurations

| Config | Task | Train | Validation | Test |
|---|---|---:|---:|---:|
| `alignment` | structure + sequence → function text | 243,127 | 13,504 | 13,506 |
| `interleaved` | multimodal protein narratives (domain-segmented) | 63,117 | 4,303 | 4,206 |

### `alignment` fields
| Field | Type | Description |
|---|---|---|
| `accession` | string | UniProt accession |
| `organism` | string | Source organism |
| `sequence` | string | Amino-acid sequence |
| `function_text` | string | Curated natural-language function description |
| `structure_tokens` | list[int] | GeoBPE structure token IDs for the protein's 3D backbone |

### `interleaved` fields
| Field | Type | Description |
|---|---|---|
| `accession` | string | UniProt accession |
| `organism` | string | Source organism |
| `sequence` | string | Amino-acid sequence |
| `narrative` | string | Multimodal narrative interleaving text with domain-level context |
| `n_domains` | int | Number of annotated domains in the narrative |

## Usage

```python
from datasets import load_dataset

# structure -> function
ds = load_dataset("<your-username>/proteinchameleon-structure-function", "alignment")
print(ds["test"][0]["function_text"])
print(ds["test"][0]["structure_tokens"][:16])

# multimodal narratives
di = load_dataset("<your-username>/proteinchameleon-structure-function", "interleaved")
```

The original NumPy artifacts are also included under [`raw/`](./raw) for exact
reproducibility (`np.load(..., allow_pickle=True)`).

## Data Collection & Curation

### Sources
- **Sequences & function annotations** — [UniProtKB / Swiss-Prot](https://www.uniprot.org)
  (manually reviewed entries). `function_text` is derived from curated UniProt function
  annotations; `organism` and `accession` are taken directly from the entry.
- **3D structures** — [AlphaFold Protein Structure Database](https://alphafold.ebi.ac.uk),
  tokenized with **GeoBPE**. Each backbone is quantized into geometric tokens and merged
  into structural-motif tokens, yielding the `structure_tokens` sequence.

### Leakage-free split protocol
Naïve per-accession splits leak badly, because protein databases are highly redundant and
UniProt function text is shared verbatim across orthologs. Measured on the original splits:

- **Homology leakage** — 94% of test proteins had a ≥30%-identity homolog in train/val.
- **Function-text leakage** — 79% of test function descriptions appeared verbatim in train.
- **Cross-task leakage** — 91% of the interleaved-test proteins also appeared in
  alignment-train (the two tasks were split independently but trained jointly).

To remove all three, the splits in this release (`clean2`) are built as follows:

1. **Union of both tasks.** Pool every protein appearing in either the alignment or
   interleaved task into a single set.
2. **Homology graph.** Cluster all sequences with **MMseqs2** at **30% sequence identity**
   and **80% coverage** (`mmseqs easy-cluster --min-seq-id 0.3 -c 0.8`). Add an edge
   between any two proteins in the same cluster.
3. **Function-text graph.** Add an edge between any two proteins that share an *identical*
   function description.
4. **Connected components.** Take connected components of the combined graph (union-find).
   Homologous proteins and proteins sharing boilerplate function text therefore always fall
   in the same component.
5. **Component-level assignment.** Assign whole components to train / validation / test
   (~90 / 5 / 5%), so no protein — and no close homolog or shared description — ever
   crosses the split boundary. The **same assignment is applied to both tasks**, eliminating
   cross-task leakage.

A machine-readable `split_manifest_clean2.json` and the per-protein
`split_assignment_clean2.json` are included under `raw/` for auditing.

### Verification
After construction, the splits were re-checked for all three leakage channels; homology,
function-text, and cross-task overlap between test and train/val are driven to **zero**
under the 30%-identity criterion.

## Limitations & Intended Use
- `structure_tokens` are **GeoBPE codes**, not 3D coordinates; they are only meaningful with
  a model trained on the same GeoBPE vocabulary. They are not interchangeable with other
  structure-token schemes (e.g. Foldseek 3Di, ESM3 structure tokens).
- Function text is curated prose and may contain UniProt-style boilerplate; it is intended
  for conditional generation / understanding, not as a controlled ontology (use the EC/CATH
  ontologies for label-based tasks).
- The dataset reflects the coverage and biases of Swiss-Prot and AlphaFold DB.

## License & Attribution
Released under **CC-BY-4.0**, consistent with the source databases. If you use this dataset,
please attribute the underlying resources:
- The UniProt Consortium, *UniProt: the Universal Protein Knowledgebase* (CC-BY-4.0).
- Varadi et al., *AlphaFold Protein Structure Database* (CC-BY-4.0).

## Citation
```bibtex
@misc{proteinchameleon_dataset,
  title  = {ProteinChameleon Structure--Function Dataset},
  author = {Steven},
  year   = {2026},
  note   = {Leakage-free structure-token / function-text splits derived from
            UniProt/Swiss-Prot and AlphaFold DB via GeoBPE tokenization}
}
```