File size: 6,400 Bytes
fcbea81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
---
license: cc-by-4.0
pretty_name: STRING v12.0
tags:
- biology
- proteomics
- protein-protein-interaction
- graph
- string-db
configs:
- config_name: protein_links
  data_files:
  - split: train
    path: "data/protein_links/train-*.parquet"
  - split: validation
    path: "data/protein_links/validation-*.parquet"
  - split: test
    path: "data/protein_links/test-*.parquet"
- config_name: protein_info
  data_files:
  - split: train
    path: "data/protein_info/train-*.parquet"
  - split: validation
    path: "data/protein_info/validation-*.parquet"
  - split: test
    path: "data/protein_info/test-*.parquet"
- config_name: protein_aliases
  data_files:
  - split: train
    path: "data/protein_aliases/train-*.parquet"
  - split: validation
    path: "data/protein_aliases/validation-*.parquet"
  - split: test
    path: "data/protein_aliases/test-*.parquet"
- config_name: protein_sequences
  data_files:
  - split: train
    path: "data/protein_sequences/train-*.parquet"
  - split: validation
    path: "data/protein_sequences/validation-*.parquet"
  - split: test
    path: "data/protein_sequences/test-*.parquet"
- config_name: species
  data_files:
  - split: train
    path: "data/species/train-*.parquet"
  - split: validation
    path: "data/species/validation-*.parquet"
  - split: test
    path: "data/species/test-*.parquet"
---

# STRING v12.0

This repository contains a Hugging Face-friendly packaging of the STRING v12.0 bulk download. STRING is a database of known and predicted protein associations. The raw files are kept under `v12.0/`; the scripts in `scripts/` convert them into sharded Parquet files under `data/` so the Hugging Face Data Viewer can show tables and `datasets.load_dataset` can stream or download the data.

STRING v12.0 reports 59,309,604 proteins from 12,535 organisms and 27,541,372,833 interactions. The upstream data and download files are distributed under Creative Commons BY 4.0; credit STRING and describe any modifications when using this processed version.

## Configs

| Config | Raw source | Description |
| --- | --- | --- |
| `protein_links` | `protein.links.full.v12.0.txt.gz` | Protein-protein association edges with all STRING evidence channels and `combined_score`. |
| `protein_info` | `protein.info.v12.0.txt.gz` | Protein identifiers, preferred names, sizes, and annotations. |
| `protein_aliases` | `protein.aliases.v12.0.txt.gz` | External aliases and identifier sources for STRING proteins. |
| `protein_sequences` | `protein.sequences.v12.0.fa.gz` | Protein amino-acid sequences parsed from FASTA. |
| `species` | `species.v12.0.txt` | Organism metadata: taxonomy id, STRING type, compact name, official NCBI name, and domain. |

## Splits

The post-processing script assigns rows to `train`, `validation`, and `test` with a deterministic CRC32 hash. The default ratios are 98/1/1. Re-running with the same `--split-seed` gives the same split assignment.

Split keys:

| Config | Split key |
| --- | --- |
| `protein_links` | `protein1 + protein2` |
| `protein_info` | `string_protein_id` |
| `protein_aliases` | `string_protein_id + alias + source` |
| `protein_sequences` | `string_protein_id` |
| `species` | `taxon_id` |

## Usage

Install the client library:

```bash
python -m pip install datasets
```

Load the interaction table in streaming mode:

```python
from datasets import load_dataset

links = load_dataset("LiteFold/STRING", "protein_links", split="train", streaming=True)
first_row = next(iter(links))
print(first_row)
```

Load a smaller metadata table normally:

```python
from datasets import load_dataset

proteins = load_dataset("LiteFold/STRING", "protein_info", split="train")
print(proteins[0])
```

Load local Parquet files generated before upload:

```python
from datasets import load_dataset

data_files = {
    "train": "data/protein_links/train-*.parquet",
    "validation": "data/protein_links/validation-*.parquet",
    "test": "data/protein_links/test-*.parquet",
}
links = load_dataset("parquet", data_files=data_files, split="train", streaming=True)
```

## Post-processing

Install conversion dependencies:

```bash
python -m pip install -r requirements.txt
```

Create the full Parquet dataset using 32 worker processes:

```bash
python scripts/prepare_hf_dataset.py \
  --raw-dir v12.0 \
  --output-dir data \
  --num-proc 32 \
  --overwrite
```

Create a quick preview dataset before running the full conversion:

```bash
python scripts/prepare_hf_dataset.py \
  --raw-dir v12.0 \
  --output-dir data_preview \
  --tables species,protein_info,protein_links \
  --max-rows-per-table 10000 \
  --num-proc 32 \
  --overwrite
```

Useful options:

| Option | Purpose |
| --- | --- |
| `--num-proc 32` | Uses 32 parser workers. |
| `--rows-per-chunk 100000` | Controls rows parsed per worker task. Lower this if memory is tight. |
| `--max-in-flight 32` | Bounds queued chunks to avoid unbounded RAM growth. Defaults to `--num-proc`. |
| `--link-min-combined-score 700` | Optionally keep only higher-confidence links. |
| `--compression zstd` | Writes compressed Parquet shards. |

Validate generated local files:

```bash
python scripts/validate_hf_dataset.py --data-dir data --config protein_links --split train --streaming
```

Validate after upload:

```bash
python scripts/validate_hf_dataset.py --repo-id LiteFold/STRING --config protein_links --split train --streaming
```

## Upload

After generating `data/`, upload the processed files and this dataset card:

```bash
huggingface-cli upload LiteFold/STRING README.md README.md --repo-type dataset
huggingface-cli upload LiteFold/STRING data data --repo-type dataset
```

The repository already tracks `*.parquet` with Git LFS through `.gitattributes`.

## Citation

Please cite the upstream STRING database:

```bibtex
@article{szklarczyk2023string,
  title = {The STRING database in 2023: protein-protein association networks and functional enrichment analyses for any sequenced genome of interest},
  author = {Szklarczyk, Damian and Kirsch, Rebecca and Koutrouli, Mikaela and Nastou, Katerina and Mehryary, Farrokh and Hachilif, Radja and Gable, Annika L. and Fang, Tao and Doncheva, Nadezhda T. and Pyysalo, Sampo and Bork, Peer and Jensen, Lars J. and von Mering, Christian},
  journal = {Nucleic Acids Research},
  volume = {51},
  number = {D1},
  pages = {D638--D646},
  year = {2023},
  doi = {10.1093/nar/gkac1000}
}
```