lhallee commited on
Commit
27a7481
·
verified ·
1 Parent(s): 57a974f

Rewrite the dataset card

Browse files
Files changed (1) hide show
  1. README.md +108 -161
README.md CHANGED
@@ -30,7 +30,6 @@ configs:
30
  path: data/valid-*
31
  - split: test
32
  path: data/test-*
33
-
34
  license: cc-by-4.0
35
  language:
36
  - en
@@ -46,177 +45,125 @@ pretty_name: PLAT (Protein Language Alignment Tuples)
46
  task_categories:
47
  - feature-extraction
48
  - sentence-similarity
49
- - text-classification
 
50
  ---
51
 
52
  # PLAT: Protein Language Alignment Tuples
53
 
54
- `plat_data` is a curated, cluster-split dataset of protein sequences paired with structured functional annotations and natural-language descriptions. It is designed to train and evaluate cross-encoder alignment models (Vec2Vec, Mat2Mat) that map representations between different protein language models (PLMs), or between PLMs and natural-language encoders.
55
-
56
- Each row contains:
57
-
58
- - a protein `sequence` (amino-acid string),
59
- - an `annotation` list of integer IDs covering Gene Ontology, EC numbers, InterPro, Gene3D, cofactors, and UniProt keywords,
60
- - a `description` string assembled from UniProt free-text curation (function, miscellaneous notes, subcellular localization, domain).
61
-
62
- ## Dataset Schema
63
-
64
- | Field | Type | Description |
65
- |---------------|-------------|-------------|
66
- | `sequence` | `string` | Canonical amino-acid sequence in single-letter IUPAC code. |
67
- | `annotation` | `list[int]` | Sorted, deduplicated integer IDs decoded via the `label2id.pkl` vocabulary produced by `data/process_uniprot_av.py`. Each ID corresponds to a typed annotation key of the form `"<value>_<suffix>"` where suffix is one of `bp`, `cc`, `mf`, `ec`, `cofactor`, `ip`, `threed`, `keywords`. |
68
- | `description` | `string` | Structured free-text block beginning with `"The following text describes a protein:"` and containing any present of `Function:`, `Miscellaneous:`, `Subcellular Localization:`, `Domain:` subsections. Every row is guaranteed to contain a `Function:` block (see "Preferential sampling" below). |
69
- | `labels` | `int` | Placeholder column (always `0`), added by `data/add_dummy_labels.py` so downstream `Trainer` pipelines that expect a `labels` key work without modification. |
70
-
71
- ### Splits
72
-
73
- The dataset has three splits: `train`, `valid`, and `test`. Splitting is performed at the cluster level (see "Clustering and splitting" below), so no sequence in `valid` or `test` shares more than ~40% identity with any sequence in `train`.
74
-
75
- ## Data Source
76
-
77
- The primary upstream source is UniProtKB, restricted to entries with manually curated Gene Ontology annotations (the "GO manual" subset). Two snapshots are used:
78
-
79
- - `uniprotkb_go_manual_2025_11_18.tsv.gz` (1,380,840 entries) for structured annotations.
80
- - `uniprotkb_go_manual_2025_12_02.tsv.gz` (1,380,840 entries) for free-text descriptions.
81
-
82
- Columns pulled from the UniProt TSV are:
83
-
84
- | UniProt column | Used for | Parsing |
85
- |----------------|----------|---------|
86
- | `Entry` | record key | verbatim |
87
- | `Sequence` | `sequence` | verbatim |
88
- | `EC number` | annotations | split on `;`, strip |
89
- | `Cofactor` | annotations | parse `Name=<x>` from each `COFACTOR:` entry |
90
- | `Gene Ontology (biological process)` | annotations | extract `GO:xxxxxxx` IDs |
91
- | `Gene Ontology (cellular component)` | annotations | extract `GO:xxxxxxx` IDs |
92
- | `Gene Ontology (molecular function)` | annotations | extract `GO:xxxxxxx` IDs |
93
- | `InterPro` | annotations | split on `;`, drop trailing empty |
94
- | `Gene3D` | annotations | split on `;`, drop trailing empty |
95
- | `Keywords` | annotations | split on `;`, strip |
96
- | `Function [CC]` | description | see text cleaning |
97
- | `Miscellaneous [CC]` | description | see text cleaning |
98
- | `Subcellular location [CC]` | description | see text cleaning |
99
- | `Domain [CC]` | description | see text cleaning |
100
-
101
- ### Annotation vocabulary
102
-
103
- `data/process_uniprot_av.py` streams the UniProt TSV twice. The first pass builds a `label2id` dictionary whose keys are typed strings (e.g. `GO:0016310_bp`, `1.1.1.1_ec`, `IPR000878_ip`, `ATP-binding_keywords`, `K(+)_cofactor`). The second pass emits `camp_data.csv` with columns `[sequence, annotations]`, where `annotations` is the sorted, deduplicated list of integer IDs for that protein. The `label2id.pkl` and `id2label.pkl` files are the authoritative mapping used throughout the pipeline. The resulting table is pushed to the intermediate dataset `lhallee/camp_data_11_2025`.
104
-
105
- ### Description assembly
106
-
107
- `data/process_uniprot_cc.py` builds the free-text description by concatenating the four CC columns in order (`Function`, `Miscellaneous`, `Subcellular location`, `Domain`), each under its own header. Text cleaning removes:
108
-
109
- - `(PubMed:...)` inline citations,
110
- - `{ECO:...}` evidence codes,
111
- - UniProt CC prefixes (`FUNCTION: `, `MISC: `, `SUBCELLULAR LOCATION: `, `DOMAIN: `),
112
- - redundant whitespace and stray punctuation artifacts from the removals above.
113
-
114
- A resulting row looks like:
115
-
116
- ```
117
- The following text describes a protein:
118
- Function:
119
- Catalyzes the reversible conversion of methylmalonyl-CoA to succinyl-CoA...
120
- Subcellular Localization:
121
- Mitochondrial matrix...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  ```
123
 
