Back

General-purpose embeddings for long-read metagenomic sequences via β-VAE on multi-scale k-mer frequencies

Nielsen, T. N.; Lui, L. M.

2026-03-23 bioinformatics
10.64898/2026.03.19.713080 bioRxiv
Show abstract

Long-read metagenomics routinely produces millions of assembled contigs, creating a need for methods that organize sequences into biologically meaningful groups across samples and environments. We present a general-purpose compositional embedding for metagenomic sequences based on a {beta}-variational autoencoder ({beta}-VAE) trained on multi-scale k-mer frequencies (1-mers through 6-mers; 2,772 features with centered log-ratio transformation). The embedding compresses each contig into a 384-dimensional vector that preserves local compositional similarity, enabling similarity search and graph-based clustering from sequence composition alone. Through systematic comparison of fifteen models trained on up to 17.4 million contigs (525.5 Gbp) from brackish, terrestrial, and reference genome sources, we find that a small set of curated prokaryotic reference genomes (656,000 contigs) outperforms ten-fold larger domain-specific training sets, and that neither reconstruction loss nor Spearman correlation reliably predicts downstream clustering quality. On nearest-neighbor graphs, flow-based clustering (MCL) markedly outperforms modularity-based methods (Leiden), yielding 12,123 clusters from 154,041 contigs ([≥] 100 kbp) with 99.2% phylum-level purity confirmed by independent marker gene phylogenetics. Multi-method taxonomic annotation achieves 87% coverage and reveals that 16.4% of contigs are eukaryotic--the single largest component invisible to standard prokaryotic annotation tools. The embedding provides a sample-independent coordinate system for organizing metagenomic sequence space at scale.

Matching journals

The top 3 journals account for 50% of the predicted probability mass.