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

# Load expression matrix and metadata
library(ExperimentHub)
## Loading required package: BiocGenerics
## 
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
## 
##     Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
##     as.data.frame, basename, cbind, colnames, dirname, do.call,
##     duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
##     lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
##     pmin.int, rank, rbind, rownames, sapply, setdiff, table, tapply,
##     union, 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
## 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 Under development (unstable) (2023-10-22 r85388)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 22.04.3 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.19-bioc/R/lib/libRblas.so 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.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] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] multiWGCNA_1.1.0            ggalluvial_0.12.5          
##  [3] ggplot2_3.4.4               SummarizedExperiment_1.33.0
##  [5] Biobase_2.63.0              GenomicRanges_1.55.1       
##  [7] GenomeInfoDb_1.39.1         IRanges_2.37.0             
##  [9] S4Vectors_0.41.1            MatrixGenerics_1.15.0      
## [11] matrixStats_1.1.0           multiWGCNAdata_1.1.2       
## [13] ExperimentHub_2.11.0        AnnotationHub_3.11.0       
## [15] BiocFileCache_2.11.1        dbplyr_2.4.0               
## [17] BiocGenerics_0.49.1         BiocStyle_2.31.0           
## 
## loaded via a namespace (and not attached):
##   [1] rstudioapi_0.15.0             jsonlite_1.8.7               
##   [3] magrittr_2.0.3                rmarkdown_2.25               
##   [5] zlibbioc_1.49.0               vctrs_0.6.4                  
##   [7] memoise_2.0.1                 RCurl_1.98-1.13              
##   [9] base64enc_0.1-3               htmltools_0.5.7              
##  [11] S4Arrays_1.3.0                dynamicTreeCut_1.63-1        
##  [13] curl_5.1.0                    SparseArray_1.3.1            
##  [15] Formula_1.2-5                 sass_0.4.7                   
##  [17] bslib_0.5.1                   htmlwidgets_1.6.2            
##  [19] impute_1.77.0                 cachem_1.0.8                 
##  [21] igraph_1.5.1                  mime_0.12                    
##  [23] lifecycle_1.0.4               iterators_1.0.14             
##  [25] pkgconfig_2.0.3               Matrix_1.6-3                 
##  [27] R6_2.5.1                      fastmap_1.1.1                
##  [29] GenomeInfoDbData_1.2.11       shiny_1.7.5.1                
##  [31] digest_0.6.33                 colorspace_2.1-0             
##  [33] patchwork_1.1.3               AnnotationDbi_1.65.2         
##  [35] Hmisc_5.1-1                   RSQLite_2.3.3                
##  [37] filelock_1.0.2                fansi_1.0.5                  
##  [39] httr_1.4.7                    abind_1.4-5                  
##  [41] compiler_4.4.0                rngtools_1.5.2               
##  [43] bit64_4.0.5                   withr_2.5.2                  
##  [45] doParallel_1.0.17             htmlTable_2.4.2              
##  [47] backports_1.4.1               DBI_1.1.3                    
##  [49] rappdirs_0.3.3                DelayedArray_0.29.0          
##  [51] flashClust_1.01-2             tools_4.4.0                  
##  [53] foreign_0.8-85                interactiveDisplayBase_1.41.0
##  [55] httpuv_1.6.12                 nnet_7.3-19                  
##  [57] glue_1.6.2                    promises_1.2.1               
##  [59] grid_4.4.0                    checkmate_2.3.0              
##  [61] cluster_2.1.4                 generics_0.1.3               
##  [63] gtable_0.3.4                  tzdb_0.4.0                   
##  [65] preprocessCore_1.65.0         hms_1.1.3                    
##  [67] data.table_1.14.8             WGCNA_1.72-1                 
##  [69] utf8_1.2.4                    XVector_0.43.0               
##  [71] ggrepel_0.9.4                 BiocVersion_3.19.1           
##  [73] foreach_1.5.2                 pillar_1.9.0                 
##  [75] stringr_1.5.0                 later_1.3.1                  
##  [77] splines_4.4.0                 dplyr_1.1.3                  
##  [79] lattice_0.22-5                survival_3.5-7               
##  [81] bit_4.0.5                     tidyselect_1.2.0             
##  [83] GO.db_3.18.0                  Biostrings_2.71.1            
##  [85] knitr_1.45                    gridExtra_2.3                
##  [87] bookdown_0.36                 xfun_0.41                    
##  [89] stringi_1.8.1                 yaml_2.3.7                   
##  [91] evaluate_0.23                 codetools_0.2-19             
##  [93] tibble_3.2.1                  BiocManager_1.30.22          
##  [95] cli_3.6.1                     rpart_4.1.21                 
##  [97] xtable_1.8-4                  munsell_0.5.0                
##  [99] jquerylib_0.1.4               Rcpp_1.0.11                  
## [101] png_0.1-8                     fastcluster_1.2.3            
## [103] parallel_4.4.0                ellipsis_0.3.2               
## [105] readr_2.1.4                   blob_1.2.4                   
## [107] dcanr_1.19.0                  doRNG_1.8.6                  
## [109] bitops_1.0-7                  scales_1.2.1                 
## [111] purrr_1.0.2                   crayon_1.5.2                 
## [113] rlang_1.1.2                   cowplot_1.1.1                
## [115] KEGGREST_1.43.0