Putting the Two Tables Together

Workshop 2, Module 6

Why integrate?

So far, one table at a time

We ran every method this week twice, once on each table. Today we ask when to use both at once.

Questions that sound like they need both tables

  1. Does BV cause inflammation in the cervix?
  2. Which bacteria go with which host genes?
  3. Can I predict preterm birth better with both tables?
  4. Are there types of participants who look different in both the microbiome and the host?
  5. Is the host response the reason Gardnerella matters?
  6. Which genes are different in women with BV?

Sort them: predict, find shared patterns, explain a mechanism, or a one-table question.

Kinds of question, and where we cover them

the question is about reach for today
comparing groups one table at a time, grouped by the other next
explaining a mechanism a causal diagram first, then often a different study DAGs
finding features that move together CCA, PLS mixOmics
what is shared, and what belongs to one table MOFA MOFA
types of people who look alike in every table STATIS, mixKernel, SNF people, not features
predicting an outcome scores in one model, DIABLO DIABLO

Question 6 needs one table and a grouping. Questions 1 and 5 are about cause, and no method on this list answers them alone.

The simplest integration

Group on one table, test the other

You have already done this.

  • On Tuesday, the species table gave every sample a group: anaerobe-dominant or Lactobacillus-dominant.
  • On Wednesday, you tested the gene table against that group: 1,815 genes differ.
  • That is integration. Information from one table organised your analysis of the other.

Grouping throws information away

  • 0.49 and 0.51 end up in different groups.
  • 0.51 and 0.99 end up in the same group.
  • In exchange, you get a sentence you can say: “these genes differ between the two kinds of community.”

The methods later today keep more of the information, and their results are harder to put in one sentence.

Back up: what do we think causes what?

Draw it before you choose a method

A DAG (directed acyclic graph) is a drawing of what you think causes what.

  • A box for each thing, measured or not.
  • An arrow means “changing this would change that.”
  • A missing arrow is also a claim: that one thing has no direct effect on the other.

You draw it before you look at the data, from what you know about the biology.

Let’s draw one: preterm birth

  • What did we measure in each table, and where does each thing sit relative to preterm birth?
  • Which measurements are causes, and which are readouts of a cause?
  • What did we not measure that probably matters?

One version of that drawing

Grey boxes are things nobody in this cohort measured.

The DAG we used to build the outcome

The species and genes are real sequencing data. The outcome was built from these two causes and nothing else.

So what should combining do?

Two causes, no arrow between them. Predict before the next slide: does adding the second table help?

The two scores correlate at 0.03. That is a feature of how we built the data.

In real cohorts, an anaerobic community and an inflamed epithelium are strongly correlated.

The DAG predicted the lift

glm(preterm ~ micro_z + host_z,
    family = binomial)
  • Species table alone: AUC 0.77
  • Gene table alone: AUC 0.71
  • Both: AUC 0.84

Two independent causes, so each table adds something the other cannot.

In real data, expect a smaller lift

  • If anaerobes cause inflammation, part of the microbiome’s effect travels through the host. The gene table then already carries it.
  • Adding the species table would add less, even though the bacteria matter.
  • “Doesn’t improve the prediction” is not the same as “doesn’t matter.”

Predictive is not causal

Rank by AUC and you would call Nugent and IL-1β drivers of preterm birth. In the model that made these data, neither one does anything.

Prediction is not mechanism

  • The features a method selects are the ones that predict or move together, not the ones that cause.
  • That includes loading plots, top-feature lists and networks.
  • Drawing a DAG, and then building a model from it, is how you start to ask about cause.

Workshop 3 will focus on modelling and uncertainty, in April 2027.

Quick check

A tour of mixOmics

A good place to learn the rest: mixomics.org

Most of what follows is a small tour of methods from mixOmics, with a couple of alternatives that are not on that site.

method the question on mixOmics
CCA, PLS, sparse PLS which features move together across two tables? yes
MOFA what structure is shared, and what belongs to one table? no
STATIS, mixKernel, SNF which people look alike across every table? mixKernel is a companion
DIABLO which features from both tables separate the groups? yes
two scores in one model does the second table add to the prediction? no

Patterns shared by two tables: CCA and PLS

Find a mix of species and a mix of genes that move together

  • Sparse PLS picks 10 species and 50 genes, and weights them so the two mixes rise and fall together across people.
  • No outcome goes in.
  • Coloured afterwards by community: the shared axis is Lactobacillus against anaerobes.

CCA chases correlation, PLS chases correlation times spread

  • CCA finds the mixes with the highest correlation. With 2,000 genes and 157 people it can always reach a perfect one, so it needs a penalty (regularised CCA).
  • PLS also rewards a mix whose values spread widely.
  • Genes that rise and fall together add up to a big spread, so PLS goes after large groups of co-expressed genes.

The genes it picked move together far more than random genes.

The genes it picks are representatives of a group

  • 338 different genes were picked at least once. None was picked every time.
  • Among genes that move together, small changes in the data swap which ones get picked.
  • A gene missing from the list may have lost to a neighbour. Check how it correlates with the component.

