Skip to content
Yixuan39Public

About

Comparing proteins and metaproteomes in protein embedding space

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

embedome embedome website

R-CMD-check Codecov test coverage

Comparing proteins and metaproteomes in protein embedding space

embedome represents each sample as an abundance-weighted distribution over protein embeddings and compares samples with maximum mean discrepancy (MMD), giving a beta-diversity metric sensitive to structural and evolutionary relatedness rather than exact accession identity alone. The same embeddings group proteins into alignment-verified structural bins via Leiden clustering for abundance aggregation (bin_glom()) and limma differential abundance testing (limma-voom for spectral counts; limma-trend for LFQ intensities).

Structure-calibrated models (tmvec2 default over Lobster-24M, ~210 MB; and high-capacity tmvec over ProtT5-XL, ~10.9 GB) predict structural TM-score via cosine similarity for both fold-level beta diversity (sample_mmd()) and protein binning (protein_similarity(), bin_proteins()). Mean-pooled ESM-2 models (esm2-8m, esm2-150m, esm2-650m) measure continuous sequence-evolutionary beta diversity — a tree-free counterpart to Generalized/Weighted UniFrac across whole metaproteomes.

PCoA of 20 simulated samples under MMD, Bray-Curtis on proteins and Bray-Curtis on bins

On data(simulate_cog) (vignette("embedome")), 20 simulated samples share 100 background NCBI COG proteins (95% expected abundance), while each Group-A sample puts 5% expected abundance on its own <30%-identity GrpE (COG0576) homolog and each Group-B sample puts 5% on its own <30%-identity TpiA (COG0149) homolog (a single-sample-per-homolog design where accession-level tests have no replication by construction):

Distance R² p
MMD 0.257 0.001
Bray-Curtis (protein) 0.044 0.767
Bray-Curtis (bins) 0.227 0.001

Accession-level Bray-Curtis and per-protein limma (0 hits at q < 0.05) miss the shift because every enriched homolog appears in only one sample; MMD, bin-level Bray-Curtis, and bin_glom() + limma (limma-voom on counts, limma-trend on LFQ intensities) recover both GrpE and TpiA cleanly (q < 0.05, zero false positives). See Get started and the documentation and benchmark site for function reference, MMD power/null benchmarks, COG/CATH/EC4 clustering benchmarks, and a mouse gut metaproteomics case study.

Install

Requires R >= 4.5 on Linux, Apple Silicon macOS, or Windows (note: PyTorch >= 2.6 does not ship Intel macOS wheels, and default PyPI Windows wheels are CPU-only). Python, conda, and git are not required: on first call, embed_proteins() provisions an isolated, version-pinned Python (3.11.9) environment automatically via basilisk.

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install("Yixuan39/embedome", dependencies = TRUE)

Quick start

library(embedome)

# From files: proteins <- embed_proteins("proteins.fasta") # default: "tmvec2"
data(simulate_cog, package = "embedome")
proteins <- simulate_cog$proteins # AAStringSet with mcols()$embedding
counts   <- simulate_cog$counts   # samples x proteins (or SummarizedExperiment)
samples  <- simulate_cog$samples

# 1. Structure-aware beta diversity
D <- sample_mmd(counts, proteins)
vegan::adonis2(D ~ group, data = samples)
plot_pcoa(D, color = samples$group)

# 2. Alignment-verified protein bins & count aggregation
S <- protein_similarity(proteins)
set.seed(1)
bins <- bin_proteins(S)
bin_counts <- bin_glom(counts, bins)

License

MIT (LICENSE.md). Bundled simulation data provenance (public-domain NCBI COG 2024) and upstream model licenses: DATA_PROVENANCE.md.

About

Comparing proteins and metaproteomes in protein embedding space

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages