File size: 5,870 Bytes
bb4cbe0
c964bc2
bb4cbe0
 
c964bc2
 
 
 
 
 
 
 
 
 
 
 
 
 
bb4cbe0
 
c964bc2
bb4cbe0
62e0e8f
bb4cbe0
c964bc2
bb4cbe0
c964bc2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bb4cbe0
c964bc2
 
bb4cbe0
c964bc2
 
 
bb4cbe0
c964bc2
 
 
 
 
 
 
 
 
 
bb4cbe0
 
c964bc2
bb4cbe0
c964bc2
 
 
 
 
bb4cbe0
c964bc2
bb4cbe0
 
 
c964bc2
bb4cbe0
 
 
c964bc2
bb4cbe0
 
 
 
 
c964bc2
bb4cbe0
c964bc2
 
bb4cbe0
 
c964bc2
bb4cbe0
c964bc2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62e0e8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
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

```bash
pip install datasets
```

Load the shard index:

```python
from datasets import load_dataset

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

Load one split:

```python
from datasets import load_dataset

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

List sequence shards:

```python
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:

```python
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:

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

Download one source shard:

```bash
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:

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