CoolFace
Datasetpublic

LiteFold/Mgnify

MGnify Protein Catalogues The MGnify platform (https://www.ebi.ac.uk/metagenomics) facilitates the assembly, analysis and archiving of microbiome-derived nucleic acid sequences. The platform provides access to taxonomic assignments and functional annotations for nearly half a million analyses covering metabarcoding, metatranscriptomic, and metagenomic datasets, which are derived from a wide range of different environments. Over the past 3 years, MGnify has not only grown in… See the full description on the dataset page: https://huggingface.co/datasets/LiteFold/Mgnify.

sourceHugging Facecc-by-4.0updated 4mo agoView on Hugging Face
0likes698downloads
Dataset Card

MGnify Protein Catalogues

The MGnify platform (https://www.ebi.ac.uk/metagenomics) facilitates the assembly, analysis and archiving of microbiome-derived nucleic acid sequences. The platform provides access to taxonomic assignments and functional annotations for nearly half a million analyses covering metabarcoding, metatranscriptomic, and metagenomic datasets, which are derived from a wide range of different environments. Over the past 3 years, MGnify has not only grown in terms of the number of datasets contained but also increased the breadth of analyses provided, such as the analysis of long-read sequences. The MGnify protein database now exceeds 2.4 billion non-redundant sequences predicted from metagenomic assemblies. This collection is now organised into a relational database making it possible to understand the genomic context of the protein through navigation back to the source assembly and sample metadata, marking a major improvement. To extend beyond the functional annotations already provided in MGnify, we have applied deep learning-based annotation methods. The technology underlying MGnify's Application Programming Interface (API) and website has been upgraded, and we have enabled the ability to perform downstream analysis of the MGnify data through the introduction of a coupled Jupyter Lab environment. Oxford Academic In the protein structure prediction context, the MGnify protein database is most commonly used as the deep metagenomic component of MSA pipelines (alongside UniRef and BFD) for AlphaFold2 and related models, where its metagenome-derived sequences enrich poorly represented protein families.

Dataset Summary

MetricValue
Default index rows3,226
Default index columns34
Repository files indexed3,226
Repository bytes indexed3,156,136,546,084
Sequence source files26
Sequence shards3,148
Sequence shard bytes342,815,994,580
Logical table sources28
Logical table bytes2,380,980,172,257
Table files in repo76
Table repo bytes2,813,320,536,987

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.

Default Splits

The default index split is deterministic by file id:

sha256(file_id) % 10

Bucket 0 is test; buckets 1 through 9 are train.

SplitRows
train2,902
test324

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.

Loading With datasets

Load the default file/shard index:

python
from datasets import load_dataset

index = load_dataset("LiteFold/Mgnify")
print(index)
print(index["train"][0])

Load one split directly:

python
from datasets import load_dataset

train_index = load_dataset("LiteFold/Mgnify", split="train")

Find sequence shards for one source family:

python
from datasets import load_dataset

index = load_dataset("LiteFold/Mgnify", split="train")
mgy_clusters = index.filter(
    lambda row: row["role"] == "sequence_shard"
    and row["source_family"] == "mgy_clusters"
)
print(mgy_clusters[0]["download_pattern"])

Find split table parts:

python
from datasets import load_dataset

index = load_dataset("LiteFold/Mgnify", split="train")
parts = index.filter(lambda row: row["role"] == "table_split_part")
print(parts[0]["path"], parts[0]["size_bytes"])

Streaming Raw FASTA Shards

Download one source family with the Hub client:

python
from huggingface_hub import snapshot_download

local_dir = snapshot_download(
    repo_id="LiteFold/Mgnify",
    repo_type="dataset",
    allow_patterns=[
        "sequences/sequence_mgnify_current_release_mgy_clusters.fa.gz/shard-*.fasta.zst"
    ],
)
print(local_dir)

Stream a shard without downloading the whole source family:

python
from huggingface_hub import HfFileSystem
import zstandard as zstd

fs = HfFileSystem()
path = (
    "datasets/LiteFold/Mgnify/"
    "sequences/sequence_mgnify_current_release_mgy_clusters.fa.gz/"
    "shard-000001.fasta.zst"
)

dctx = zstd.ZstdDecompressor()
with fs.open(path, "rb") as f, dctx.stream_reader(f) as reader:
    chunk = reader.read(1 << 20)
    print(chunk[:200])

Downloading Raw Table Parts

For split tables, use the download_pattern column or a direct include pattern:

bash
hf download LiteFold/Mgnify --repo-type dataset \
  --include 'tables/sequence_mgnify_current_release_mgy_proteins_pfam.tsv.gz.jsonl.parts/part-*.jsonl' \
  --local-dir ./mgnify

For unsplit tables:

bash
hf download LiteFold/Mgnify --repo-type dataset \
  --include 'tables/sequence_mgnify_current_release_mgy_seq_metadata_2.tsv.gz.jsonl' \
  --local-dir ./mgnify

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.

Default Columns

ColumnDescription
file_idStable file identifier, currently the repository path.
repo_idHugging Face dataset repository id.
source_shaSource commit used to build the index.
dataset_idmgnify_proteins.
source_familyParsed source family such as mgy_clusters, mgy_proteins_1, or mgy_seq_metadata_2.
source_slugSource slug/path component used by the repository.
source_fileOriginal MGnify source path when derivable.
pathFile path in the repository.
roleFile role: sequence_shard, table_jsonl, table_split_part, table_split_manifest, readme, or git_attributes.
shard_indexFASTA shard index, otherwise -1.
part_indexSplit table part index, otherwise -1.
size_bytesFile size in bytes.
compressionFile/container format.
logical_table_size_bytesLogical source table size when applicable, otherwise -1.
split_part_countNumber of table split parts when applicable, otherwise -1.
split_chunk_bytesTarget split chunk size when applicable, otherwise -1.
sequence_source_shard_countNumber of shards in the sequence source, otherwise -1.
sequence_source_bytesTotal bytes for that sequence source, otherwise -1.
repo_file_countTotal repository files indexed.
repo_total_bytesTotal indexed repository bytes.
sequence_shard_count_totalTotal sequence shards.
sequence_shard_bytes_totalTotal sequence shard bytes.
table_repo_file_count_totalTotal table files in the repo, including split manifests and parts.
table_repo_bytes_totalTotal table repo bytes, including duplicated top-level and split files where both exist.
logical_table_count_totalLogical upstream table count.
logical_table_bytes_totalLogical upstream table bytes.
is_sequence_shardWhether the row is a FASTA shard.
is_table_fileWhether the row is a table file or table manifest.
is_split_partWhether the row is a split table part.
is_split_manifestWhether the row is a split manifest.
is_original_table_copyWhether a top-level table also has split parts.
download_patternGlob or exact path for downloading related payload files.
access_noteShort usage note.
split_bucketDeterministic bucket used for the default train/test split.

Files

  • data/*.parquet: default file/shard index for Dataset Viewer.
  • metadata/source_files.parquet: full index copy.
  • sequences/*/shard-*.fasta.zst: raw compressed MGnify FASTA shards.
  • tables/**/*.jsonl: raw normalized table payloads and split parts.
  • _MANIFEST.json: index build summary.
  • dataset_summary.json: same summary in a Dataset Viewer-adjacent file.
  • scripts/prepare_mgnify_dataset.py: script used to build the default index.

Source

Derived from LiteFold/Mgnify, originally sourced from EMBL-EBI MGnify.

License

CC BY 4.0.

Citation

@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 Curtis, Tom and Escobar-Zepeda, Alejandra and Gurbich, Tatiana A. and Kale, Varsha and Korobeynikov, Anton and Raj, Shriya and Rogers, Alexander B. and Sakharova, Ekaterina and Sanchez, Santiago and Wilkinson, Darren J. and Finn, Robert D.},
  journal   = {Nucleic Acids Research},
  volume    = {51},
  number    = {D1},
  pages     = {D753--D759},
  year      = {2023},
  publisher = {Oxford University Press},
  doi       = {10.1093/nar/gkac1080}
}