omicverse-microbiome-meta-analysis
Installation
SKILL.md
OmicVerse Microbiome — Cross-cohort Meta-analysis
Goal
Take per-study microbiome AnnData objects (one per cohort, each from the 16S amplicon skill), stitch them into a single cross-cohort AnnData with combine_studies, then run per-study DA → cross-study meta-analysis with meta_da. Output is a single feature-level table with combined effect size, combined SE, p-value, BH-FDR, per-study count, and Cochran's I² heterogeneity — distinguishing features whose effect replicates across cohorts from cohort-specific signals.
The skill assumes the meta question is "does this contrast hold across cohorts?", not "is there an effect in any cohort". The latter is just running per-study DA and unioning hits — call that out as the wrong tool.
Quick Workflow
- Load (or build) per-cohort
AnnData— same conventions as the 16S amplicon skill (samples × ASVs, 7-rank SINTAX invar,obs[group_key]for the contrast). - Combine:
ov.micro.combine_studies([a, b, c], study_names=[...], rank='genus', study_key='study') → AnnData— collapses ASVs to a common rank (genus by default), unions features across studies (zero-fills cohort-specific features), tagsobs['study']. - Diagnostic Beta + PCoA on the combined object: confirms whether study effect dominates the disease effect — a useful sanity check before running meta_da. If PC1 colour-maps cleanly by
study, the cohort effect is large and meta_da's random-effects pooling is doing real work. - Per-study top hits (optional, for sanity): run
DA(a_g).deseq2(...)on each study independently, take top-5 by p-value; check whether the planted / known-true features appear in every cohort. - Meta-analysis:
ov.micro.meta_da([a, b, c], study_names=[...], group_key, group_a, group_b, method='deseq2'|'wilcoxon'|'ancombc', rank='genus', min_prevalence=0.1, combine='random_effects'|'fixed_effects') → pd.DataFramewithfeature,combined_lfc,combined_se,z,p_value,fdr_bh,n_studies,I2. - Plot the result: forest-style barh of top features (combined LFC ± 1.96·SE), colour-coding planted vs. cohort-specific vs. shared-noise features.
- Heterogeneity scatter: combined LFC × I² — high-I² features (>0.75) are reproducibly different in direction between cohorts (suspicious); low-I² features (<0.25) are coherent. Use this to flag which "significant" hits actually replicate.
- (Optional) Method × meta benchmark: re-run meta_da with
methodcycled over'wilcoxon' / 'deseq2' / 'ancombc', compare hit counts and the rank of known-true features across methods.