20 Cross-association
Cross-association analysis is a straightforward approach that can reveal strength and type of associations between data sets. For instance, we can analyze if higher presence of a specific taxon relates to higher levels of a biomolecule. Correlation analyses within dataset were already discussed in Chapter 17.
In this chapter, we continue from where we left off in the previous section (Chapter 19). There, we tested whether the microbiome and the metabolite profiles of the Hintikka et al. (2021) dataset are globally associated. Next, we investigate associations between individual features.
# Load the data
data(HintikkaXOData, package = "mia")
mae <- HintikkaXODataWe agglomerate the data into prevalent bacteria families and apply logarithmic transformation.
# Agglomerate microbiome data at family level
mae[[1]] <- agglomerateByPrevalence(mae[[1]], rank = "Family", na.rm = TRUE)
# Does log10 transform for microbiome data
mae[[1]] <- transformAssay(mae[[1]], method = "log10", pseudocount = TRUE)Next we can perform a cross-association analysis. Let us analyze if individual bacteria genera are correlated with concentrations of individual metabolites. This helps to answer the following question: “If bacterium X is present, is the concentration of metabolite Y lower or higher”?
res <- getCrossAssociation(
mae,
experiment1 = 1,
experiment2 = 2,
assay.type1 = "log10",
assay.type2 = "nmr",
method = "spearman",
test.signif = TRUE,
p.adj.threshold = NULL,
cor.threshold = NULL,
mode = "matrix",
sort = TRUE,
show.warnings = FALSE
)Next, we create a heatmap depicting all cross-correlations between bacterial genera and metabolite concentrations (Figure 20.1).
library(ComplexHeatmap)
library(shadowtext)
# Function for marking significant correlations with "X"
add_signif <- function(j, i, x, y, width, height, fill) {
# If the p-value is under threshold
if (!is.na(res$p_adj[i, j]) & res$p_adj[i, j] < 0.05) {
# Print "X"
grid.shadowtext(
sprintf("%s", "X"), x, y,
gp = gpar(fontsize = 8, col = "#f5f5f5")
)
}
}
# Create a heatmap
p <- Heatmap(res$cor,
# Print values to cells
cell_fun = add_signif,
heatmap_legend_param = list(
title = "correlation", legend_height = unit(5, "cm")
),
column_names_rot = 45
)
p
Testing all feature pairs quickly leads to a large number of tests. Other tools address this in different ways. anansi restricts the analysis to biologically plausible feature pairs based on prior knowledge, such as functional annotations (Bastiaanssen, Quinn, and Cryan 2023). OmniCorr, on the other hand, first clusters co-varying features into modules and then correlates these modules across omic layers (Gupta et al. 2026).