Loading multiWGCNA data using Bioconductor’s ExperimentHub

Example data for multiWGCNA is stored in ExperimentHub. Access it like this:

# Load expression matrix and metadata
library(ExperimentHub)
## Loading required package: BiocGenerics
## Loading required package: generics
## 
## Attaching package: 'generics'
## The following objects are masked from 'package:base':
## 
##     as.difftime, as.factor, as.ordered, intersect, is.element, setdiff,
##     setequal, union
## 
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
## 
##     anyDuplicated, aperm, append, as.data.frame, basename, cbind,
##     colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
##     get, grep, grepl, is.unsorted, lapply, Map, mapply, match, mget,
##     order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
##     rbind, Reduce, rownames, sapply, saveRDS, table, tapply, unique,
##     unsplit, which.max, which.min
## Loading required package: AnnotationHub
## Loading required package: BiocFileCache
## Loading required package: dbplyr
eh = ExperimentHub()
eh_query = query(eh, c("multiWGCNAdata"))

## download the autism data and metadata
autism_se = eh_query[["EH8219"]]
## see ?multiWGCNAdata and browseVignettes('multiWGCNAdata') for documentation
## downloading 1 resources
## retrieving 1 resource
## loading from cache
## require("SummarizedExperiment")

Now, proceed with the multiWGCNA analysis:

# Load multiWGCNA R package
library(multiWGCNA)
## Loading required package: ggalluvial
## Loading required package: ggplot2
# Obtain metadata
sampleTable = colData(autism_se)

# Randomly sample 2000 genes from the expression matrix
set.seed(1)
autism_se = autism_se[sample(rownames(autism_se), 2000),]

# Check the data
assays(autism_se)[[1]][1:5, 1:5]
##              GSM706412 GSM706413 GSM706414 GSM706415 GSM706416
## ILMN_1672121 11.034264 10.446682 11.473705 11.732849  11.43105
## ILMN_2151368 10.379812  9.969130  9.990030  9.542288  10.26247
## ILMN_1757569  9.426955  9.050024  9.347505  9.235251   9.38837
## ILMN_2400219 12.604047 12.886037 12.890658 12.446960  12.98925
## ILMN_2222101 12.385019 12.748229 12.418027 11.690253  13.10915
sampleTable
## DataFrame with 58 rows and 3 columns
##                Sample      Status      Tissue
##           <character> <character> <character>
## GSM706412   GSM706412      autism          FC
## GSM706413   GSM706413      autism          FC
## GSM706414   GSM706414      autism          FC
## GSM706415   GSM706415      autism          FC
## GSM706416   GSM706416      autism          FC
## ...               ...         ...         ...
## GSM706465   GSM706465    controls          TC
## GSM706466   GSM706466    controls          TC
## GSM706467   GSM706467    controls          TC
## GSM706468   GSM706468    controls          TC
## GSM706469   GSM706469    controls          TC
# Set the alpha level for statistical analyses and the soft power for network construction
alphaLevel = 0.05
softPower = 10

# If your sample traits include numbers that you'd like to be considered numerical 
# variables rather than categorical variables, set detectNumbers = TRUE
detectNumbers = FALSE

We now perform network construction, module eigengene calculation, module-trait correlation.

# Define our conditions for trait 1 (disease) and 2 (brain region)
conditions1 = unique(sampleTable[,2])
conditions2 = unique(sampleTable[,3])
# Construct the combined networks and all the sub-networks (autism only, controls only, FC only, and TC only)
# Same parameters as Tommasini and Fogel. BMC Bioinformatics
myNetworks = constructNetworks(autism_se, sampleTable, conditions1, conditions2, 
                                  networkType = "signed", TOMType = "unsigned", 
                                  power = softPower, minModuleSize = 100, maxBlockSize = 25000,
                                  reassignThreshold = 0, minKMEtoStay = 0, mergeCutHeight = 0,
                                  numericLabels = TRUE, pamRespectsDendro = FALSE, 
                                  deepSplit = 4, verbose = 3)

Carry on with the multiWGCNA analysis according to the generalWorkflow.Rmd vignette!

sessionInfo()
## R version 4.6.1 (2026-06-24)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 26.04.1 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.32.so;  LAPACK version 3.12.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [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: Etc/UTC
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] multiWGCNA_1.10.0           ggalluvial_0.12.6          
##  [3] ggplot2_4.0.3               SummarizedExperiment_1.42.0
##  [5] Biobase_2.72.0              GenomicRanges_1.64.0       
##  [7] Seqinfo_1.2.0               IRanges_2.46.0             
##  [9] S4Vectors_0.50.3            MatrixGenerics_1.24.0      
## [11] matrixStats_1.5.0           multiWGCNAdata_1.10.0      
## [13] ExperimentHub_3.2.2         AnnotationHub_4.2.2        
## [15] BiocFileCache_3.2.0         dbplyr_2.6.0               
## [17] BiocGenerics_0.58.1         generics_0.1.4             
## [19] BiocStyle_2.40.0           
## 
## loaded via a namespace (and not attached):
##   [1] RColorBrewer_1.1-3    sys_3.4.3             rstudioapi_0.19.0    
##   [4] jsonlite_2.0.0        magrittr_2.0.5        farver_2.1.2         
##   [7] rmarkdown_2.32        vctrs_0.7.3           memoise_2.0.1        
##  [10] base64enc_0.1-6       htmltools_0.5.9       S4Arrays_1.12.1      
##  [13] dynamicTreeCut_1.63-1 curl_8.0.0            SparseArray_1.12.3   
##  [16] Formula_1.2-6         sass_0.4.10           bslib_0.12.0         
##  [19] htmlwidgets_1.6.4     httr2_1.3.0           impute_1.86.0        
##  [22] cachem_1.1.0          buildtools_1.0.0      igraph_2.3.4         
##  [25] lifecycle_1.0.5       iterators_1.0.14      pkgconfig_2.0.3      
##  [28] Matrix_1.7-6          R6_2.6.1              fastmap_1.2.0        
##  [31] digest_0.6.39         colorspace_2.1-4      patchwork_1.3.2      
##  [34] AnnotationDbi_1.74.0  Hmisc_5.3-0           RSQLite_3.53.3       
##  [37] filelock_1.0.3        httr_1.4.9            polyclip_1.10-7      
##  [40] abind_1.4-8           compiler_4.6.1        rngtools_1.5.2       
##  [43] bit64_4.8.6           withr_3.0.3           doParallel_1.0.17    
##  [46] htmlTable_2.5.0       S7_0.2.2              backports_1.5.1      
##  [49] viridis_0.6.5         DBI_1.3.0             ggforce_0.5.0        
##  [52] MASS_7.3-66           rappdirs_0.3.4        DelayedArray_0.38.2  
##  [55] flashClust_1.1-4      tools_4.6.1           foreign_0.8-91       
##  [58] nnet_7.3-21           glue_1.8.1            grid_4.6.1           
##  [61] checkmate_2.3.4       cluster_2.1.8.3       gtable_0.3.6         
##  [64] tzdb_0.5.0            preprocessCore_1.74.0 tidyr_1.3.2          
##  [67] hms_1.1.4             data.table_1.18.6.1   WGCNA_1.74           
##  [70] tidygraph_1.3.1       XVector_0.52.0        ggrepel_0.9.8        
##  [73] BiocVersion_3.23.1    foreach_1.5.2         pillar_1.11.1        
##  [76] stringr_1.6.0         splines_4.6.1         dplyr_1.2.1          
##  [79] tweenr_2.0.3          lattice_0.23-1        survival_3.8-12      
##  [82] bit_4.6.0             tidyselect_1.2.1      maketools_1.3.2      
##  [85] Biostrings_2.80.2     knitr_1.52            gridExtra_2.3.1      
##  [88] xfun_0.61             graphlayouts_1.2.5    stringi_1.8.9        
##  [91] yaml_2.3.12           evaluate_1.0.5        codetools_0.2-20     
##  [94] ggraph_2.2.2          tibble_3.3.1          BiocManager_1.30.27  
##  [97] cli_3.6.6             rpart_4.1.27          jquerylib_0.1.4      
## [100] Rcpp_1.1.2            png_0.1-9             fastcluster_1.3.0    
## [103] parallel_4.6.1        readr_2.2.0           blob_1.3.0           
## [106] dcanr_1.28.0          doRNG_1.8.6.3         viridisLite_0.4.3    
## [109] scales_1.4.0          purrr_1.2.2           crayon_1.5.3         
## [112] rlang_1.3.0           cowplot_1.2.0         KEGGREST_1.52.2