anindya64 commited on
Commit
151bad5
·
verified ·
1 Parent(s): 4823aa3

Add default Parquet file index for MGnify

Browse files
README.md CHANGED
@@ -2,7 +2,7 @@
2
  license: cc-by-4.0
3
  pretty_name: MGnify Protein Catalogues
4
  size_categories:
5
- - unknown
6
  task_categories:
7
  - other
8
  language:
@@ -14,90 +14,217 @@ tags:
14
  - fasta
15
  - mgnify
16
  - metagenomics
 
 
 
 
 
 
 
 
 
 
 
 
17
  ---
18
 
19
  # MGnify Protein Catalogues
20
 
21
- Normalized FASTA shards of MGnify protein cluster catalogues (mgy_clusters and mgy_proteins partitions).
22
 
23
- Processed and uploaded by the [MegaData](https://github.com/) post-download pipeline
24
- (internal repo). Original source: <https://www.ebi.ac.uk/metagenomics/>.
25
 
26
- > Note: `shard-000000.fasta.zst` per source is a 100-record sample left over from validation passes and is **not part of this dataset**. Only `shard-000001.fasta.zst` and higher contain full-clean data.
27
 
28
- ## Statistics
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
- | | |
31
- |---|---|
32
- | Source files | 26 |
33
- | Shards | 3,148 |
34
- | Compressed shard bytes | 319.27 GiB (342,815,994,580) |
35
- | Normalized table files | 28 |
36
- | Compressed table bytes | 2.17 TiB (2,380,980,172,257) |
 
 
 
 
 
 
 
37
 
38
- ## Layout
39
 
 
 
 
 
 
 
 
 
 
 
40
  ```
41
- .
42
- ├── tables/<source_slug>.jsonl # normalized table rows (one JSON object per line)
43
- └── sequences/<source_slug>/shard-NNNNNN.fasta.zst
 
 
 
 
44
  ```
45
 
46
- > `metadata/`, `manifests/`, and `_MANIFEST.json` are intentionally not shipped here — the on-disk versions were sample-only. Recompute per-shard record/residue counts downstream by streaming the FASTA records out of the shipped shards.
47
 
48
- `<source_slug>` corresponds 1:1 with an upstream source archive; e.g.
49
- `sequence_uniprotkb_uniprot_sprot.fasta.gz`.
50
 
51
- ## Loading
 
 
 
 
 
 
52
 
53
- Stream every shard of one source (replace `<source_slug>` with the directory of
54
- interest under `sequences/`):
55
 
56
- ```bash
57
- hf download LiteFold/Mgnify --repo-type dataset \
58
- --include 'sequences/<source_slug>/shard-*.fasta.zst' \
59
- --local-dir ./mgnify_proteins
60
- zstd -dc ./mgnify_proteins/sequences/<source_slug>/shard-*.fasta.zst | head
 
61
  ```
62
 
63
- Programmatic streaming with [`zstandard`](https://pypi.org/project/zstandard/):
 
 
64
 
65
  ```python
66
  from huggingface_hub import snapshot_download
67
- from pathlib import Path
68
- import zstandard as zstd
69
 
70
- local = snapshot_download(
71
  repo_id="LiteFold/Mgnify",
72
  repo_type="dataset",
73
- allow_patterns=["sequences/*/shard-*.fasta.zst"],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  )
75
 
76
  dctx = zstd.ZstdDecompressor()
77
- for shard in sorted(Path(local).rglob("shard-*.fasta.zst")):
78
- with shard.open("rb") as f, dctx.stream_reader(f) as reader:
79
- buf = b""
80
- while chunk := reader.read(1 << 20):
81
- buf += chunk
82
- *lines, buf = buf.split(b"\n")
83
- for line in lines:
84
- ... # naive splitter; swap in your FASTA parser
85
  ```
86
 
87
- ## License
88
 
89
- CC BY 4.0 (EMBL-EBI MGnify).
90
 
91
- ## Citation
 
 
 
 
92
 
93
- > Mitchell AL, et al. MGnify: the microbiome analysis resource in 2020. Nucleic Acids Research, 48(D1):D570-D578, 2020.
94
 
95
- ## Caveats
 
 
 
 
96
 
97
- - `shard-000000.fasta.zst` per source is a 100-record sample left over from validation passes and is **excluded** from this upload. Only `shard-000001.fasta.zst` and onward are shipped.
98
- - Per-source `manifests/*.json` and `metadata/*.records.jsonl` are **not shipped** because their on-disk contents are sample-only (100 records per source). They can be regenerated downstream by streaming the shipped shards (each shard is a concatenation of FASTA records; counting `^>` headers gives per-shard record counts).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
 
100
- ## Provenance
101
 
102
- Built from the local manifest entry `mgnify_proteins` of `manifests/atlas_download_plan.json`.
103
- Pipeline source: `megadata-post normalize --dataset mgnify_proteins`.
 
2
  license: cc-by-4.0
3
  pretty_name: MGnify Protein Catalogues
4
  size_categories:
5
+ - 1B<n<10B
6
  task_categories:
7
  - other
8
  language:
 
14
  - fasta
15
  - mgnify
16
  - metagenomics
17
+ - protein-catalogue
18
+ - train-test-split
19
+ - parquet
20
+ configs:
21
+ - config_name: default
22
+ data_files:
23
+ - split: train
24
+ path:
25
+ - data/train-*.parquet
26
+ - split: test
27
+ path:
28
+ - data/test-*.parquet
29
  ---
30
 
31
  # MGnify Protein Catalogues
32
 
33
+ This repository contains the LiteFold/Mgnify MGnify protein catalogue payload plus a compact default index for the Hugging Face Dataset Viewer.
34
 
35
+ The raw sequence and table payload is TB-scale, so the `default` config is intentionally a file/shard index rather than a duplicate of every raw row. The raw files remain in `sequences/` and `tables/`; use the index to discover sources, shards, part files, sizes, and download patterns, then stream or download only the payload files you need.
 
36
 
37
+ ## Dataset Summary
38
 
39
+ | Metric | Value |
40
+ |---|---:|
41
+ | Default index rows | 3,226 |
42
+ | Default index columns | 34 |
43
+ | Repository files indexed | 3,226 |
44
+ | Repository bytes indexed | 3,156,136,546,084 |
45
+ | Sequence source files | 26 |
46
+ | Sequence shards | 3,148 |
47
+ | Sequence shard bytes | 342,815,994,580 |
48
+ | Logical table sources | 28 |
49
+ | Logical table bytes | 2,380,980,172,257 |
50
+ | Table files in repo | 76 |
51
+ | Table repo bytes | 2,813,320,536,987 |
52
 
53
+ The table repo bytes include both top-level table JSONL files and split part files where both are present. The logical table bytes count each upstream table once.
54
+
55
+ ## Default Splits
56
+
57
+ The default index split is deterministic by file id:
58
+
59
+ `sha256(file_id) % 10`
60
+
61
+ Bucket `0` is `test`; buckets `1` through `9` are `train`.
62
+
63
+ | Split | Rows |
64
+ |---|---:|
65
+ | `train` | 2,902 |
66
+ | `test` | 324 |
67
 
68
+ These are file-index splits, not biological train/test sequence splits. For model training, create sequence-level or cluster-level splits appropriate to your task after loading the relevant MGnify payload.
69
 
70
+ ## Loading With `datasets`
71
+
72
+ Load the default file/shard index:
73
+
74
+ ```python
75
+ from datasets import load_dataset
76
+
77
+ index = load_dataset("LiteFold/Mgnify")
78
+ print(index)
79
+ print(index["train"][0])
80
  ```
81
+
82
+ Load one split directly:
83
+
84
+ ```python
85
+ from datasets import load_dataset
86
+
87
+ train_index = load_dataset("LiteFold/Mgnify", split="train")
88
  ```
89
 
90
+ Find sequence shards for one source family:
91
 
92
+ ```python
93
+ from datasets import load_dataset
94
 
95
+ index = load_dataset("LiteFold/Mgnify", split="train")
96
+ mgy_clusters = index.filter(
97
+ lambda row: row["role"] == "sequence_shard"
98
+ and row["source_family"] == "mgy_clusters"
99
+ )
100
+ print(mgy_clusters[0]["download_pattern"])
101
+ ```
102
 
103
+ Find split table parts:
 
104
 
105
+ ```python
106
+ from datasets import load_dataset
107
+
108
+ index = load_dataset("LiteFold/Mgnify", split="train")
109
+ parts = index.filter(lambda row: row["role"] == "table_split_part")
110
+ print(parts[0]["path"], parts[0]["size_bytes"])
111
  ```
112
 
113
+ ## Streaming Raw FASTA Shards
114
+
115
+ Download one source family with the Hub client:
116
 
117
  ```python
118
  from huggingface_hub import snapshot_download
 
 
119
 
120
+ local_dir = snapshot_download(
121
  repo_id="LiteFold/Mgnify",
122
  repo_type="dataset",
123
+ allow_patterns=[
124
+ "sequences/sequence_mgnify_current_release_mgy_clusters.fa.gz/shard-*.fasta.zst"
125
+ ],
126
+ )
127
+ print(local_dir)
128
+ ```
129
+
130
+ Stream a shard without downloading the whole source family:
131
+
132
+ ```python
133
+ from huggingface_hub import HfFileSystem
134
+ import zstandard as zstd
135
+
136
+ fs = HfFileSystem()
137
+ path = (
138
+ "datasets/LiteFold/Mgnify/"
139
+ "sequences/sequence_mgnify_current_release_mgy_clusters.fa.gz/"
140
+ "shard-000001.fasta.zst"
141
  )
142
 
143
  dctx = zstd.ZstdDecompressor()
144
+ with fs.open(path, "rb") as f, dctx.stream_reader(f) as reader:
145
+ chunk = reader.read(1 << 20)
146
+ print(chunk[:200])
 
 
 
 
 
147
  ```
148
 
149
+ ## Downloading Raw Table Parts
150
 
151
+ For split tables, use the `download_pattern` column or a direct include pattern:
152
 
153
+ ```bash
154
+ hf download LiteFold/Mgnify --repo-type dataset \
155
+ --include 'tables/sequence_mgnify_current_release_mgy_proteins_pfam.tsv.gz.jsonl.parts/part-*.jsonl' \
156
+ --local-dir ./mgnify
157
+ ```
158
 
159
+ For unsplit tables:
160
 
161
+ ```bash
162
+ hf download LiteFold/Mgnify --repo-type dataset \
163
+ --include 'tables/sequence_mgnify_current_release_mgy_seq_metadata_2.tsv.gz.jsonl' \
164
+ --local-dir ./mgnify
165
+ ```
166
 
167
+ The raw table files are not registered as `datasets` configs because they are multi-TB nested JSONL payloads. Keeping the default config as a compact Parquet index prevents accidental full-repo scans and keeps the Dataset Viewer responsive.
168
+
169
+ ## Default Columns
170
+
171
+ | Column | Description |
172
+ |---|---|
173
+ | `file_id` | Stable file identifier, currently the repository path. |
174
+ | `repo_id` | Hugging Face dataset repository id. |
175
+ | `source_sha` | Source commit used to build the index. |
176
+ | `dataset_id` | `mgnify_proteins`. |
177
+ | `source_family` | Parsed source family such as `mgy_clusters`, `mgy_proteins_1`, or `mgy_seq_metadata_2`. |
178
+ | `source_slug` | Source slug/path component used by the repository. |
179
+ | `source_file` | Original MGnify source path when derivable. |
180
+ | `path` | File path in the repository. |
181
+ | `role` | File role: `sequence_shard`, `table_jsonl`, `table_split_part`, `table_split_manifest`, `readme`, or `git_attributes`. |
182
+ | `shard_index` | FASTA shard index, otherwise `-1`. |
183
+ | `part_index` | Split table part index, otherwise `-1`. |
184
+ | `size_bytes` | File size in bytes. |
185
+ | `compression` | File/container format. |
186
+ | `logical_table_size_bytes` | Logical source table size when applicable, otherwise `-1`. |
187
+ | `split_part_count` | Number of table split parts when applicable, otherwise `-1`. |
188
+ | `split_chunk_bytes` | Target split chunk size when applicable, otherwise `-1`. |
189
+ | `sequence_source_shard_count` | Number of shards in the sequence source, otherwise `-1`. |
190
+ | `sequence_source_bytes` | Total bytes for that sequence source, otherwise `-1`. |
191
+ | `repo_file_count` | Total repository files indexed. |
192
+ | `repo_total_bytes` | Total indexed repository bytes. |
193
+ | `sequence_shard_count_total` | Total sequence shards. |
194
+ | `sequence_shard_bytes_total` | Total sequence shard bytes. |
195
+ | `table_repo_file_count_total` | Total table files in the repo, including split manifests and parts. |
196
+ | `table_repo_bytes_total` | Total table repo bytes, including duplicated top-level and split files where both exist. |
197
+ | `logical_table_count_total` | Logical upstream table count. |
198
+ | `logical_table_bytes_total` | Logical upstream table bytes. |
199
+ | `is_sequence_shard` | Whether the row is a FASTA shard. |
200
+ | `is_table_file` | Whether the row is a table file or table manifest. |
201
+ | `is_split_part` | Whether the row is a split table part. |
202
+ | `is_split_manifest` | Whether the row is a split manifest. |
203
+ | `is_original_table_copy` | Whether a top-level table also has split parts. |
204
+ | `download_pattern` | Glob or exact path for downloading related payload files. |
205
+ | `access_note` | Short usage note. |
206
+ | `split_bucket` | Deterministic bucket used for the default train/test split. |
207
+
208
+ ## Files
209
+
210
+ - `data/*.parquet`: default file/shard index for Dataset Viewer.
211
+ - `metadata/source_files.parquet`: full index copy.
212
+ - `sequences/*/shard-*.fasta.zst`: raw compressed MGnify FASTA shards.
213
+ - `tables/**/*.jsonl`: raw normalized table payloads and split parts.
214
+ - `_MANIFEST.json`: index build summary.
215
+ - `dataset_summary.json`: same summary in a Dataset Viewer-adjacent file.
216
+ - `scripts/prepare_mgnify_dataset.py`: script used to build the default index.
217
+
218
+ ## Source
219
+
220
+ Derived from LiteFold/Mgnify, originally sourced from EMBL-EBI MGnify.
221
+
222
+ ## License
223
+
224
+ CC BY 4.0.
225
+
226
+ ## Citation
227
 
228
+ If you use the MGnify data, cite MGnify:
229
 
230
+ Mitchell AL, et al. MGnify: the microbiome analysis resource in 2020. Nucleic Acids Research, 48(D1):D570-D578, 2020.
 
_MANIFEST.json ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": "LiteFold/Mgnify",
3
+ "source_sha": "4823aa306c32be5800a6ad6a1a6afd256bece606",
4
+ "viewer_table_scope": "file/shard index",
5
+ "data_format": "parquet",
6
+ "dataset_id": "mgnify_proteins",
7
+ "index_rows": 3226,
8
+ "splits": {
9
+ "train": 2902,
10
+ "test": 324
11
+ },
12
+ "split_strategy": "default file index uses deterministic sha256(file_id) % 10; bucket 0 is test, buckets 1-9 are train",
13
+ "repo_file_count": 3226,
14
+ "repo_total_bytes": 3156136546084,
15
+ "sequence_source_count": 26,
16
+ "sequence_shard_count_total": 3148,
17
+ "sequence_shard_bytes_total": 342815994580,
18
+ "table_repo_file_count_total": 76,
19
+ "table_repo_bytes_total": 2813320536987,
20
+ "logical_table_count_total": 28,
21
+ "logical_table_bytes_total": 2380980172257,
22
+ "role_counts": {
23
+ "git_attributes": 1,
24
+ "readme": 1,
25
+ "sequence_shard": 3148,
26
+ "table_jsonl": 26,
27
+ "table_split_manifest": 5,
28
+ "table_split_part": 45
29
+ },
30
+ "source_family_index_counts": {
31
+ "mgy_cluster_seqs": 6,
32
+ "mgy_clusters": 724,
33
+ "mgy_proteins_1": 99,
34
+ "mgy_proteins_10": 99,
35
+ "mgy_proteins_11": 99,
36
+ "mgy_proteins_12": 99,
37
+ "mgy_proteins_13": 99,
38
+ "mgy_proteins_14": 99,
39
+ "mgy_proteins_15": 99,
40
+ "mgy_proteins_16": 99,
41
+ "mgy_proteins_17": 99,
42
+ "mgy_proteins_18": 99,
43
+ "mgy_proteins_19": 99,
44
+ "mgy_proteins_2": 99,
45
+ "mgy_proteins_20": 99,
46
+ "mgy_proteins_21": 99,
47
+ "mgy_proteins_22": 99,
48
+ "mgy_proteins_23": 99,
49
+ "mgy_proteins_24": 99,
50
+ "mgy_proteins_25": 55,
51
+ "mgy_proteins_3": 99,
52
+ "mgy_proteins_4": 99,
53
+ "mgy_proteins_5": 99,
54
+ "mgy_proteins_6": 99,
55
+ "mgy_proteins_7": 99,
56
+ "mgy_proteins_8": 99,
57
+ "mgy_proteins_9": 99,
58
+ "mgy_proteins_pfam": 16,
59
+ "mgy_seq_metadata_1": 19,
60
+ "mgy_seq_metadata_10": 1,
61
+ "mgy_seq_metadata_11": 5,
62
+ "mgy_seq_metadata_12": 1,
63
+ "mgy_seq_metadata_13": 1,
64
+ "mgy_seq_metadata_14": 1,
65
+ "mgy_seq_metadata_15": 1,
66
+ "mgy_seq_metadata_16": 1,
67
+ "mgy_seq_metadata_17": 1,
68
+ "mgy_seq_metadata_18": 1,
69
+ "mgy_seq_metadata_19": 1,
70
+ "mgy_seq_metadata_2": 1,
71
+ "mgy_seq_metadata_20": 1,
72
+ "mgy_seq_metadata_21": 1,
73
+ "mgy_seq_metadata_22": 1,
74
+ "mgy_seq_metadata_23": 1,
75
+ "mgy_seq_metadata_24": 1,
76
+ "mgy_seq_metadata_25": 1,
77
+ "mgy_seq_metadata_3": 1,
78
+ "mgy_seq_metadata_4": 1,
79
+ "mgy_seq_metadata_5": 1,
80
+ "mgy_seq_metadata_6": 1,
81
+ "mgy_seq_metadata_7": 1,
82
+ "mgy_seq_metadata_8": 1,
83
+ "mgy_seq_metadata_9": 1
84
+ },
85
+ "sequence_sources": {
86
+ "sequence_mgnify_current_release_mgy_clusters.fa.gz": {
87
+ "shards": 717,
88
+ "bytes": 75096691452
89
+ },
90
+ "sequence_mgnify_current_release_mgy_proteins_1.fa.gz": {
91
+ "shards": 99,
92
+ "bytes": 10908143157
93
+ },
94
+ "sequence_mgnify_current_release_mgy_proteins_10.fa.gz": {
95
+ "shards": 99,
96
+ "bytes": 10906777680
97
+ },
98
+ "sequence_mgnify_current_release_mgy_proteins_11.fa.gz": {
99
+ "shards": 99,
100
+ "bytes": 10900989463
101
+ },
102
+ "sequence_mgnify_current_release_mgy_proteins_12.fa.gz": {
103
+ "shards": 99,
104
+ "bytes": 10901525947
105
+ },
106
+ "sequence_mgnify_current_release_mgy_proteins_13.fa.gz": {
107
+ "shards": 99,
108
+ "bytes": 10902791151
109
+ },
110
+ "sequence_mgnify_current_release_mgy_proteins_14.fa.gz": {
111
+ "shards": 99,
112
+ "bytes": 10900361720
113
+ },
114
+ "sequence_mgnify_current_release_mgy_proteins_15.fa.gz": {
115
+ "shards": 99,
116
+ "bytes": 10907689631
117
+ },
118
+ "sequence_mgnify_current_release_mgy_proteins_16.fa.gz": {
119
+ "shards": 99,
120
+ "bytes": 10897394947
121
+ },
122
+ "sequence_mgnify_current_release_mgy_proteins_17.fa.gz": {
123
+ "shards": 99,
124
+ "bytes": 10909492842
125
+ },
126
+ "sequence_mgnify_current_release_mgy_proteins_18.fa.gz": {
127
+ "shards": 99,
128
+ "bytes": 10899232819
129
+ },
130
+ "sequence_mgnify_current_release_mgy_proteins_19.fa.gz": {
131
+ "shards": 99,
132
+ "bytes": 10905661162
133
+ },
134
+ "sequence_mgnify_current_release_mgy_proteins_2.fa.gz": {
135
+ "shards": 99,
136
+ "bytes": 10899004070
137
+ },
138
+ "sequence_mgnify_current_release_mgy_proteins_20.fa.gz": {
139
+ "shards": 99,
140
+ "bytes": 10903801169
141
+ },
142
+ "sequence_mgnify_current_release_mgy_proteins_21.fa.gz": {
143
+ "shards": 99,
144
+ "bytes": 10904561845
145
+ },
146
+ "sequence_mgnify_current_release_mgy_proteins_22.fa.gz": {
147
+ "shards": 99,
148
+ "bytes": 10899121040
149
+ },
150
+ "sequence_mgnify_current_release_mgy_proteins_23.fa.gz": {
151
+ "shards": 99,
152
+ "bytes": 10907509788
153
+ },
154
+ "sequence_mgnify_current_release_mgy_proteins_24.fa.gz": {
155
+ "shards": 99,
156
+ "bytes": 10896819558
157
+ },
158
+ "sequence_mgnify_current_release_mgy_proteins_25.fa.gz": {
159
+ "shards": 55,
160
+ "bytes": 6048430463
161
+ },
162
+ "sequence_mgnify_current_release_mgy_proteins_3.fa.gz": {
163
+ "shards": 99,
164
+ "bytes": 10903744948
165
+ },
166
+ "sequence_mgnify_current_release_mgy_proteins_4.fa.gz": {
167
+ "shards": 99,
168
+ "bytes": 10907264758
169
+ },
170
+ "sequence_mgnify_current_release_mgy_proteins_5.fa.gz": {
171
+ "shards": 99,
172
+ "bytes": 10898107642
173
+ },
174
+ "sequence_mgnify_current_release_mgy_proteins_6.fa.gz": {
175
+ "shards": 99,
176
+ "bytes": 10908535103
177
+ },
178
+ "sequence_mgnify_current_release_mgy_proteins_7.fa.gz": {
179
+ "shards": 99,
180
+ "bytes": 10900359709
181
+ },
182
+ "sequence_mgnify_current_release_mgy_proteins_8.fa.gz": {
183
+ "shards": 99,
184
+ "bytes": 10902962231
185
+ },
186
+ "sequence_mgnify_current_release_mgy_proteins_9.fa.gz": {
187
+ "shards": 99,
188
+ "bytes": 10899020285
189
+ }
190
+ },
191
+ "logical_table_sources": {
192
+ "tables/sequence_mgnify_current_release_mgy_cluster_seqs.tsv.gz.jsonl": {
193
+ "bytes": 153607022165,
194
+ "has_split_parts": true
195
+ },
196
+ "tables/sequence_mgnify_current_release_mgy_clusters.tsv.gz.jsonl": {
197
+ "bytes": 193246335684,
198
+ "has_split_parts": true
199
+ },
200
+ "tables/sequence_mgnify_current_release_mgy_proteins_pfam.tsv.gz.jsonl": {
201
+ "bytes": 583253642443,
202
+ "has_split_parts": true
203
+ },
204
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_1.tsv.gz.jsonl": {
205
+ "bytes": 709829402157,
206
+ "has_split_parts": true
207
+ },
208
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_10.tsv.gz.jsonl": {
209
+ "bytes": 27689883697,
210
+ "has_split_parts": false
211
+ },
212
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_11.tsv.gz.jsonl": {
213
+ "bytes": 85487002361,
214
+ "has_split_parts": true
215
+ },
216
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_12.tsv.gz.jsonl": {
217
+ "bytes": 27619727642,
218
+ "has_split_parts": false
219
+ },
220
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_13.tsv.gz.jsonl": {
221
+ "bytes": 27497401406,
222
+ "has_split_parts": false
223
+ },
224
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_14.tsv.gz.jsonl": {
225
+ "bytes": 27320599135,
226
+ "has_split_parts": false
227
+ },
228
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_15.tsv.gz.jsonl": {
229
+ "bytes": 27617274630,
230
+ "has_split_parts": false
231
+ },
232
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_16.tsv.gz.jsonl": {
233
+ "bytes": 27517547943,
234
+ "has_split_parts": false
235
+ },
236
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_17.tsv.gz.jsonl": {
237
+ "bytes": 27627334443,
238
+ "has_split_parts": false
239
+ },
240
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_18.tsv.gz.jsonl": {
241
+ "bytes": 27030730997,
242
+ "has_split_parts": false
243
+ },
244
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_19.tsv.gz.jsonl": {
245
+ "bytes": 28055081625,
246
+ "has_split_parts": false
247
+ },
248
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_2.tsv.gz.jsonl": {
249
+ "bytes": 36023670192,
250
+ "has_split_parts": false
251
+ },
252
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_20.tsv.gz.jsonl": {
253
+ "bytes": 27978747258,
254
+ "has_split_parts": false
255
+ },
256
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_21.tsv.gz.jsonl": {
257
+ "bytes": 27516263137,
258
+ "has_split_parts": false
259
+ },
260
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_22.tsv.gz.jsonl": {
261
+ "bytes": 27150357250,
262
+ "has_split_parts": false
263
+ },
264
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_23.tsv.gz.jsonl": {
265
+ "bytes": 28015993507,
266
+ "has_split_parts": false
267
+ },
268
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_24.tsv.gz.jsonl": {
269
+ "bytes": 27358438171,
270
+ "has_split_parts": false
271
+ },
272
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_25.tsv.gz.jsonl": {
273
+ "bytes": 15014567653,
274
+ "has_split_parts": false
275
+ },
276
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_3.tsv.gz.jsonl": {
277
+ "bytes": 35859299606,
278
+ "has_split_parts": false
279
+ },
280
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_4.tsv.gz.jsonl": {
281
+ "bytes": 31710376451,
282
+ "has_split_parts": false
283
+ },
284
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_5.tsv.gz.jsonl": {
285
+ "bytes": 28014363039,
286
+ "has_split_parts": false
287
+ },
288
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_6.tsv.gz.jsonl": {
289
+ "bytes": 27642057112,
290
+ "has_split_parts": false
291
+ },
292
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_7.tsv.gz.jsonl": {
293
+ "bytes": 27441188612,
294
+ "has_split_parts": false
295
+ },
296
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_8.tsv.gz.jsonl": {
297
+ "bytes": 32228163687,
298
+ "has_split_parts": false
299
+ },
300
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_9.tsv.gz.jsonl": {
301
+ "bytes": 35627700254,
302
+ "has_split_parts": false
303
+ }
304
+ },
305
+ "columns": [
306
+ "file_id",
307
+ "repo_id",
308
+ "source_sha",
309
+ "dataset_id",
310
+ "source_family",
311
+ "source_slug",
312
+ "source_file",
313
+ "path",
314
+ "role",
315
+ "shard_index",
316
+ "part_index",
317
+ "size_bytes",
318
+ "compression",
319
+ "logical_table_size_bytes",
320
+ "split_part_count",
321
+ "split_chunk_bytes",
322
+ "sequence_source_shard_count",
323
+ "sequence_source_bytes",
324
+ "repo_file_count",
325
+ "repo_total_bytes",
326
+ "sequence_shard_count_total",
327
+ "sequence_shard_bytes_total",
328
+ "table_repo_file_count_total",
329
+ "table_repo_bytes_total",
330
+ "logical_table_count_total",
331
+ "logical_table_bytes_total",
332
+ "is_sequence_shard",
333
+ "is_table_file",
334
+ "is_split_part",
335
+ "is_split_manifest",
336
+ "is_original_table_copy",
337
+ "download_pattern",
338
+ "access_note",
339
+ "split_bucket"
340
+ ]
341
+ }
data/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ea15ef4dc3ca71d44c2123d82d2518d2a6808715ba7bd9935a14852318d26b24
3
+ size 18771
data/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:526ef038fd642cc5fc1d7050cb854e2122bf104342c62f5528ac7d869a36e2ec
3
+ size 50806
dataset_summary.json ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": "LiteFold/Mgnify",
3
+ "source_sha": "4823aa306c32be5800a6ad6a1a6afd256bece606",
4
+ "viewer_table_scope": "file/shard index",
5
+ "data_format": "parquet",
6
+ "dataset_id": "mgnify_proteins",
7
+ "index_rows": 3226,
8
+ "splits": {
9
+ "train": 2902,
10
+ "test": 324
11
+ },
12
+ "split_strategy": "default file index uses deterministic sha256(file_id) % 10; bucket 0 is test, buckets 1-9 are train",
13
+ "repo_file_count": 3226,
14
+ "repo_total_bytes": 3156136546084,
15
+ "sequence_source_count": 26,
16
+ "sequence_shard_count_total": 3148,
17
+ "sequence_shard_bytes_total": 342815994580,
18
+ "table_repo_file_count_total": 76,
19
+ "table_repo_bytes_total": 2813320536987,
20
+ "logical_table_count_total": 28,
21
+ "logical_table_bytes_total": 2380980172257,
22
+ "role_counts": {
23
+ "git_attributes": 1,
24
+ "readme": 1,
25
+ "sequence_shard": 3148,
26
+ "table_jsonl": 26,
27
+ "table_split_manifest": 5,
28
+ "table_split_part": 45
29
+ },
30
+ "source_family_index_counts": {
31
+ "mgy_cluster_seqs": 6,
32
+ "mgy_clusters": 724,
33
+ "mgy_proteins_1": 99,
34
+ "mgy_proteins_10": 99,
35
+ "mgy_proteins_11": 99,
36
+ "mgy_proteins_12": 99,
37
+ "mgy_proteins_13": 99,
38
+ "mgy_proteins_14": 99,
39
+ "mgy_proteins_15": 99,
40
+ "mgy_proteins_16": 99,
41
+ "mgy_proteins_17": 99,
42
+ "mgy_proteins_18": 99,
43
+ "mgy_proteins_19": 99,
44
+ "mgy_proteins_2": 99,
45
+ "mgy_proteins_20": 99,
46
+ "mgy_proteins_21": 99,
47
+ "mgy_proteins_22": 99,
48
+ "mgy_proteins_23": 99,
49
+ "mgy_proteins_24": 99,
50
+ "mgy_proteins_25": 55,
51
+ "mgy_proteins_3": 99,
52
+ "mgy_proteins_4": 99,
53
+ "mgy_proteins_5": 99,
54
+ "mgy_proteins_6": 99,
55
+ "mgy_proteins_7": 99,
56
+ "mgy_proteins_8": 99,
57
+ "mgy_proteins_9": 99,
58
+ "mgy_proteins_pfam": 16,
59
+ "mgy_seq_metadata_1": 19,
60
+ "mgy_seq_metadata_10": 1,
61
+ "mgy_seq_metadata_11": 5,
62
+ "mgy_seq_metadata_12": 1,
63
+ "mgy_seq_metadata_13": 1,
64
+ "mgy_seq_metadata_14": 1,
65
+ "mgy_seq_metadata_15": 1,
66
+ "mgy_seq_metadata_16": 1,
67
+ "mgy_seq_metadata_17": 1,
68
+ "mgy_seq_metadata_18": 1,
69
+ "mgy_seq_metadata_19": 1,
70
+ "mgy_seq_metadata_2": 1,
71
+ "mgy_seq_metadata_20": 1,
72
+ "mgy_seq_metadata_21": 1,
73
+ "mgy_seq_metadata_22": 1,
74
+ "mgy_seq_metadata_23": 1,
75
+ "mgy_seq_metadata_24": 1,
76
+ "mgy_seq_metadata_25": 1,
77
+ "mgy_seq_metadata_3": 1,
78
+ "mgy_seq_metadata_4": 1,
79
+ "mgy_seq_metadata_5": 1,
80
+ "mgy_seq_metadata_6": 1,
81
+ "mgy_seq_metadata_7": 1,
82
+ "mgy_seq_metadata_8": 1,
83
+ "mgy_seq_metadata_9": 1
84
+ },
85
+ "sequence_sources": {
86
+ "sequence_mgnify_current_release_mgy_clusters.fa.gz": {
87
+ "shards": 717,
88
+ "bytes": 75096691452
89
+ },
90
+ "sequence_mgnify_current_release_mgy_proteins_1.fa.gz": {
91
+ "shards": 99,
92
+ "bytes": 10908143157
93
+ },
94
+ "sequence_mgnify_current_release_mgy_proteins_10.fa.gz": {
95
+ "shards": 99,
96
+ "bytes": 10906777680
97
+ },
98
+ "sequence_mgnify_current_release_mgy_proteins_11.fa.gz": {
99
+ "shards": 99,
100
+ "bytes": 10900989463
101
+ },
102
+ "sequence_mgnify_current_release_mgy_proteins_12.fa.gz": {
103
+ "shards": 99,
104
+ "bytes": 10901525947
105
+ },
106
+ "sequence_mgnify_current_release_mgy_proteins_13.fa.gz": {
107
+ "shards": 99,
108
+ "bytes": 10902791151
109
+ },
110
+ "sequence_mgnify_current_release_mgy_proteins_14.fa.gz": {
111
+ "shards": 99,
112
+ "bytes": 10900361720
113
+ },
114
+ "sequence_mgnify_current_release_mgy_proteins_15.fa.gz": {
115
+ "shards": 99,
116
+ "bytes": 10907689631
117
+ },
118
+ "sequence_mgnify_current_release_mgy_proteins_16.fa.gz": {
119
+ "shards": 99,
120
+ "bytes": 10897394947
121
+ },
122
+ "sequence_mgnify_current_release_mgy_proteins_17.fa.gz": {
123
+ "shards": 99,
124
+ "bytes": 10909492842
125
+ },
126
+ "sequence_mgnify_current_release_mgy_proteins_18.fa.gz": {
127
+ "shards": 99,
128
+ "bytes": 10899232819
129
+ },
130
+ "sequence_mgnify_current_release_mgy_proteins_19.fa.gz": {
131
+ "shards": 99,
132
+ "bytes": 10905661162
133
+ },
134
+ "sequence_mgnify_current_release_mgy_proteins_2.fa.gz": {
135
+ "shards": 99,
136
+ "bytes": 10899004070
137
+ },
138
+ "sequence_mgnify_current_release_mgy_proteins_20.fa.gz": {
139
+ "shards": 99,
140
+ "bytes": 10903801169
141
+ },
142
+ "sequence_mgnify_current_release_mgy_proteins_21.fa.gz": {
143
+ "shards": 99,
144
+ "bytes": 10904561845
145
+ },
146
+ "sequence_mgnify_current_release_mgy_proteins_22.fa.gz": {
147
+ "shards": 99,
148
+ "bytes": 10899121040
149
+ },
150
+ "sequence_mgnify_current_release_mgy_proteins_23.fa.gz": {
151
+ "shards": 99,
152
+ "bytes": 10907509788
153
+ },
154
+ "sequence_mgnify_current_release_mgy_proteins_24.fa.gz": {
155
+ "shards": 99,
156
+ "bytes": 10896819558
157
+ },
158
+ "sequence_mgnify_current_release_mgy_proteins_25.fa.gz": {
159
+ "shards": 55,
160
+ "bytes": 6048430463
161
+ },
162
+ "sequence_mgnify_current_release_mgy_proteins_3.fa.gz": {
163
+ "shards": 99,
164
+ "bytes": 10903744948
165
+ },
166
+ "sequence_mgnify_current_release_mgy_proteins_4.fa.gz": {
167
+ "shards": 99,
168
+ "bytes": 10907264758
169
+ },
170
+ "sequence_mgnify_current_release_mgy_proteins_5.fa.gz": {
171
+ "shards": 99,
172
+ "bytes": 10898107642
173
+ },
174
+ "sequence_mgnify_current_release_mgy_proteins_6.fa.gz": {
175
+ "shards": 99,
176
+ "bytes": 10908535103
177
+ },
178
+ "sequence_mgnify_current_release_mgy_proteins_7.fa.gz": {
179
+ "shards": 99,
180
+ "bytes": 10900359709
181
+ },
182
+ "sequence_mgnify_current_release_mgy_proteins_8.fa.gz": {
183
+ "shards": 99,
184
+ "bytes": 10902962231
185
+ },
186
+ "sequence_mgnify_current_release_mgy_proteins_9.fa.gz": {
187
+ "shards": 99,
188
+ "bytes": 10899020285
189
+ }
190
+ },
191
+ "logical_table_sources": {
192
+ "tables/sequence_mgnify_current_release_mgy_cluster_seqs.tsv.gz.jsonl": {
193
+ "bytes": 153607022165,
194
+ "has_split_parts": true
195
+ },
196
+ "tables/sequence_mgnify_current_release_mgy_clusters.tsv.gz.jsonl": {
197
+ "bytes": 193246335684,
198
+ "has_split_parts": true
199
+ },
200
+ "tables/sequence_mgnify_current_release_mgy_proteins_pfam.tsv.gz.jsonl": {
201
+ "bytes": 583253642443,
202
+ "has_split_parts": true
203
+ },
204
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_1.tsv.gz.jsonl": {
205
+ "bytes": 709829402157,
206
+ "has_split_parts": true
207
+ },
208
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_10.tsv.gz.jsonl": {
209
+ "bytes": 27689883697,
210
+ "has_split_parts": false
211
+ },
212
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_11.tsv.gz.jsonl": {
213
+ "bytes": 85487002361,
214
+ "has_split_parts": true
215
+ },
216
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_12.tsv.gz.jsonl": {
217
+ "bytes": 27619727642,
218
+ "has_split_parts": false
219
+ },
220
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_13.tsv.gz.jsonl": {
221
+ "bytes": 27497401406,
222
+ "has_split_parts": false
223
+ },
224
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_14.tsv.gz.jsonl": {
225
+ "bytes": 27320599135,
226
+ "has_split_parts": false
227
+ },
228
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_15.tsv.gz.jsonl": {
229
+ "bytes": 27617274630,
230
+ "has_split_parts": false
231
+ },
232
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_16.tsv.gz.jsonl": {
233
+ "bytes": 27517547943,
234
+ "has_split_parts": false
235
+ },
236
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_17.tsv.gz.jsonl": {
237
+ "bytes": 27627334443,
238
+ "has_split_parts": false
239
+ },
240
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_18.tsv.gz.jsonl": {
241
+ "bytes": 27030730997,
242
+ "has_split_parts": false
243
+ },
244
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_19.tsv.gz.jsonl": {
245
+ "bytes": 28055081625,
246
+ "has_split_parts": false
247
+ },
248
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_2.tsv.gz.jsonl": {
249
+ "bytes": 36023670192,
250
+ "has_split_parts": false
251
+ },
252
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_20.tsv.gz.jsonl": {
253
+ "bytes": 27978747258,
254
+ "has_split_parts": false
255
+ },
256
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_21.tsv.gz.jsonl": {
257
+ "bytes": 27516263137,
258
+ "has_split_parts": false
259
+ },
260
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_22.tsv.gz.jsonl": {
261
+ "bytes": 27150357250,
262
+ "has_split_parts": false
263
+ },
264
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_23.tsv.gz.jsonl": {
265
+ "bytes": 28015993507,
266
+ "has_split_parts": false
267
+ },
268
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_24.tsv.gz.jsonl": {
269
+ "bytes": 27358438171,
270
+ "has_split_parts": false
271
+ },
272
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_25.tsv.gz.jsonl": {
273
+ "bytes": 15014567653,
274
+ "has_split_parts": false
275
+ },
276
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_3.tsv.gz.jsonl": {
277
+ "bytes": 35859299606,
278
+ "has_split_parts": false
279
+ },
280
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_4.tsv.gz.jsonl": {
281
+ "bytes": 31710376451,
282
+ "has_split_parts": false
283
+ },
284
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_5.tsv.gz.jsonl": {
285
+ "bytes": 28014363039,
286
+ "has_split_parts": false
287
+ },
288
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_6.tsv.gz.jsonl": {
289
+ "bytes": 27642057112,
290
+ "has_split_parts": false
291
+ },
292
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_7.tsv.gz.jsonl": {
293
+ "bytes": 27441188612,
294
+ "has_split_parts": false
295
+ },
296
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_8.tsv.gz.jsonl": {
297
+ "bytes": 32228163687,
298
+ "has_split_parts": false
299
+ },
300
+ "tables/sequence_mgnify_current_release_mgy_seq_metadata_9.tsv.gz.jsonl": {
301
+ "bytes": 35627700254,
302
+ "has_split_parts": false
303
+ }
304
+ },
305
+ "columns": [
306
+ "file_id",
307
+ "repo_id",
308
+ "source_sha",
309
+ "dataset_id",
310
+ "source_family",
311
+ "source_slug",
312
+ "source_file",
313
+ "path",
314
+ "role",
315
+ "shard_index",
316
+ "part_index",
317
+ "size_bytes",
318
+ "compression",
319
+ "logical_table_size_bytes",
320
+ "split_part_count",
321
+ "split_chunk_bytes",
322
+ "sequence_source_shard_count",
323
+ "sequence_source_bytes",
324
+ "repo_file_count",
325
+ "repo_total_bytes",
326
+ "sequence_shard_count_total",
327
+ "sequence_shard_bytes_total",
328
+ "table_repo_file_count_total",
329
+ "table_repo_bytes_total",
330
+ "logical_table_count_total",
331
+ "logical_table_bytes_total",
332
+ "is_sequence_shard",
333
+ "is_table_file",
334
+ "is_split_part",
335
+ "is_split_manifest",
336
+ "is_original_table_copy",
337
+ "download_pattern",
338
+ "access_note",
339
+ "split_bucket"
340
+ ]
341
+ }
metadata/source_files.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:34d589581c5e9a811006c99d4862144b26db96af8328bb1107cecd4bd10a0df2
3
+ size 52607
scripts/prepare_mgnify_dataset.py ADDED
@@ -0,0 +1,408 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Build a viewer-friendly file/shard index for LiteFold/Mgnify."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import hashlib
8
+ import json
9
+ import os
10
+ import re
11
+ import shutil
12
+ from collections import Counter, defaultdict
13
+ from pathlib import Path
14
+ from typing import Any
15
+
16
+ import pyarrow as pa
17
+ import pyarrow.parquet as pq
18
+ from huggingface_hub import HfApi, hf_hub_download
19
+
20
+
21
+ DATASET_ID = "mgnify_proteins"
22
+ PREFIX = "sequence_mgnify_current_release_"
23
+
24
+
25
+ INDEX_COLUMNS = [
26
+ "file_id",
27
+ "repo_id",
28
+ "source_sha",
29
+ "dataset_id",
30
+ "source_family",
31
+ "source_slug",
32
+ "source_file",
33
+ "path",
34
+ "role",
35
+ "shard_index",
36
+ "part_index",
37
+ "size_bytes",
38
+ "compression",
39
+ "logical_table_size_bytes",
40
+ "split_part_count",
41
+ "split_chunk_bytes",
42
+ "sequence_source_shard_count",
43
+ "sequence_source_bytes",
44
+ "repo_file_count",
45
+ "repo_total_bytes",
46
+ "sequence_shard_count_total",
47
+ "sequence_shard_bytes_total",
48
+ "table_repo_file_count_total",
49
+ "table_repo_bytes_total",
50
+ "logical_table_count_total",
51
+ "logical_table_bytes_total",
52
+ "is_sequence_shard",
53
+ "is_table_file",
54
+ "is_split_part",
55
+ "is_split_manifest",
56
+ "is_original_table_copy",
57
+ "download_pattern",
58
+ "access_note",
59
+ "split_bucket",
60
+ ]
61
+
62
+
63
+ SCHEMA = pa.schema(
64
+ [
65
+ pa.field("file_id", pa.string()),
66
+ pa.field("repo_id", pa.string()),
67
+ pa.field("source_sha", pa.string()),
68
+ pa.field("dataset_id", pa.string()),
69
+ pa.field("source_family", pa.string()),
70
+ pa.field("source_slug", pa.string()),
71
+ pa.field("source_file", pa.string()),
72
+ pa.field("path", pa.string()),
73
+ pa.field("role", pa.string()),
74
+ pa.field("shard_index", pa.int64()),
75
+ pa.field("part_index", pa.int64()),
76
+ pa.field("size_bytes", pa.int64()),
77
+ pa.field("compression", pa.string()),
78
+ pa.field("logical_table_size_bytes", pa.int64()),
79
+ pa.field("split_part_count", pa.int64()),
80
+ pa.field("split_chunk_bytes", pa.int64()),
81
+ pa.field("sequence_source_shard_count", pa.int64()),
82
+ pa.field("sequence_source_bytes", pa.int64()),
83
+ pa.field("repo_file_count", pa.int64()),
84
+ pa.field("repo_total_bytes", pa.int64()),
85
+ pa.field("sequence_shard_count_total", pa.int64()),
86
+ pa.field("sequence_shard_bytes_total", pa.int64()),
87
+ pa.field("table_repo_file_count_total", pa.int64()),
88
+ pa.field("table_repo_bytes_total", pa.int64()),
89
+ pa.field("logical_table_count_total", pa.int64()),
90
+ pa.field("logical_table_bytes_total", pa.int64()),
91
+ pa.field("is_sequence_shard", pa.bool_()),
92
+ pa.field("is_table_file", pa.bool_()),
93
+ pa.field("is_split_part", pa.bool_()),
94
+ pa.field("is_split_manifest", pa.bool_()),
95
+ pa.field("is_original_table_copy", pa.bool_()),
96
+ pa.field("download_pattern", pa.string()),
97
+ pa.field("access_note", pa.string()),
98
+ pa.field("split_bucket", pa.int64()),
99
+ ]
100
+ )
101
+
102
+
103
+ def load_token() -> str | None:
104
+ for key in ("HF_TOKEN", "HUGGINGFACE_HUB_TOKEN"):
105
+ value = os.environ.get(key)
106
+ if value:
107
+ return value
108
+ env_path = Path(".env")
109
+ if env_path.exists():
110
+ for line in env_path.read_text().splitlines():
111
+ stripped = line.strip()
112
+ if not stripped or stripped.startswith("#") or "=" not in stripped:
113
+ continue
114
+ key, value = stripped.split("=", 1)
115
+ if key.strip() in {"HF_TOKEN", "HUGGINGFACE_HUB_TOKEN"}:
116
+ value = value.strip().strip('"').strip("'")
117
+ if value:
118
+ return value
119
+ return None
120
+
121
+
122
+ def stable_bucket(value: str, buckets: int = 10) -> int:
123
+ digest = hashlib.sha256(value.encode("utf-8")).hexdigest()[:16]
124
+ return int(digest, 16) % buckets
125
+
126
+
127
+ def source_file_from_slug(slug: str) -> str:
128
+ if slug.startswith(PREFIX):
129
+ return "sequence/mgnify/current_release/" + slug[len(PREFIX) :]
130
+ return ""
131
+
132
+
133
+ def source_family_from_slug(slug: str) -> str:
134
+ if slug.startswith(PREFIX):
135
+ slug = slug[len(PREFIX) :]
136
+ for suffix in (".fasta.zst", ".fa.gz", ".tsv.gz.jsonl", ".tsv.gz"):
137
+ if slug.endswith(suffix):
138
+ slug = slug[: -len(suffix)]
139
+ return slug
140
+
141
+
142
+ def compression_for_path(path: str) -> str:
143
+ if path.endswith(".fasta.zst"):
144
+ return "zstd"
145
+ if path.endswith(".jsonl"):
146
+ return "jsonl"
147
+ if path.endswith(".json"):
148
+ return "json"
149
+ return ""
150
+
151
+
152
+ def parse_path(path: str) -> dict[str, Any]:
153
+ sequence_match = re.fullmatch(r"sequences/([^/]+)/shard-(\d+)\.fasta\.zst", path)
154
+ if sequence_match:
155
+ source_slug = sequence_match.group(1)
156
+ return {
157
+ "role": "sequence_shard",
158
+ "source_slug": source_slug,
159
+ "source_family": source_family_from_slug(source_slug),
160
+ "source_file": source_file_from_slug(source_slug),
161
+ "shard_index": int(sequence_match.group(2)),
162
+ "part_index": -1,
163
+ "is_sequence_shard": True,
164
+ "is_table_file": False,
165
+ "is_split_part": False,
166
+ "is_split_manifest": False,
167
+ "is_original_table_copy": False,
168
+ }
169
+
170
+ split_manifest_match = re.fullmatch(r"tables/(.+\.jsonl)\.parts/_SPLIT_MANIFEST\.json", path)
171
+ if split_manifest_match:
172
+ source_slug = split_manifest_match.group(1)
173
+ return {
174
+ "role": "table_split_manifest",
175
+ "source_slug": source_slug,
176
+ "source_family": source_family_from_slug(source_slug),
177
+ "source_file": source_file_from_slug(source_slug.removesuffix(".jsonl")),
178
+ "shard_index": -1,
179
+ "part_index": -1,
180
+ "is_sequence_shard": False,
181
+ "is_table_file": True,
182
+ "is_split_part": False,
183
+ "is_split_manifest": True,
184
+ "is_original_table_copy": False,
185
+ }
186
+
187
+ split_part_match = re.fullmatch(r"tables/(.+\.jsonl)\.parts/part-(\d+)\.jsonl", path)
188
+ if split_part_match:
189
+ source_slug = split_part_match.group(1)
190
+ return {
191
+ "role": "table_split_part",
192
+ "source_slug": source_slug,
193
+ "source_family": source_family_from_slug(source_slug),
194
+ "source_file": source_file_from_slug(source_slug.removesuffix(".jsonl")),
195
+ "shard_index": -1,
196
+ "part_index": int(split_part_match.group(2)),
197
+ "is_sequence_shard": False,
198
+ "is_table_file": True,
199
+ "is_split_part": True,
200
+ "is_split_manifest": False,
201
+ "is_original_table_copy": False,
202
+ }
203
+
204
+ table_match = re.fullmatch(r"tables/(.+\.jsonl)", path)
205
+ if table_match:
206
+ source_slug = table_match.group(1)
207
+ return {
208
+ "role": "table_jsonl",
209
+ "source_slug": source_slug,
210
+ "source_family": source_family_from_slug(source_slug),
211
+ "source_file": source_file_from_slug(source_slug.removesuffix(".jsonl")),
212
+ "shard_index": -1,
213
+ "part_index": -1,
214
+ "is_sequence_shard": False,
215
+ "is_table_file": True,
216
+ "is_split_part": False,
217
+ "is_split_manifest": False,
218
+ "is_original_table_copy": False,
219
+ }
220
+
221
+ role = {".gitattributes": "git_attributes", "README.md": "readme"}.get(path, "other")
222
+ return {
223
+ "role": role,
224
+ "source_slug": "",
225
+ "source_family": "",
226
+ "source_file": "",
227
+ "shard_index": -1,
228
+ "part_index": -1,
229
+ "is_sequence_shard": False,
230
+ "is_table_file": False,
231
+ "is_split_part": False,
232
+ "is_split_manifest": False,
233
+ "is_original_table_copy": False,
234
+ }
235
+
236
+
237
+ def load_split_manifests(raw_dir: Path) -> dict[str, dict[str, Any]]:
238
+ manifests: dict[str, dict[str, Any]] = {}
239
+ for path in raw_dir.glob("tables/*.parts/_SPLIT_MANIFEST.json"):
240
+ manifest = json.loads(path.read_text())
241
+ base_path = "tables/" + path.parent.name.removesuffix(".parts")
242
+ manifests[base_path] = manifest
243
+ return manifests
244
+
245
+
246
+ def build_dataset(repo_id: str, raw_dir: Path, out_dir: Path) -> dict[str, Any]:
247
+ token = load_token()
248
+ api = HfApi(token=token)
249
+ info = api.dataset_info(repo_id, files_metadata=True)
250
+ raw_dir.mkdir(parents=True, exist_ok=True)
251
+
252
+ for sibling in info.siblings or []:
253
+ path = sibling.rfilename
254
+ if path == "README.md" or path.endswith("_SPLIT_MANIFEST.json"):
255
+ hf_hub_download(repo_id=repo_id, repo_type="dataset", filename=path, local_dir=raw_dir, token=token)
256
+
257
+ split_manifests = load_split_manifests(raw_dir)
258
+ sizes = {s.rfilename: int(getattr(s, "size", 0) or 0) for s in info.siblings or []}
259
+ source_sequence_counts: dict[str, int] = defaultdict(int)
260
+ source_sequence_bytes: dict[str, int] = defaultdict(int)
261
+ for path, size in sizes.items():
262
+ parsed = parse_path(path)
263
+ if parsed["is_sequence_shard"]:
264
+ source_sequence_counts[parsed["source_slug"]] += 1
265
+ source_sequence_bytes[parsed["source_slug"]] += size
266
+
267
+ top_level_tables = {
268
+ path: size for path, size in sizes.items() if path.startswith("tables/") and path.endswith(".jsonl") and ".parts/" not in path
269
+ }
270
+ logical_tables = dict(top_level_tables)
271
+ for base_path, manifest in split_manifests.items():
272
+ if base_path not in logical_tables:
273
+ logical_tables[base_path] = int(manifest["original_size"])
274
+
275
+ repo_file_count = len(sizes)
276
+ repo_total_bytes = sum(sizes.values())
277
+ sequence_shard_count_total = sum(1 for path in sizes if path.startswith("sequences/"))
278
+ sequence_shard_bytes_total = sum(size for path, size in sizes.items() if path.startswith("sequences/"))
279
+ table_repo_file_count_total = sum(1 for path in sizes if path.startswith("tables/"))
280
+ table_repo_bytes_total = sum(size for path, size in sizes.items() if path.startswith("tables/"))
281
+ logical_table_count_total = len(logical_tables)
282
+ logical_table_bytes_total = sum(logical_tables.values())
283
+
284
+ rows = []
285
+ for path in sorted(sizes):
286
+ if (
287
+ path.startswith("data/")
288
+ or path.startswith("metadata/")
289
+ or path.startswith("scripts/")
290
+ or path in {"_MANIFEST.json", "dataset_summary.json"}
291
+ ):
292
+ continue
293
+ size = sizes[path]
294
+ parsed = parse_path(path)
295
+ source_slug = parsed["source_slug"]
296
+ base_table_path = f"tables/{source_slug}" if source_slug.endswith(".jsonl") else ""
297
+ manifest = split_manifests.get(base_table_path) or {}
298
+ file_id = path
299
+ download_pattern = path
300
+ if parsed["role"] == "sequence_shard" and source_slug:
301
+ download_pattern = f"sequences/{source_slug}/shard-*.fasta.zst"
302
+ elif parsed["role"] in {"table_split_part", "table_split_manifest"} and source_slug:
303
+ download_pattern = f"tables/{source_slug}.parts/part-*.jsonl"
304
+ elif parsed["role"] == "table_jsonl" and source_slug:
305
+ download_pattern = f"tables/{source_slug}"
306
+ rows.append(
307
+ {
308
+ "file_id": file_id,
309
+ "repo_id": repo_id,
310
+ "source_sha": info.sha,
311
+ "dataset_id": DATASET_ID,
312
+ "source_family": parsed["source_family"],
313
+ "source_slug": source_slug,
314
+ "source_file": parsed["source_file"],
315
+ "path": path,
316
+ "role": parsed["role"],
317
+ "shard_index": parsed["shard_index"],
318
+ "part_index": parsed["part_index"],
319
+ "size_bytes": size,
320
+ "compression": compression_for_path(path),
321
+ "logical_table_size_bytes": int(logical_tables.get(base_table_path, -1)) if parsed["is_table_file"] else -1,
322
+ "split_part_count": len(manifest.get("parts", [])) if manifest else -1,
323
+ "split_chunk_bytes": int(manifest.get("chunk_bytes", -1)) if manifest else -1,
324
+ "sequence_source_shard_count": source_sequence_counts.get(source_slug, -1) if parsed["is_sequence_shard"] else -1,
325
+ "sequence_source_bytes": source_sequence_bytes.get(source_slug, -1) if parsed["is_sequence_shard"] else -1,
326
+ "repo_file_count": repo_file_count,
327
+ "repo_total_bytes": repo_total_bytes,
328
+ "sequence_shard_count_total": sequence_shard_count_total,
329
+ "sequence_shard_bytes_total": sequence_shard_bytes_total,
330
+ "table_repo_file_count_total": table_repo_file_count_total,
331
+ "table_repo_bytes_total": table_repo_bytes_total,
332
+ "logical_table_count_total": logical_table_count_total,
333
+ "logical_table_bytes_total": logical_table_bytes_total,
334
+ "is_sequence_shard": parsed["is_sequence_shard"],
335
+ "is_table_file": parsed["is_table_file"],
336
+ "is_split_part": parsed["is_split_part"],
337
+ "is_split_manifest": parsed["is_split_manifest"],
338
+ "is_original_table_copy": parsed["role"] == "table_jsonl" and base_table_path in split_manifests,
339
+ "download_pattern": download_pattern,
340
+ "access_note": "Default config indexes Mgnify files. Stream raw FASTA/table payloads from sequences/ and tables/ with huggingface_hub.",
341
+ "split_bucket": stable_bucket(file_id),
342
+ }
343
+ )
344
+
345
+ if out_dir.exists():
346
+ shutil.rmtree(out_dir)
347
+ data_dir = out_dir / "data"
348
+ metadata_dir = out_dir / "metadata"
349
+ data_dir.mkdir(parents=True, exist_ok=True)
350
+ metadata_dir.mkdir(parents=True, exist_ok=True)
351
+
352
+ train_rows = [row for row in rows if row["split_bucket"] != 0]
353
+ test_rows = [row for row in rows if row["split_bucket"] == 0]
354
+ pq.write_table(pa.Table.from_pylist(train_rows, schema=SCHEMA), data_dir / "train-00000-of-00001.parquet", compression="zstd")
355
+ pq.write_table(pa.Table.from_pylist(test_rows, schema=SCHEMA), data_dir / "test-00000-of-00001.parquet", compression="zstd")
356
+ pq.write_table(pa.Table.from_pylist(rows, schema=SCHEMA), metadata_dir / "source_files.parquet", compression="zstd")
357
+
358
+ role_counts = Counter(row["role"] for row in rows)
359
+ source_family_counts = Counter(row["source_family"] for row in rows if row["source_family"])
360
+ sequence_sources = {
361
+ source_slug: {"shards": source_sequence_counts[source_slug], "bytes": source_sequence_bytes[source_slug]}
362
+ for source_slug in sorted(source_sequence_counts)
363
+ }
364
+ logical_table_sources = {
365
+ path: {"bytes": int(size), "has_split_parts": path in split_manifests}
366
+ for path, size in sorted(logical_tables.items())
367
+ }
368
+ summary = {
369
+ "source": repo_id,
370
+ "source_sha": info.sha,
371
+ "viewer_table_scope": "file/shard index",
372
+ "data_format": "parquet",
373
+ "dataset_id": DATASET_ID,
374
+ "index_rows": len(rows),
375
+ "splits": {"train": len(train_rows), "test": len(test_rows)},
376
+ "split_strategy": "default file index uses deterministic sha256(file_id) % 10; bucket 0 is test, buckets 1-9 are train",
377
+ "repo_file_count": repo_file_count,
378
+ "repo_total_bytes": repo_total_bytes,
379
+ "sequence_source_count": len(sequence_sources),
380
+ "sequence_shard_count_total": sequence_shard_count_total,
381
+ "sequence_shard_bytes_total": sequence_shard_bytes_total,
382
+ "table_repo_file_count_total": table_repo_file_count_total,
383
+ "table_repo_bytes_total": table_repo_bytes_total,
384
+ "logical_table_count_total": logical_table_count_total,
385
+ "logical_table_bytes_total": logical_table_bytes_total,
386
+ "role_counts": dict(sorted(role_counts.items())),
387
+ "source_family_index_counts": dict(sorted(source_family_counts.items())),
388
+ "sequence_sources": sequence_sources,
389
+ "logical_table_sources": logical_table_sources,
390
+ "columns": INDEX_COLUMNS,
391
+ }
392
+ (out_dir / "_MANIFEST.json").write_text(json.dumps(summary, indent=2) + "\n", encoding="utf-8")
393
+ (out_dir / "dataset_summary.json").write_text(json.dumps(summary, indent=2) + "\n", encoding="utf-8")
394
+ return summary
395
+
396
+
397
+ def main() -> None:
398
+ parser = argparse.ArgumentParser()
399
+ parser.add_argument("--repo-id", default="LiteFold/Mgnify")
400
+ parser.add_argument("--raw-dir", type=Path, default=Path("LiteFold_Mgnify_raw"))
401
+ parser.add_argument("--out-dir", type=Path, default=Path("LiteFold_Mgnify_processed"))
402
+ args = parser.parse_args()
403
+ summary = build_dataset(args.repo_id, args.raw_dir, args.out_dir)
404
+ print(json.dumps(summary, indent=2))
405
+
406
+
407
+ if __name__ == "__main__":
408
+ main()