NCBI / README.md
anindya64's picture
Update README.md
62e0e8f verified
|
Raw
History Blame Contribute Delete
5.87 kB
metadata
pretty_name: NCBI RefSeq Protein Shard Index
license: other
tags:
  - biology
  - proteins
  - sequences
  - fasta
  - ncbi
  - refseq
  - parquet
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*.parquet
      - split: test
        path: data/test-*.parquet

NCBI RefSeq Protein Shard Index

The RefSeq protein database is the protein subset of NCBI's broader Reference Sequence collection, a curated non-redundant set of genomic, transcript, and protein sequences spanning the tree of life. Protein records are produced through a combination of expert curation, the NCBI Eukaryotic and Prokaryotic Genome Annotation pipelines, and propagation from collaborating resources, and are cross-linked to their source genome and transcript records. RefSeq protein accessions use prefixed identifiers (NP_ for curated, XP_ for predicted, WP_ for non-redundant prokaryotic proteins, YP_ for organelle and viral proteins) so that downstream tools can distinguish curation status at a glance.

Splits

The split is deterministic by file ID: sha256(file_id) % 10. Bucket 0 is test; buckets 1 through 9 are train.

Split Rows
train 4,676
test 502
total 5,178

Source Statistics

Field Value
Source FASTA files 1,725
RefSeq protein records 459,415,871
Residues 179,203,453,293
Sequence shards 1,725
Compressed sequence shard bytes 78,108,688,857
Metadata JSONL bytes 158,533,041,909

Usage

pip install datasets

Load the shard index:

from datasets import load_dataset

ds = load_dataset("LiteFold/NCBI")
print(ds)
print(ds["train"][0])

Load one split:

from datasets import load_dataset

train = load_dataset("LiteFold/NCBI", split="train")
test = load_dataset("LiteFold/NCBI", split="test")

List sequence shards:

from datasets import load_dataset

index = load_dataset("LiteFold/NCBI", split="train")
shards = index.filter(lambda row: row["is_sequence_shard"])
print(shards[0]["path"])

Find a source FASTA and its files:

from datasets import load_dataset

index = load_dataset("LiteFold/NCBI", split="train")
rows = index.filter(lambda row: row["source_file"] == "sequence/ncbi_refseq/release_complete/complete.1486.protein.faa.gz")
for row in rows:
    print(row["role"], row["path"], row["size_bytes"])

Download all sequence shards:

hf download LiteFold/NCBI --repo-type dataset \
  --include 'sequences/*/shard-*.fasta.zst' \
  --local-dir ./ncbi_refseq_protein

Download one source shard:

hf download LiteFold/NCBI --repo-type dataset \
  --include 'sequences/sequence_ncbi_refseq_release_complete_complete.1486.protein.faa.gz/shard-*.fasta.zst' \
  --local-dir ./ncbi_refseq_protein

Stream a downloaded shard with Python:

from pathlib import Path
import zstandard as zstd

shard = next(Path("./ncbi_refseq_protein").rglob("shard-*.fasta.zst"))
dctx = zstd.ZstdDecompressor()
with shard.open("rb") as f, dctx.stream_reader(f) as reader:
    print(reader.read(1024).decode("utf-8", errors="replace"))

Columns

Column Description
file_id Stable row ID, equal to the repository path.
repo_id Hugging Face dataset repository.
source_sha Source repository commit used to build the index.
dataset_id Source dataset identifier from the manifest.
source_slug Source slug from the original pipeline manifest.
source_file Original source FASTA file path.
path File path in the repository.
role File role, such as sequence_shard, metadata_records, or source_manifest.
shard_index Numeric shard index for sequence shards.
size_bytes File size in bytes.
compression Compression format, when applicable.
records_in_source Protein record count for the source FASTA file.
residues_in_source Residue count for the source FASTA file.
shards_in_source Shard count for the source FASTA file.
records_total Total protein record count from the aggregate manifest.
residues_total Total residue count from the aggregate manifest.
total_shards Total sequence shard count.
is_sequence_shard Whether the row points to a FASTA shard.
is_metadata_records Whether the row points to a per-record metadata JSONL.
download_pattern Recommended path or glob for downloading.
access_note Note describing the index scope.
split_bucket Deterministic split bucket from sha256(file_id) % 10.

Preparation

The normalization script used to create the Parquet files is included at scripts/prepare_ncbi_dataset.py.

Citation

@article{goldfarb2025refseq,
  title     = {{NCBI RefSeq}: reference sequence standards through 25 years of curation and annotation},
  author    = {Goldfarb, Tamara and Kodali, Vamsi K. and Pujar, Shashikant and Brover, Vyacheslav and Robbertse, Barbara and Farrell, Catherine M. and Oh, Dong-Ha and Astashyn, Alexander and Ermolaeva, Olga and Haddad, Diana and Hlavina, Wratko and Hoffman, Jinna and Jackson, John D. and Joardar, Vinita S. and Kristensen, David and Masterson, Patrick and McGarvey, Kelly M. and McVeigh, Richard and Mozes, Eyal and Murphy, Michael R. and Schafer, Susan S. and Souvorov, Alexander and Spurrier, Brett and Strope, Pooja K. and Sun, Hanzhen and Vatsan, Anjana R. and Wallin, Craig and Webb, David and Brister, J. Rodney and Hatcher, Eneida and Kimchi, Avi and Klimke, William and Marchler-Bauer, Aron and Pruitt, Kim D. and Thibaud-Nissen, Fran{\c{c}}oise and Murphy, Terence D.},
  journal   = {Nucleic Acids Research},
  volume    = {53},
  number    = {D1},
  pages     = {D243--D257},
  year      = {2025},
  publisher = {Oxford University Press},
  doi       = {10.1093/nar/gkae1038}
}