UniProtKB / README.md
anindya64's picture
Use JSONL default file index for UniProtKB
ce01506 verified
---
license: cc-by-4.0
pretty_name: UniProtKB Processed
size_categories:
- 100M<n<1B
task_categories:
- feature-extraction
language:
- en
tags:
- biology
- proteins
- uniprot
- uniprotkb
- swiss-prot
- trembl
- protein-sequences
- bioinformatics
- train-validation-test-split
- jsonl
configs:
- config_name: default
data_files:
- split: train
path:
- data/train-*.jsonl.gz
- split: test
path:
- data/test-*.jsonl.gz
- config_name: sprot
data_files:
- split: train
path:
- tables/source_set=sprot/split=train/*.jsonl.gz
- split: validation
path:
- tables/source_set=sprot/split=validation/*.jsonl.gz
- split: test
path:
- tables/source_set=sprot/split=test/*.jsonl.gz
- config_name: sprot_varsplic
data_files:
- split: train
path:
- tables/source_set=sprot_varsplic/split=train/*.jsonl.gz
- split: validation
path:
- tables/source_set=sprot_varsplic/split=validation/*.jsonl.gz
- split: test
path:
- tables/source_set=sprot_varsplic/split=test/*.jsonl.gz
- config_name: trembl
data_files:
- split: train
path:
- tables/source_set=trembl/split=train/*.jsonl.gz
- split: validation
path:
- tables/source_set=trembl/split=validation/*.jsonl.gz
- split: test
path:
- tables/source_set=trembl/split=test/*.jsonl.gz
---
# UniProtKB Processed
This repository contains two useful views of LiteFold/UniProtKB:
- `default`: a compact JSONL file/table shard index that is easy to browse in the Hugging Face Dataset Viewer.
- `sprot`, `sprot_varsplic`, and `trembl`: the full parsed UniProtKB protein-entry tables from the original repository.
The `default` config does not duplicate all 203M protein rows. It indexes the repository files, table shards, source sets, source sizes, and split-level row counts so the dataset has a stable table preview while the full source-specific tables remain available through named configs.
## Dataset Summary
| Source set | Description | Protein records |
|---|---|---:|
| `sprot` | Swiss-Prot reviewed canonical proteins | 574,627 |
| `sprot_varsplic` | Swiss-Prot alternative isoform sequences | 41,333 |
| `trembl` | TrEMBL unreviewed proteins | 202,556,314 |
| **Total** | | **203,172,274** |
Additional source totals:
| Metric | Value |
|---|---:|
| Total residues | 75,747,523,712 |
| Sequence shards | 205 |
| Protein-entry table shards | 615 |
| Default index rows | 830 |
| Sequence shard bytes | 46,504,287,641 |
| Metadata records bytes | 74,373,082,266 |
| Protein-entry table bytes | 18,549,213,567 |
## Default Index Splits
The default Dataset Viewer index is split deterministically by `sha256(file_id) % 10`: bucket `0` is `test`, and buckets `1` through `9` are `train`.
| Split | Rows |
|---|---:|
| `train` | 733 |
| `test` | 97 |
## Protein-Entry Splits
The full protein-entry tables use deterministic exact-sequence hash splits. Exact duplicate amino-acid sequences are kept in the same split.
| Split | Protein records |
|---|---:|
| `train` | 162,548,965 |
| `validation` | 20,308,533 |
| `test` | 20,314,776 |
These are exact-sequence splits, not homology-cluster splits. For strict homology-aware model evaluation, create an additional split using UniRef, MMseqs, or another sequence-clustering method.
## Loading With `datasets`
Load the default file/table index:
```python
from datasets import load_dataset
index = load_dataset("LiteFold/UniProtKB")
print(index)
print(index["train"][0])
```
Load Swiss-Prot reviewed protein entries:
```python
from datasets import load_dataset
sprot = load_dataset("LiteFold/UniProtKB", "sprot")
train = sprot["train"]
valid = sprot["validation"]
test = sprot["test"]
```
Load Swiss-Prot alternative isoform entries:
```python
from datasets import load_dataset
isoforms = load_dataset("LiteFold/UniProtKB", "sprot_varsplic")
```
Stream TrEMBL entries:
```python
from datasets import load_dataset
rows = load_dataset("LiteFold/UniProtKB", "trembl", split="train", streaming=True)
for row in rows:
print(row["accession"], row["protein_name"])
break
```
Use the default index to discover table shards:
```python
from datasets import load_dataset
index = load_dataset("LiteFold/UniProtKB", split="train")
trembl_train_shards = index.filter(
lambda row: row["role"] == "protein_entry_table_shard"
and row["source_set"] == "trembl"
and row["table_split"] == "train"
)
print(trembl_train_shards[0]["path"])
```
## Default Columns
| Column | Type | Description |
|---|---|---|
| `file_id` | string | Stable file identifier, currently the repository path. |
| `repo_id` | string | Hugging Face dataset repository id. |
| `source_sha` | string | Source repository commit used to build the index. |
| `dataset_id` | string | Source dataset id from `_MANIFEST.json`. |
| `source_set` | string | `sprot`, `sprot_varsplic`, `trembl`, or empty for repository-level files. |
| `source_slug` | string | Source file slug used in the original manifests. |
| `source_file` | string | Original source file path. |
| `path` | string | Path in this Hugging Face repository. |
| `role` | string | File role such as `protein_entry_table_shard`, `sequence_shard`, or `metadata_records`. |
| `table_split` | string | Protein-entry split for table shards. |
| `shard_index` | int64 | Parsed shard index when present, otherwise `-1`. |
| `size_bytes` | int64 | File size in bytes. |
| `compression` | string | Compression format when applicable. |
| `records_in_source` | int64 | Protein records in the source set, otherwise `-1`. |
| `residues_in_source` | int64 | Residues in the source set, otherwise `-1`. |
| `shards_in_source` | int64 | Number of sequence shards in the source set, otherwise `-1`. |
| `records_in_table_split` | int64 | Protein records in that source set and split, otherwise `-1`. |
| `records_total` | int64 | Total protein records across UniProtKB. |
| `residues_total` | int64 | Total residues across UniProtKB. |
| `total_sequence_shards` | int64 | Total sequence shards. |
| `is_sequence_shard` | bool | Whether the row points to a FASTA sequence shard. |
| `is_table_shard` | bool | Whether the row points to a parsed protein-entry table shard. |
| `is_metadata_records` | bool | Whether the row points to metadata records. |
| `download_pattern` | string | Glob or exact path that can be used for file downloads. |
| `access_note` | string | Short note describing how to load the row's data. |
| `split_bucket` | int64 | Deterministic bucket used for the default train/test split. |
## Files
- `data/*.jsonl.gz`: default file/table index for Dataset Viewer.
- `tables/source_set=*/split=*/*.jsonl.gz`: full parsed protein-entry tables.
- `sequences/*/*.fasta.zst`: compressed source sequence shards.
- `metadata/*.records.jsonl`: source metadata records.
- `_MANIFEST.json`: source sequence manifest.
- `_POSTPROCESS_MANIFEST.json`: table-generation manifest.
- `dataset_summary.json`: summary of the default index build.
- `scripts/prepare_uniprotkb_dataset.py`: script used to generate the default index.
## License
CC BY 4.0.
## Citation
If you use the UniProtKB records, cite UniProt:
The UniProt Consortium. UniProt: the Universal Protein Knowledgebase in 2023. Nucleic Acids Research, 51(D1):D523-D531, 2023.