STRING / README.md
anindya64's picture
Add files using upload-large-folder tool
fcbea81 verified
metadata
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:

python -m pip install datasets

Load the interaction table in streaming mode:

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:

from datasets import load_dataset

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

Load local Parquet files generated before upload:

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:

python -m pip install -r requirements.txt

Create the full Parquet dataset using 32 worker processes:

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:

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:

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

Validate after upload:

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:

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:

@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}
}