mgnify / README.md
jfosea's picture
Update README.md
354167b verified
|
Raw
History Blame Contribute Delete
7.79 kB
---
license: cc-by-4.0
task_categories:
- fill-mask
- feature-extraction
tags:
- protein
- proteins
- biology
- bioinformatics
- protein-language-model
- metagenomics
- fasta
- sequence-clustering
pretty_name: MGnify — FLAIR Preprocessed
size_categories:
- 1B<n<10B
configs:
- config_name: default
data_files:
- split: train
path: "train/*.parquet"
---
# Dataset Card for `flair-bio/mgnify`
## Dataset Summary
This dataset is a cleaned, deduplication-clustered, and quality-scored version of the **MGnify
peptide database** (EBI Metagenomics), a large collection of predicted protein sequences derived
from environmental metagenomic and metatranscriptomic assemblies. It has been reprocessed by the
[FLAIR](https://github.com/flair-bio/amplify) `modules/data` pipeline into a single
training-ready Parquet dataset (sharded), with per-sequence redundancy reduction (MMseqs2 cascaded
clustering) and quality scores (RED — Residue Embedding Diversity) added, for use in pretraining
protein language models (pLMs).
- **Curated by:** FLAIR (Mila / flair-bio)
- **Source data:** [MGnify peptide database, 2024_04 release](https://ftp.ebi.ac.uk/pub/databases/metagenomics/peptide_database/2024_04/) (EMBL-EBI)
- **Language(s):** Not applicable (protein sequences; FASTA header metadata is English free-text)
- **License:** [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) for the FLAIR-processed
release. The original MGnify data is made available by EMBL-EBI under open terms
([EBI Terms of Use](https://www.ebi.ac.uk/about/terms-of-use)); please review those terms for the
raw source data.
## Dataset Details
### Source Data & Provenance
The MGnify peptide database (2024_04 release) is distributed as 25 gzipped FASTA parts:
```
https://ftp.ebi.ac.uk/pub/databases/metagenomics/peptide_database/2024_04/mgy_proteins_{1..25}.fa.gz
```
Each part is downloaded with `aria2c` (2-way split per file, up to 3 files concurrently). Files
were fetched in **August 2026**; `2024_04` was the most recent dated release published upstream
at that time.
### Processing Pipeline
Processed by the shared FLAIR data pipeline
([`modules/data`](https://github.com/flair-bio/amplify/tree/main/modules/data)):
```
Download → Preprocess → Cluster → Score → Assemble → Upload
```
1. **Preprocess** — the 25 FASTA parts are decompressed, linearized, and concatenated into a
monolithic FASTA, split into `1,000,000`-sequence chunks, and converted to Parquet shards in
parallel. Each sequence is assigned a unique, collision-free ID of the form
`MGNIFY_000000000000` (a dataset prefix followed by a zero-padded 12-digit counter), with the
original FASTA header preserved as `description`.
2. **Cluster** — cascaded MMseqs2 (`easy-linclust`) redundancy reduction at identity thresholds
`[0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3]` (coverage threshold `0.8`), producing one cluster-
representative column per threshold.
3. **Score** — each sequence is scored with the **RED** (Residue Embedding Diversity) metric using
`flair-bio/amplify-350m` as the embedding model — a measure of how distinct/informative a
sequence's contextual residue embeddings are.
4. **Assemble** — base sequences, cluster assignments, and RED scores are joined on the shared
`sequence_id` into the final sharded Parquet dataset published here.
### Dataset Structure
One `train` split, stored as multiple Parquet shards (`train/*.parquet`).
| Column | Type | Description |
|---|---|---|
| `sequence_id` | string | Unique FLAIR-assigned ID (`MGNIFY_{12-digit counter}`) |
| `original_id` | string | Original MGnify sequence identifier |
| `description` | string | Remaining original FASTA header text |
| `sequence` | string | Protein sequence (amino acid string) |
| `cluster_rep_at_90` … `cluster_rep_at_30` | string | Cluster representative ID at each identity threshold (90%, 80%, 70%, 60%, 50%, 40%, 30%) |
| `dataset_id` | string | Source dataset identifier stamp (`mgnify`) |
| `sequence_length` | uint32 | Sequence length in residues |
| `red_score` | float16 | RED (Residue Embedding Diversity) quality score |
### Data Statistics
Computed over the full assembled dataset:
| Statistic | Value |
|---|---|
| Number of sequences | 2,444,174,488 |
| Sequence length — min / mean / median / max | 20 / 189.7 / 162.0 / 57,795 |
| Sequence length — std | 159.79 |
| Total residues (sum of lengths) | 4,183,014,619 |
| RED score — mean / median / std | 0.0194 / 0.0156 / 0.0202 |
| RED score — min / max | 3.25e-04 / 0.937 |
| RED score — p1 / p5 / p25 / p75 / p95 / p99 | 0.0029 / 0.0038 / 0.0069 / 0.0261 / 0.0461 / 0.0816 |
| Ambiguous residues (count) | 166,248,760 |
| Sequences containing ambiguous residues | 34,231,621 (4.0%) |
| Cluster count @ `cluster_rep_at_30` / `_at_60` / `_at_90` | 240,163,979 / 326,446,084 / 658,241,220 |
## Uses
Intended for self-supervised pretraining (e.g., masked language modeling) and representation
learning of protein language models. The `cluster_rep_at_*` columns allow downstream users to
subsample at a desired redundancy level (e.g., dedup at 30% identity for maximum diversity, or 90%
for near-duplicate-only removal), and `red_score` can be used to filter or weight sequences by
estimated informational diversity.
## Bias, Risks, and Limitations
- MGnify is a metagenomic database of environmental samples; sequence provenance, quality, and
functional annotation completeness vary widely and largely lack experimental validation.
- RED scores are a heuristic computed from a specific pLM's embeddings (`flair-bio/amplify-350m`)
and should not be interpreted as a ground-truth quality or functional label.
- Clustering provides an approximate indication of protein relatedness. These datasets use
MMseqs2 Linclust, and resulting clusters can vary depending on the clustering algorithm and
its parameters.
- Clustering thresholds reduce but do not eliminate redundancy; sequences sharing a cluster
representative at coarse thresholds (e.g., 30%) may still be highly similar within.
## Citation
If you use this dataset, please cite the original MGnify source, MMseqs2, RED, and FLAIR:
```bibtex
@article{steinegger2017mmseqs2,
title = {MMseqs2 enables sensitive protein sequence searching for the analysis of massive sequence datasets},
author = {Steinegger, Martin and S{\"o}ding, Johannes},
journal = {Nature Biotechnology},
volume = {35},
pages = {1026--1028},
year = {2017},
doi = {10.1038/nbt.3988}
}
```
```bibtex
@article{lebreton2026plm,
title = {pLM representations unlock metagenomic space beyond homology},
author = {Le Breton, Lola and Heurtel-Depeiges, David and Millar, Douglas C. and Zetzsche, Lara E. and Vernon, Robert M. and Langmead, Christopher James and Chandar, Sarath and Fournier, Quentin},
journal = {bioRxiv},
year = {2026},
doi = {10.64898/2026.07.28.739874}
}
```
```bibtex
@article{richardson2023mgnify,
title={MGnify: the microbiome sequence data analysis resource in 2023},
author={Richardson, Lorna and Allen, Ben and Baldi, Germana and Beracochea, Martin and Bileschi, Maxwell L and Burdett, Tony and Burgin, Josephine and Caballero-P{\'e}rez, Juan and Cochrane, Guy and Colwell, Lucy J and others},
journal={Nucleic acids research},
volume={51},
number={D1},
pages={D753--D759},
year={2023},
publisher={Oxford University Press}
}
```
```bibtex
@misc{flair-plm,
title = {FLAIR: Protein Language Model Pretraining Data Pipeline},
author = {{Applied Machine Learning Research Team (AMLRT) collaborators at Mila and FLAIR-bio research students}},
howpublished = {\url{https://github.com/flair-bio/amplify/tree/main/modules/data}},
}
```