SpiecEasi 1.99.3
SpiecEasi now includes a convenience wrapper for dealing with multiple taxa sequenced on the same samples, such as 16S and ITS, as seen in Tipton, Müller, et. al. (2018). It assumes that each taxa is in its own data matrix and that all samples are in all data matrices in the same order.
Here’s an example run from the HMP2 project with 16S and Proteomics data:
First we load the data:
library(SpiecEasi)
library(phyloseq)
data(hmp2)
Run the cross-domain SPIEC-EASI pipeline:
se.hmp2 <- spiec.easi(list(hmp216S, hmp2prot), method='mb', nlambda=40,
lambda.min.ratio=1e-2, pulsar.params = list(thresh = 0.05))
Plot the network:
dtype <- c(rep(1,ntaxa(hmp216S)), rep(2,ntaxa(hmp2prot)))
plot(adj2igraph(getRefit(se.hmp2)), vertex.color=dtype+1, vertex.size=9)
unnamed-chunk-3-1.png
Multiple data types: You can analyze different types of microbiome data (e.g., 16S rRNA, ITS, metagenomics) or even different omics data types together.
Same samples: All data matrices must have the same samples in the same order.
Unified network: The result is a single network where nodes represent features from all data types, and edges represent associations between features across domains.
Visualization: Different node colors can be used to distinguish between different data types or domains.
# Example with custom data
# Assuming you have two data matrices with the same samples
data1 <- matrix(rpois(100*50, 10), 100, 50) # First data type
data2 <- matrix(rpois(100*30, 5), 100, 30) # Second data type
# Run cross-domain SPIEC-EASI
se.cross <- spiec.easi(list(data1, data2), method='mb',
lambda.min.ratio=1e-2, nlambda=20,
pulsar.params=list(rep.num=50))
# Create visualization with different colors for each domain
dtype <- c(rep(1, ncol(data1)), rep(2, ncol(data2)))
ig.cross <- adj2igraph(getRefit(se.cross))
plot(ig.cross, vertex.color=dtype+1, vertex.size=6)
unnamed-chunk-5-1.png
In cross-domain networks:
This approach is particularly useful for understanding how different components of the microbiome (e.g., bacteria vs. fungi) or different biological systems (e.g., microbiome vs. metabolome) interact.
Session info:
sessionInfo()
# R Under development (unstable) (2025-10-21 r88958)
# Platform: x86_64-apple-darwin20
# Running under: macOS Ventura 13.7.8
#
# Matrix products: default
# BLAS: /Library/Frameworks/R.framework/Versions/4.6-x86_64/Resources/lib/libRblas.0.dylib
# LAPACK: /Library/Frameworks/R.framework/Versions/4.6-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.1
#
# locale:
# [1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#
# time zone: America/New_York
# tzcode source: internal
#
# attached base packages:
# [1] stats graphics grDevices utils datasets methods base
#
# other attached packages:
# [1] phyloseq_1.55.0 igraph_2.2.1 Matrix_1.7-4 SpiecEasi_1.99.3
# [5] BiocStyle_2.39.0
#
# loaded via a namespace (and not attached):
# [1] gtable_0.3.6 shape_1.4.6.1 xfun_0.54
# [4] bslib_0.9.0 ggplot2_4.0.1 rhdf5_2.55.8
# [7] Biobase_2.71.0 lattice_0.22-7 rhdf5filters_1.23.0
# [10] vctrs_0.6.5 tools_4.6.0 generics_0.1.4
# [13] biomformat_1.39.0 stats4_4.6.0 parallel_4.6.0
# [16] tibble_3.3.0 cluster_2.1.8.1 pkgconfig_2.0.3
# [19] huge_1.3.5 data.table_1.17.8 RColorBrewer_1.1-3
# [22] S7_0.2.1 S4Vectors_0.49.0 lifecycle_1.0.4
# [25] farver_2.1.2 compiler_4.6.0 stringr_1.6.0
# [28] Biostrings_2.79.2 tinytex_0.57 Seqinfo_1.1.0
# [31] codetools_0.2-20 permute_0.9-8 htmltools_0.5.8.1
# [34] sass_0.4.10 yaml_2.3.10 glmnet_4.1-10
# [37] pillar_1.11.1 crayon_1.5.3 jquerylib_0.1.4
# [40] MASS_7.3-65 cachem_1.1.0 vegan_2.7-2
# [43] magick_2.9.0 iterators_1.0.14 foreach_1.5.2
# [46] nlme_3.1-168 tidyselect_1.2.1 digest_0.6.38
# [49] stringi_1.8.7 dplyr_1.1.4 reshape2_1.4.5
# [52] bookdown_0.45 splines_4.6.0 ade4_1.7-23
# [55] fastmap_1.2.0 grid_4.6.0 cli_3.6.5
# [58] magrittr_2.0.4 dichromat_2.0-0.1 survival_3.8-3
# [61] ape_5.8-1 scales_1.4.0 rmarkdown_2.30
# [64] XVector_0.51.0 multtest_2.67.0 pulsar_0.3.11
# [67] VGAM_1.1-13 evaluate_1.0.5 knitr_1.50
# [70] IRanges_2.45.0 mgcv_1.9-4 rlang_1.1.6
# [73] Rcpp_1.1.0 glue_1.8.0 BiocManager_1.30.27
# [76] BiocGenerics_0.57.0 jsonlite_2.0.0 R6_2.6.1
# [79] Rhdf5lib_1.33.0 plyr_1.8.9