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.

Hintikka, Jukka, Sanna Lensu, Elina Mäkinen, Sira Karvinen, Marjaana Honkanen, Jere Lindén, Tim Garrels, Satu Pekkala, and Leo Lahti. 2021. “Xylo-Oligosaccharides in Prevention of Hepatic Steatosis and Adipose Tissue Inflammation: Associating Taxonomic and Metabolomic Patterns in Fecal Microbiomes with Biclustering.” International Journal of Environmental Research and Public Health 18 (8): 4049.
# Load the data
data(HintikkaXOData, package = "mia")
mae <- HintikkaXOData

We 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
Figure 20.1: Heatmap of Spearman correlations between log10-transformed abundances of prevalent bacterial families (rows) and NMR metabolite concentrations (columns) in the Hintikka et al. (2021) data. Colour shows the correlation and X marks correlations with adjusted p-value below 0.05.

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).

Bastiaanssen, Thomaz F. S., Thomas P. Quinn, and John F. Cryan. 2023. “Knowledge-Based Integration of Multi-Omic Datasets with Anansi: Annotation-Based Analysis of Specific Interactions.” arXiv. https://doi.org/10.48550/arXiv.2305.10832.
Gupta, Shashank, Veronica Quarato, Wanxin Lai, Carl M. Kobel, Velma T. E. Aho, Arturo Vera-Ponce de León, Sabina Leanti La Rosa, Simen R. Sandve, Phillip B. Pope, and Torgeir R. Hvidsten. 2026. “OmniCorr: An R-Package for Visualizing Putative Host-Microbiome Interactions Using Multi-Omics Data.” Bioinformatics Advances 6 (1): vbag057. https://doi.org/10.1093/bioadv/vbag057.
Exercises

Goal: After completing these exercises, you should be able to calculate associations between two omics.

Exercise 1: Cross-association

  1. Load any of the example datasets in MultiAssayExperiment format mentioned in Section 4.2.

  2. Agglomerate microbiota data to prevalent phyla.

  3. Apply the CLR transformation to microbiota data.

  4. Apply the relative and log10 transformations to the other omic data.

  5. Calculate correlations between the different omics data.

  6. Visualize the results with a heatmap.

  7. Are there taxonomic features that associate with the features of the other omic? Do a literature search for the function of the features that show associations. Do the associations make sense in light of the literature?

Useful functions:

utils::data(), mia::agglomerateByPrevalence, mia::transformAssay(), mia::getCrossAssociation(), ComplexHeatmap::Heatmap()

Back to top