flowchart LR
subgraph early["Early fusion"]
direction TB
e1["Omic 1"] & e2["Omic 2"] --> ec["Combined<br/>table"] --> em["Model"] --> ep(["Prediction"])
end
subgraph late["Late fusion"]
direction TB
l1["Omic 1"] --> b1["Base<br/>learner"]
l2["Omic 2"] --> b2["Base<br/>learner"]
b1 & b2 --> meta["Meta<br/>learner"] --> lp(["Prediction"])
end
subgraph inter["Intermediate fusion"]
direction TB
i1["Omic 1"] & i2["Omic 2"] --> im["Joint model,<br/>layers agree"] --> ip(["Prediction"])
end
early ~~~ late ~~~ inter
classDef omic fill:#ffffff,stroke:#6c757d,color:#070707
classDef model fill:#e6f3f7,stroke:#0087af,color:#070707
class e1,e2,l1,l2,i1,i2 omic
class ec,em,b1,b2,meta,im model
22 Supervised integration
In the previous chapter (Chapter 21), we integrated omic layers without using any information on the outcome. The aim was to find the main shared patterns of variation in the data. In supervised integration, the outcome, such as disease status or a treatment group, guides the analysis. The aim is to combine information from multiple omic layers to predict or classify the outcome, and to identify the features that contribute to the prediction.
Supervised integration builds on the concepts of machine learning (see the machine learning chapter in OMA extras). However, combining multiple omic layers brings additional challenges, as discussed in Introduction to multi-omics. For instance, the layers can differ in their scale, distribution, and number of features.
This chapter introduces two approaches for supervised integration: IntegratedLearner and DIABLO. IntegratedLearner works directly with MultiAssayExperiment data containers (Ramos et al. 2017), and we show a complete workflow with it. DIABLO does not yet support MultiAssayExperiment, so we describe the ideas behind it and point to further resources.
22.1 IntegratedLearner
IntegratedLearner is a framework for multi-omics prediction and classification (Mallick et al. 2024), available in the IntegratedLearner package. It builds on the SuperLearner package (van der Laan et al. 2007), which allows a wide range of machine learning algorithms to be used as the underlying models. IntegratedLearner supports early, late and intermediate fusion.
22.1.1 Fusion strategies
Multi-omic data can be combined in a predictive model at different stages. These strategies are often referred to as fusion strategies (Figure 22.1):
Early fusion combines all omic layers into a single table, for example, by concatenating the features. A single model is then trained on the combined table. The approach is simple, but the layers with the most features can dominate the model, and the differences between the layers are ignored.
Late fusion trains a separate model, i.e., a base learner, for each omic layer. The predictions of these models are then combined with a second-level model, i.e., a meta learner, which produces the final prediction. This approach is also known as stacking (Wolpert 1992). Each layer is modeled on its own terms, but interactions between the layers are not taken into account.
Intermediate fusion integrates the layers during the model fitting. For example, cooperative learning (Ding et al. 2022) encourages the predictions from different omic layers to agree with each other, which allows the model to exploit information shared between the layers.
22.1.2 Preparing the data
We use the Inflammatory Bowel Diseases (IBD) data from the Human Microbiome Project 2 (Lloyd-Price et al. 2019), which is available in the curatedMetagenomicData package. The aim is to classify the samples into IBD patients and healthy controls based on two omic layers: the abundances of species (taxonomic profiles) and of metabolic pathways (functional profiles).
library(curatedMetagenomicData)
library(dplyr)
library(mia)
# Select the samples of the study
samples <- sampleMetadata |>
filter(study_name == "HMP_2019_ibdmdb")
# Species and pathway abundances
tse_species <- returnSamples(samples, "relative_abundance", rownames = "short")
tse_pathway <- returnSamples(samples, "pathway_abundance", rownames = "short")
# Create a MultiAssayExperiment
mae <- MultiAssayExperiment(
ExperimentList(microbiota = tse_species, pathway = tse_pathway)
)
mae
## A MultiAssayExperiment object of 2 listed
## experiments with user-defined names and respective classes.
## Containing an ExperimentList class object of length 2:
## [1] microbiota: TreeSummarizedExperiment with 582 rows and 1627 columns
## [2] pathway: SummarizedExperiment with 22113 rows and 1627 columns
## Functionality:
## experiments() - obtain the ExperimentList instance
## colData() - the primary/phenotype DataFrame
## sampleMap() - the sample coordination DataFrame
## `$`, `[`, `[[` - extract colData columns, subset, or experiment
## *Format() - convert into a long or wide DataFrame
## assays() - convert ExperimentList to a SimpleList of matrices
## exportClass() - save data to flat filesIntegratedLearner matches the samples across the experiments by their column names, so each experiment should contain the same samples. intersectColumns() keeps only the samples that are found in all experiments.
mae <- intersectColumns(mae)Next, we check how the samples are divided between the groups.
table(mae[["microbiota"]]$disease)
##
## IBD healthy
## 1201 426The groups are of different sizes. With imbalanced groups, a model can achieve a high accuracy just by predicting the larger group, which should be taken into account when the performance of the model is assessed.
The pathway table contains, in addition to the abundances of the pathways, the abundances that HUMAnN could not assign to any pathway (UNMAPPED and UNINTEGRATED), and the pathway abundances divided between the species that contribute to them (rows with | in their name). We keep only the abundances of the pathways.
Microbiome data contains many rare features. We keep only the features that are present in at least 10% of the samples (see Section 8.6) and that vary between the samples, that is, have a standard deviation over zero. Finally, we apply the CLR transformation to both layers (see Chapter 10).
# Keep prevalent features that vary between samples
mae[["microbiota"]] <- addPrevalence(
mae[["microbiota"]], assay.type = "relative_abundance")
mae[["microbiota"]] <- addQC(
mae[["microbiota"]], assay.type = "relative_abundance", by = "rows")
mae[["microbiota"]] <- subsetBy(
mae[["microbiota"]],
rows = prevalence >= 0.1 & sd > 0
)
mae[["pathway"]] <- addPrevalence(
mae[["pathway"]], assay.type = "pathway_abundance")
mae[["pathway"]] <- addQC(
mae[["pathway"]], assay.type = "pathway_abundance", by = "rows")
mae[["pathway"]] <- subsetBy(
mae[["pathway"]],
rows = prevalence >= 0.1 & sd > 0
)
# Apply CLR transformation
mae[["microbiota"]] <- transformAssay(
mae[["microbiota"]],
assay.type = "relative_abundance", method = "clr", pseudocount = TRUE
)
mae[["pathway"]] <- transformAssay(
mae[["pathway"]],
assay.type = "pathway_abundance", method = "clr", pseudocount = TRUE
)After the filtering, the data contains 124 species and 358 pathways.
The data includes several samples from each subject. To estimate how well the model generalizes to new subjects, we select 20% of the subjects for a validation set, which is not used in training. All samples of a subject are placed in the same set.
set.seed(377)
# Subject of each sample
subject <- mae[["microbiota"]]$subject_id
names(subject) <- colnames(mae[["microbiota"]])
# Select 20% of the subjects for validation
subjects <- unique(subject)
valid_subjects <- sample(subjects, round(0.2 * length(subjects)))
# Match the samples in the order of the MultiAssayExperiment
is_valid <- subject[rownames(colData(mae))] %in% valid_subjects
# Split the data
mae_train <- mae[, !is_valid, ]
mae_valid <- mae[, is_valid, ]22.1.3 Fitting the model
We fit the model with IntegratedLearner(). First, a base learner is trained for each omic layer separately. Then, a meta learner combines the predictions of the base learners into the final prediction. We use random forest ("SL.randomForest") as the base learner and rank loss minimization ("sl_nnls_auc") as the meta learner. The outcome is binary, so we use the binomial family.
library(IntegratedLearner)
library(SuperLearner)
fit <- IntegratedLearner(
MAE_train = mae_train,
MAE_valid = mae_valid,
# Experiments and assays
experiment = c("microbiota", "pathway"),
assay.type = c("clr", "clr"),
# Columns of the sample metadata
outcome_col = "disease",
subject_id_col = "subject_id",
# Base and meta learners
base_learner = "SL.randomForest",
meta_learner = "sl_nnls_auc",
# Binary outcome
family = binomial()
)The result includes the following models:
-
Individual models (
microbiotaandpathway) are trained separately for each omic layer. - The stacked model (late fusion) combines the predictions of the individual models with the meta learner.
- The concatenated model (early fusion) is trained on all features of the layers combined.
22.1.4 Model performance
The performance of the models can be visualized with Receiver Operating Characteristic (ROC) curves (Figure 22.2). The curve shows the true positive rate against the false positive rate at different classification thresholds. The area under the curve (AUC) summarizes the performance: an AUC of 1 means a perfect classification, and an AUC of 0.5 a classification that is no better than chance. The upper panel shows the performance in the cross-validation of the training data, and the lower panel in the independent validation set.
p <- plot(fit)
p$plot
The AUC, the accuracy and the balanced accuracy of each model in the validation set are stored in the result. The balanced accuracy is the average of the accuracies within each group, so it is not affected by the imbalance of the groups.
fit$metrics.test
## model auc accuracy balanced_accuracy
## 1 microbiota 0.599 0.5949 0.5138
## 2 pathway 0.581 0.6289 0.5410
## 3 stacked 0.606 0.5892 0.5044
## 4 concatenated 0.621 0.6346 0.553822.1.5 Feature importance
To identify the features that contribute most to the prediction, we take the importance scores of the features from the random forest models of the individual layers. We then scale them by the weight that each layer has in the stacked model, which gives the importance of each feature in the final model (Figure 22.3).
library(miaViz)
# Feature importances of each layer, scaled by the weight of the layer
layers <- fit$model_fits$model_layers
importance <- rbind(
layers[["microbiota"]]$importance * fit$weights[["microbiota"]],
layers[["pathway"]]$importance * fit$weights[["pathway"]]
)
plotLoadings(importance, ncomponents = 1, n = 20, show.color = FALSE)
More details on modeling with IntegratedLearner, including intermediate fusion and other types of outcomes, can be found in the IntegratedLearner vignette.
22.2 DIABLO
DIABLO (Data Integration Analysis for Biomarker Discovery using Latent Variable Approaches for Omics Studies) is a supervised integration method implemented in the mixOmics package (Rohart et al. 2017; Singh et al. 2019). It extends sparse partial least squares discriminant analysis (sPLS-DA) (Lê Cao et al. 2011) to multiple omic layers. DIABLO identifies correlated features across the layers that discriminate between the outcome groups.
DIABLO does not yet support MultiAssayExperiment data containers. More information and examples can be found in the DIABLO manual and the mixOmics Bioconductor page.
22.3 Exercises
We use the HMP2 IBD data from curatedMetagenomicData, as in this chapter.
Solve the exercises in order, as each exercise continues from the previous one. Try to solve each exercise yourself before opening the solution.
