This vignette demonstrates the core OmniCorr
workflow using the salmon multi-omics dataset
(which serves as the main example in the OmniCorr manuscript).
Main steps shown in this document:
All preprocessing steps (from raw sequencing → processed data)
are provided separately in the raw-data/ directory of the
repository.
The example datasets distributed with OmniCorr were generated from:
Complete preprocessing workflows (normalization, filtering, WGCNA-based feature clustering, etc.) are documented in:
raw-data/
├── transcriptomics/
│ └── Transcriptomics_preprocessing.Rmd
├── metagenomics/
│ └── Metagenomics_preprocessing.Rmd
└── metatranscriptomics/
└── Metatranscriptomics_preprocessing.Rmd
The final processed objects are saved as .rda files and
shipped with the package.
Each dataset contains:
All omics layers must contain exactly the same samples in the same order.
# Quick check
all(
rownames(Transcriptomics) == rownames(Metagenomics) &
rownames(Transcriptomics) == rownames(Metatranscriptomics)
)
#> [1] TRUEIf order is wrong / samples are missing → use the helper function:
df_list <- check_sample_order(Transcriptomics, Metagenomics)
#> Sample order aligned successfully.
Transcriptomics <- df_list$df1
Metagenomics <- df_list$df2
df_list <- check_sample_order(Transcriptomics, Metatranscriptomics)
#> Sample order aligned successfully.
Transcriptomics <- df_list$df1
Metatranscriptomics <- df_list$df2library(WGCNA)
#> Loading required package: dynamicTreeCut
#> Loading required package: fastcluster
#>
#> Attaching package: 'fastcluster'
#> The following object is masked from 'package:stats':
#>
#> hclust
#>
#> Attaching package: 'WGCNA'
#> The following object is masked from 'package:stats':
#>
#> cor
dendro <- hclust(
d = as.dist(1 - bicor(Transcriptomics, maxPOutliers = 0.05)),
method = "ward.D2"
)library(pheatmap)
tx_heatmap <- pheatmap(
t(Transcriptomics),
cluster_rows = dendro,
cluster_cols = FALSE,
show_rownames = FALSE,
main = "Transcriptomics"
)Interpretation: The transcriptomics heatmap provides an overview of variation in transcriptomic features across salmon samples. Each row represents a transcriptomic feature, and each column represents a sample. Features are hierarchically clustered according to their correlation patterns, so features with similar profiles across samples are positioned closer together.
This clustering defines a common feature order that is maintained in the subsequent cross-omics correlation heatmaps. Consequently, users can examine whether groups of transcriptomic features showing similar abundance patterns are also associated with particular microbial taxa or metatranscriptomic features.
# Transcriptomics ↔ Metagenomics
corr_mg <- calculate_correlations(
df1 = Transcriptomics,
df2 = Metagenomics,
show_significance = "stars"
)
# Transcriptomics ↔ Metatranscriptomics
corr_mt <- calculate_correlations(
df1 = Transcriptomics,
df2 = Metatranscriptomics,
show_significance = "stars"
)Each result contains:
$correlation$p_value$p_value_adj$signif_matrix (the stars/symbols matrix)library(RColorBrewer)
heatmap_colors <- colorRampPalette(rev(brewer.pal(11, "RdBu")))(51)
# Metagenomics correlations
hm_mg <- pheatmap(
corr_mg$correlation,
color = heatmap_colors,
cluster_rows = dendro,
display_numbers = corr_mg$signif_matrix,
breaks = seq(-1, 1, length.out = 51),
show_rownames = FALSE,
legend = FALSE,
main = "Metagenomics"
)
# Metatranscriptomics correlations
hm_mt <- pheatmap(
corr_mt$correlation,
color = heatmap_colors,
cluster_rows = dendro,
display_numbers = corr_mt$signif_matrix,
breaks = seq(-1, 1, length.out = 51),
show_rownames = TRUE,
legend = TRUE,
main = "Metatranscriptomics"
)library(cowplot)
plot_grid(
tx_heatmap$gtable,
hm_mg$gtable,
hm_mt$gtable,
ncol = 3,
align = "h",
rel_widths = c(3, 1.3, 2.2)
)Interpretation: The combined heatmap allows users to explore associations between transcriptomic features and the two microbial omics layers. The transcriptomics heatmap is displayed alongside correlation heatmaps for metagenomics and metatranscriptomics, with the reference features aligned across panels.
In the correlation heatmaps, red indicates positive correlations,
whereas blue indicates negative correlations. Stronger colors correspond
to larger absolute correlation coefficients, while colors closer to
white indicate weaker associations. Significance stars indicate
statistical significance based on Benjamini–Hochberg false discovery
rate (FDR)-adjusted p-values: * for 0.01 < p_adj ≤ 0.05,
** for 0.001 < p_adj ≤ 0.01, and *** for
p_adj ≤ 0.001. Correlations without stars do not meet the FDR-adjusted
significance threshold of 0.05.
For example, a group of transcriptomic features showing positive correlations with particular metagenomic features may suggest coordinated variation between host gene expression and microbial abundance. Associations with metatranscriptomic features may provide additional information about microbial activity. These patterns can help identify candidate host–microbiome relationships for further investigation, although correlation alone does not establish causality.
# Exclude Anus_bleed because it has only 7 non-missing observations
metadata_filtered <- metadata[
, colnames(metadata) != "Anus_bleed",
drop = FALSE
]
corr_meta <- calculate_correlations(
df1 = Transcriptomics,
df2 = metadata_filtered,
use = "pairwise.complete.obs",
show_significance = "stars"
)
pheatmap(
corr_meta$correlation,
color = heatmap_colors,
cluster_rows = dendro,
display_numbers = corr_meta$signif_matrix,
breaks = seq(-1, 1, length.out = 51),
show_rownames = TRUE,
main = "Environmental variables / Metadata"
)Interpretation: This heatmap illustrates the correlations between transcriptomic features and the available sample metadata. Each cell represents the correlation between a transcriptomic feature and a metadata variable. Red indicates positive correlations, while blue indicates negative correlations, with stronger colors representing larger absolute correlation coefficients. Significance stars highlight associations meeting the statistical significance thresholds.
This visualization can help identify transcriptomic features associated with environmental or sample-level characteristics. For example, a positive correlation indicates that higher values of a metadata variable tend to occur alongside higher values of a transcriptomic feature, whereas a negative correlation indicates the opposite relationship.
These associations may help identify potential environmental influences on host gene expression or variables that should be considered when interpreting the cross-omics correlations. However, they should be interpreted as associations rather than evidence of direct biological effects.
The run_omnicorr() function integrates the reference
layer, comparison layers, and metadata into a combined heatmap.
salmon_heatmap <- run_omnicorr(
reference_layer = Transcriptomics,
comparison_layers = list(
Metagenomics = Metagenomics,
Metatranscriptomics = Metatranscriptomics
),
metadata = metadata_filtered,
reference_name = "Transcriptomics",
metadata_name = "Metadata",
use = "pairwise.complete.obs",
show_significance = "stars",
show_row_names = FALSE
)
#> ==================================================
#> OmniCorr Multi-Omics Integration
#> ==================================================
#> Samples: 36
#> Reference Features: 76
#> Sample alignment verified
#> Clustering reference features...
#> Clustering samples...
#> Computing metadata correlations...
#> Generating reference heatmap...
#> Computing correlations with Metagenomics...
#> Computing correlations with Metatranscriptomics...
#> Drawing final integrated heatmap...#> OmniCorr integration complete
#> ==================================================
Interpretation: The final OmniCorr heatmap brings together the transcriptomics reference layer, its correlations with metagenomics and metatranscriptomics, and associations with sample metadata in a single visualization. The shared reference-feature ordering allows users to compare patterns across the different omics layers.
To interpret the integrated heatmap, users can first identify groups of transcriptomic features with similar profiles and then examine whether these groups show consistent positive or negative correlations with microbial features. For example, a group of host transcriptomic features positively associated with metagenomic features may suggest a relationship between host gene expression and microbial community composition. If similar associations are also observed with metatranscriptomic features, they may provide additional evidence of coordinated host–microbiome variation.
The metadata panel provides further context by highlighting associations with sample characteristics. Together, these results can help prioritize candidate features and biological relationships for downstream analyses, such as functional enrichment or targeted validation. However, the correlations are exploratory and should not be interpreted as evidence of causality.
This vignette shows the core OmniCorr workflow using the salmon multi-omics example.
Where to look next:
raw-data/ folderdata())Good luck with your multi-omics integration projects! 🐟
sessionInfo()
#> R version 4.6.1 (2026-06-24)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.5 LTS
#>
#> Matrix products: default
#> BLAS: /home/biocbuild/bbs-3.24-bioc/R/lib/libRblas.so
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0 LAPACK version 3.12.0
#>
#> locale:
#> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
#> [3] LC_TIME=en_GB LC_COLLATE=C
#> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
#> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
#> [9] LC_ADDRESS=C LC_TELEPHONE=C
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
#>
#> time zone: America/New_York
#> tzcode source: system (glibc)
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] cowplot_1.2.0 RColorBrewer_1.1-3 pheatmap_1.0.13
#> [4] WGCNA_1.74 fastcluster_1.3.0 dynamicTreeCut_1.63-1
#> [7] OmniCorr_1.0.0
#>
#> loaded via a namespace (and not attached):
#> [1] tidyselect_1.2.1 dplyr_1.2.1 farver_2.1.2
#> [4] S7_1.0.0 fastmap_1.2.0 digest_0.6.39
#> [7] rpart_4.1.27 lifecycle_1.0.5 cluster_2.1.8.3
#> [10] Cairo_1.7-0 survival_3.8-13 magrittr_2.0.5
#> [13] compiler_4.6.1 rlang_1.3.0 Hmisc_5.3-1
#> [16] sass_0.5.0 tools_4.6.1 yaml_2.3.12
#> [19] data.table_1.18.6.1 knitr_1.52 htmlwidgets_1.6.4
#> [22] withr_3.0.3 foreign_0.8-92 BiocGenerics_0.60.0
#> [25] nnet_7.3-21 grid_4.6.1 stats4_4.6.1
#> [28] preprocessCore_1.76.0 colorspace_2.1-4 ggplot2_4.0.4
#> [31] scales_1.4.0 iterators_1.0.14 dichromat_2.0-1
#> [34] cli_3.6.6 rmarkdown_2.32 crayon_1.5.3
#> [37] generics_0.1.4 otel_0.3.0 rstudioapi_0.19.0
#> [40] rjson_0.2.23 cachem_1.1.0 stringr_1.6.0
#> [43] splines_4.6.1 parallel_4.6.1 impute_1.88.0
#> [46] matrixStats_1.5.0 base64enc_0.1-6 vctrs_0.7.3
#> [49] Matrix_1.7-6 jsonlite_2.0.0 IRanges_2.48.0
#> [52] GetoptLong_1.1.1 S4Vectors_0.52.0 Formula_1.2-6
#> [55] htmlTable_2.5.0 clue_0.3-68 magick_2.9.1
#> [58] foreach_1.5.2 jquerylib_0.1.4 glue_1.8.1
#> [61] codetools_0.2-20 stringi_1.8.9 shape_1.4.6.1
#> [64] gtable_0.3.6 ComplexHeatmap_2.30.0 tibble_3.3.1
#> [67] pillar_1.11.1 htmltools_0.5.9 circlize_0.4.18
#> [70] R6_2.6.1 doParallel_1.0.17 evaluate_1.0.5
#> [73] lattice_0.23-1 png_0.1-9 backports_1.5.1
#> [76] bslib_0.12.0 Rcpp_1.1.2 gridExtra_2.3.1
#> [79] checkmate_2.3.4 xfun_0.62 pkgconfig_2.0.3
#> [82] GlobalOptions_0.1.4