MOFA: what is shared, and what belongs to one table

Factors, and which tables each one lives in

  • MOFA (multi-omics factor analysis) is like a PCA run on all the tables at once.
  • Each factor is an axis of variation across people. MOFA reports how much of each table that factor explains.
  • Shared factors (Factor 1) show up in both tables. Table-specific factors (Factors 2 to 4) show up in only one.
  • There is no outcome inside the model.

Where MOFA fits

  • You test the factors afterwards against the outcome, the RNA batch, age and visit. A factor that tracks the batch is something to catch, not a finding.
  • In our data, the host inflammation lives only in the gene table. MOFA would show it as a gene-only factor, next to the shared Lactobacillus axis.
  • The methods that are built to find shared signal tend to hide a signal that lives in one table. DIABLO is one of them.
  • MOFA is not part of mixOmics. See the MOFA site for tutorials.

Another route: compare people, not features

Each table becomes a map of who looks like whom

  • Each table becomes one people × people similarity matrix, using any distance: UniFrac, Bray–Curtis, correlation.
  • The matrices are combined into one:
    • STATIS / DISTATIS: a weighted average; tables that agree with the others count more.
    • mixKernel: the same idea with kernels, from the mixOmics team.
    • SNF: shares similarity through each person’s nearest neighbours, then clusters people.

Features or people: two places to start

starts from methods gives you
the tables of features PCA, MOFA, sparse PLS, DIABLO axes of variation, and a weight for every feature
a similarity matrix per table STATIS, DISTATIS, mixKernel, SNF a map or clusters of people
  • Starting from people, a table with 2,000 genes and one with 30 species each give one matrix, so the big table does not drown the small one.
  • The price: features come back only indirectly, and every person needs every table.
  • Weighting by agreement turns down a table that tells a different story, and that story may be the finding.

DIABLO: features from both tables that separate the groups

Two goals, added together

DIABLO builds a mix of species and a mix of genes. It scores each pair on:

  1. how well each mix separates preterm from term, plus
  2. how well the two mixes agree with each other, times a weight called the design, from 0 to 1.

At design 0 it fits each table on its own. Higher values push the two tables toward a shared axis, possibly at the cost of separation.

Here, more agreement cost nothing. In data with a strong signal in only one table, it can.

With 2,000 genes, any labels separate

Cross-validated AUC, predicting people the model did not see: real labels 0.72, shuffled labels 0.43. Only the cross-validated number tells them apart.

Loadings are the recipe, not a ranking

  • The bars say what the component is made of. IL6, THBD and ORM1 on the preterm side: this axis is inflammation, the signal we built in.
  • They are not the genes that differ most between groups. A gene’s bar depends on its group of co-expressed neighbours, and on which neighbour won the selection.
  • For “which genes differ?”, use Wednesday’s test.

Did DIABLO beat two numbers in a glm?

# one row per person, values averaged over the 3 visits
glm(preterm ~ anaerobe_fraction + inflammation_score,
    family = binomial)

block.splsda(list(species = clr_species,       # 10% prevalence
                  genes   = top_2000_genes),   # most variable
             outcome, ncomp = 2, design = 0.1,
             keepX = list(species = c(10, 10), genes = c(50, 50)))
  • Each table alone: about 0.72. Together: 0.80. The tables carry different information, as the DAG said.
  • Two hand-picked scores in a glm: 0.83.
  • The simple model wins, because we gave it what we knew: which gene set means inflammation.

Three things not to conclude

  • “This gene wasn’t selected, so it doesn’t matter.” It may have lost to a co-expressed neighbour.
  • “The species table didn’t improve the prediction, so the microbiome doesn’t matter.” Its effect may already be carried by the genes.
  • “DIABLO separates community types perfectly.” Never use an outcome that was built from one of the tables. Community type comes from the species counts, so that table separates it by construction.

What we can and can’t claim

All of them can overfit

With 157 people and over 2,000 features, you can find a combination that separates any two groups, as the shuffled labels showed.

Every number you report should come from people the model did not see: cross-validation, or better, a separate cohort.

Any step that looks at the labels, including choosing features or settings, goes inside the cross-validation.

Our own result, with its limits

  • We chose both scores after looking at the data all week.
  • Fitted and tested on the same people: AUC 0.84, 95% interval 0.78 to 0.91.
  • Cross-validated: 0.83.
  • We never tested it in a second cohort.

The improvement is real. Report its size with the interval, and say how the scores were chosen.

Quick check

Further reading

  • mixomics.org, for CCA, PLS and DIABLO, with good vignettes
  • MOFA, if you have several tables and enough people
  • Modern Statistics for Modern Biology, Holmes and Huber, free online
  • The longer methods deck linked from this module’s page

Then: your presentations

Thirty minutes to finish preparing. Then each Study A group pairs with the Study B group of the same number: A1 presents to B1 for 30 minutes, then B1 presents to A1.

Tell the other group what you asked, what you found, and what you do not believe about your own result.