124
- ## Build Pipeline
125
-
126
- The full pipeline is four stages. All scripts live under [data/](data/) in the source repo.
127
-
128
- ### Stage 1: UniProt ingestion and annotation curation
129
-
130
- - Input: `uniprotkb_go_manual_2025_11_18.tsv.gz` and `uniprotkb_go_manual_2025_12_02.tsv.gz`.
131
- - [data/process_uniprot_av.py](data/process_uniprot_av.py) produces `camp_data.csv` (sequence + integer annotation list) and the `label2id.pkl` / `id2label.pkl` vocabulary files.
132
- - [data/process_uniprot_cc.py](data/process_uniprot_cc.py) produces `seq_descriptions.tsv` (entry + sequence + structured description).
133
 
134
- The sequence-keyed dictionaries `seq_annotation_dict.pkl` and `seq_description_dict.pkl` are later used by the final assembly step to look up annotations and descriptions by exact sequence match.
 
 
 
 
 
135
 
136
- The annotation table is pushed to [lhallee/camp_data_11_2025](https://huggingface.co/datasets/lhallee/camp_data_11_2025) as an intermediate artifact.
137
 
138
- ### Stage 2: Deduplication
139
-
140
- Before clustering, exact-duplicate sequences are removed with `drop_duplicates(subset=['sequence'])` (see [data/build_dataset.py](data/build_dataset.py)).
141
-
142
- ### Stage 3: Clustering and splitting
143
-
144
- Clustering and split assignment are performed by [data/build_dataset.py](data/build_dataset.py):
145
-
146
- - Sequences are written to a FASTA file with integer IDs.
147
- - CD-HIT is invoked inside a Docker container built from the official CD-HIT Dockerfile.
148
- - **Identity threshold: 0.4** (40% sequence identity), word size `-n 5`. This is the threshold actually used for the published PLAT release, as recorded by the cluster filename `output_lhallee_camp_data_11_2025_0.4.clstr`.
149
- - The `.clstr` output is parsed into `cluster_dict: {cluster_id -> [seq_ids]}` and `id_seq_dict: {seq_id -> sequence}`.
150
- - Clusters are shuffled and partitioned:
151
- - **5% valid clusters, 5% test clusters, 90% train clusters.**
152
- - The four working pickles (`cluster_dict.pkl`, `id_seq_dict.pkl`, `final_cluster_dict.pkl`, `seq_annotation_dict.pkl`) are uploaded to an auxiliary private repo for reproducibility.
153
-
154
- Because splits are assigned by cluster, any two sequences in different splits are less than ~40% identical under CD-HIT's greedy incremental clustering, which gives a realistic generalization benchmark for PLM alignment.
155
-
156
- ### Stage 4: PLAT assembly (preferential sampling)
157
-
158
- [data/build_plat_data.py](data/build_plat_data.py) produces the final dataset:
159
-
160
- 1. For each cluster in each split, gather all member sequences.
161
- 2. Keep only sequences for which both an `annotation` and a `description` exist.
162
- 3. Keep only the subset whose `description` contains the literal substring `"Function:"` (that is, sequences with at least a UniProt `Function [CC]` annotation after text cleaning).
163
- 4. Pick one sequence uniformly at random from that subset (seed `42`).
164
- 5. If no candidate survives, **the cluster is skipped entirely**. This biases PLAT toward clusters containing at least one well-characterized member.
165
- 6. The resulting records (`sequence`, `annotation`, `description`) are assembled into a `DatasetDict(train, valid, test)` and pushed to `lhallee/plat_data`.
166
-
167
- A final `labels` column of constant `0` is added by [data/add_dummy_labels.py](data/add_dummy_labels.py) for compatibility with generic `Trainer` pipelines.
168
-
169
- ## Reproducing the Build
170
-
171
- ```bash
172
- # 1. Parse UniProt TSV into annotations + vocabulary
173
- py -m data.process_uniprot_av
174
- # -> camp_data.csv, label2id.pkl, id2label.pkl
175
- # -> pushes lhallee/camp_data_11_2025
176
-
177
- # 2. Parse UniProt TSV into descriptions
178
- py -m data.process_uniprot_cc
179
- # -> seq_descriptions.tsv
180
-
181
- # 3. Cluster with CD-HIT and split by cluster (requires Docker)
182
- py -m data.build_dataset \
183
- --hf_token <token> \
184
- --dataset_path lhallee/camp_data_11_2025 \
185
- --similarity_threshold 0.4 \
186
- --n 5 \
187
- --valid_percentage 0.05 \
188
- --test_percentage 0.05
189
-
190
- # 4. Assemble PLAT with preferential Function-aware sampling
191
- py -m data.build_plat_data \
192
- --hf_token <token> \
193
- --repo_name lhallee/plat_data \
194
- --seed 42
195
- ```
196
-
197
- ## Intended Use
198
-
199
- PLAT was constructed to train and evaluate representation-alignment models:
200
-
201
- - **Vec2Vec**: align pooled (mean + variance) embeddings from one PLM to another, or from a PLM to a natural-language encoder of the `description` field.
202
- - **Mat2Mat**: align full residue-by-residue embedding matrices between two PLMs.
203
- - **Cross-modal retrieval**: use the `description` column with a text encoder (for example ModernBERT or GPT-OSS) and the `sequence` column with a PLM (for example ESMC-600), then evaluate whether aligned embeddings retrieve each other.
204
-
205
- Typical consumption patterns in the source repo read columns as `(sequence, sequence)`, `(sequence, description)`, or `(description, description)` pairs.
206
-
207
- ## Licensing and Attribution
208
-
209
- All sequences and annotations are derived from UniProtKB and are redistributed under the UniProt terms of use (Creative Commons Attribution 4.0, `CC BY 4.0`). If you use PLAT, please also cite UniProt:
210
 
211
  > The UniProt Consortium. UniProt: the Universal Protein Knowledgebase in 2025. *Nucleic Acids Research*, 2025.
212
 
213
- And the dependent databases surfaced in the annotation vocabulary: Gene Ontology, Enzyme Commission (IUBMB), InterPro, Gene3D, and the UniProt Keyword ontology.
214
-
215
- ## Known Limitations
216
 
217
- - **Manual-annotation bias.** Only UniProt entries with manually curated GO terms are considered, and only clusters containing at least one member with a `Function [CC]` block appear in the final dataset. Taxa and protein families that are underrepresented in Swiss-Prot are correspondingly underrepresented here.
218
- - **One representative per cluster.** Within-cluster diversity (paralogs, species variants) is not preserved: each cluster contributes a single randomly chosen, function-annotated representative.
219
- - **Descriptions are post-processed.** PubMed citations, ECO evidence codes, and the CC-prefix tags are stripped, which simplifies downstream tokenization but loses provenance information relative to the raw UniProt text.
220
- - **Integer annotation labels are only meaningful via `label2id.pkl`.** The integer space mixes eight annotation types; training code that treats it as a single flat multi-label target should be aware that different IDs correspond to semantically different taxonomies.
221
- - **Snapshot-frozen.** PLAT is built from a fixed UniProt release (manual-GO subset, November-December 2025) and will not reflect later curation updates until rebuilt.
222
 
 
 
 
 
 
 
30
  path: data/valid-*
31
  - split: test
32
  path: data/test-*
 
33
  license: cc-by-4.0
34
  language:
35
  - en
 
45
  task_categories:
46
  - feature-extraction
47
  - sentence-similarity
48
+ size_categories:
49
+ - 10K<n<100K
50
  ---
51
 
52
  # PLAT: Protein Language Alignment Tuples
53
 
54
+ Every row of PLAT describes one protein three ways: its amino acid sequence, the typed functional
55
+ annotations UniProt curators gave it, and the free text they wrote about it. The three views share no
56
+ input, so PLAT is a test bed for asking whether the embedding spaces of protein language models,
57
+ annotation encoders and text encoders can be aligned or translated into one another. It holds 67,402
58
+ UniProtKB proteins with curated GO terms, one function-annotated representative per 40% identity cluster, split by
59
+ cluster into train, validation and test. It was built for the Gleghorn Lab's study of embedding
60
+ translation between protein representation spaces, whose frozen embeddings of these rows are in
61
+ [GleghornLab/vec2vec_embeddings](https://huggingface.co/datasets/GleghornLab/vec2vec_embeddings).
62
+
63
+ | | |
64
+ |---|---|
65
+ | Task | Cross-view alignment and retrieval: sequence, annotation, description |
66
+ | Rows | 60,666 train, 3,316 valid, 3,420 test |
67
+ | Homology | Clustered at 40% identity before the split; not disjoint under a stricter later screen (below) |
68
+ | Source | UniProtKB entries with manually curated GO terms, release 2025_04 |
69
+ | Licence | CC BY 4.0 |
70
+
71
+ ## Homology leakage
72
+
73
+ **Intended: 40% identity, by cluster.** Proteins were clustered with CD-HIT at 40% identity and whole
74
+ clusters were assigned to one split, so no sequence appears in two splits.
75
+
76
+ **Measured afterwards: not homology-disjoint.** CD-HIT's greedy clustering does not guarantee that
77
+ members of different clusters fall below the threshold, and the cluster assignment was not kept. A
78
+ later screen with CD-HIT-2D, counting a pair when it reached 40% global identity over at least 80% of
79
+ both sequences, found:
80
+
81
+ | Held-out split | Proteins with a qualifying neighbor | Share |
82
+ |---|---|---|
83
+ | valid, in train | 423 of 3,316 | 12.76% |
84
+ | test, in train | 430 of 3,420 | 12.57% |
85
+ | test, in valid | 50 of 3,420 | 1.46% |
86
+ | test, in train or valid | 454 of 3,420 | 13.27% |
87
+
88
+ No exact sequence is shared between splits. For a strictly remote-homology evaluation, drop the 454
89
+ test proteins with a neighbor, or recluster.
90
+
91
+ ## How it was built
92
+
93
+ 1. Read the UniProtKB entries with manually curated GO annotations, exported on 18 November 2025 (for
94
+ annotations) and 2 December 2025 (for free text) from release 2025_04; 1,380,840 entries each.
95
+ 2. Built the typed annotation list of each entry from eight fields: GO biological process, cellular
96
+ component and molecular function, EC number, cofactor, InterPro, Gene3D and UniProt keywords. Each
97
+ term became a typed key such as `GO:0016310_bp` or `1.1.1.1_ec`, and each key an integer id.
98
+ 3. Built the description of each entry from the Function, Miscellaneous, Subcellular location and
99
+ Domain comments, each under its own header, with PubMed citations, ECO evidence codes and the
100
+ comment prefixes removed.
101
+ 4. Removed exact duplicate sequences.
102
+ 5. Clustered the sequences with CD-HIT at 40% identity (word size 5) and assigned whole clusters to
103
+ train, validation and test in the proportions 90, 5 and 5, after a shuffle.
104
+ 6. From each cluster, kept the members that had both annotations and a description containing
105
+ Function text, and drew one of them at random (seed 42). A cluster with no such member was dropped,
106
+ so PLAT leans toward well characterized families.
107
+ 7. Added a constant `labels` column so generic training loops that expect one run unchanged.
108
+
109
+ ## Columns
110
+
111
+ | Column | Type | What it is |
112
+ |---|---|---|
113
+ | `sequence` | string | Canonical amino acid sequence, single-letter code; median length 403, longest 8,923 |
114
+ | `annotation` | list of int | Sorted, deduplicated typed annotation ids; median 18 per protein, 56,868 distinct ids in use |
115
+ | `description` | string | UniProt curator text under `Function:` and, when present, `Miscellaneous:`, `Subcellular Localization:` and `Domain:` headers; median 339 characters |
116
+ | `labels` | int | Always 0; a placeholder, not a label |
117
+
118
+ The integer ids index the Annotation Vocabulary (Hallee et al., 2024), here built from this UniProt
119
+ release with about 88,000 typed keys across the eight annotation types. The id to key mapping is not
120
+ yet published with this dataset.
121
+
122
+ ## Example rows
123
+
124
+ From the test split, sequences and lists shortened.
125
+
126
+ | sequence | annotation | description |
127
+ |---|---|---|
128
+ | `MDKKEILKEFSADPDKYYNV...` (889 aa) | 31 ids: 6315, 8144, 24978, ... | Function: Catalyzes the attachment of alanine to tRNA(Ala) in a two-step reaction... |
129
+ | `MSHQTGIKGNVELISFFGKC...` (344 aa) | 18 ids: 9957, 10213, 11596, ... | Function: Actin-binding protein involved in motile and morphological processes. Inhibits actin polymerization... Subcellular Localization: Cytoplasm, cell cortex. Cytoplasm, cytoskeleton. |
130
+ | `MTISMISPSSIRLSSDKRDS...` (410 aa) | 23 ids: 9619, 15796, 18993, ... | Function: Promotes excretion of zinc from intestinal cells into the intestinal lumen in response to increased dietary zinc... |
131
+
132
+ ```python
133
+ from datasets import load_dataset
134
+
135
+ plat = load_dataset("GleghornLab/plat_data")
136
+ row = plat["test"][0]
137
+ row["sequence"], row["annotation"], row["description"]
138
  ```
139
 
140
+ ## What a model trained on it may say
 
 
 
 
 
 
 
 
141
 
142
+ A model trained on PLAT maps one view of a protein to another: a sequence embedding to an annotation or
143
+ description embedding, or back. A good retrieval score says the views of the same protein can be found
144
+ from each other among held-out proteins. It does not say the model understands protein function: a
145
+ sequence-only control can retrieve well through shared input alone, and about one held-out protein in
146
+ eight has a close relative in train. Every protein has curated GO terms and Function text, so the
147
+ dataset says little about poorly characterized proteins.
148
 
149
+ ## Sources and licence
150
 
151
+ All sequences, annotations and descriptions come from
152
+ [UniProtKB](https://www.uniprot.org), redistributed under its
153
+ [CC BY 4.0 licence](https://www.uniprot.org/help/license). The annotation types draw on the Gene
154
+ Ontology, the IUBMB Enzyme Commission, InterPro, CATH-Gene3D and the UniProt keywords. If you use PLAT,
155
+ please cite UniProt:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
 
157
  > The UniProt Consortium. UniProt: the Universal Protein Knowledgebase in 2025. *Nucleic Acids Research*, 2025.
158
 
159
+ Limits worth knowing: only entries with manually curated GO terms were read, so taxa that curators have
160
+ studied little are thin here; each cluster contributes one protein, so paralogs and species variants are absent; the
161
+ descriptions lose their citations and evidence codes; and the data reflect one UniProt release.
162
 
163
+ ## Files
 
 
 
 
164
 
165
+ | File | What it is |
166
+ |---|---|
167
+ | `data/train-00000-of-00001.parquet` | 60,666 training rows |
168
+ | `data/valid-00000-of-00001.parquet` | 3,316 validation rows |
169
+ | `data/test-00000-of-00001.parquet` | 3,420 test rows |