``` r
picked_power = 9
temp_cor <- cor       
cor <- WGCNA::cor         # Force it to use WGCNA cor function (fix a namespace conflict issue)
netwk_Apul <- blockwiseModules(datExpr,                # <= input here

                          # == Adjacency Function ==
                          power = picked_power,                # <= power here
                          networkType = "signed",

                          # == Tree and Block Options ==
                          deepSplit = 2,
                          pamRespectsDendro = F,
                          # detectCutHeight = 0.75,
                          minModuleSize = 30,
                          maxBlockSize = 5000,

                          # == Module Adjustments ==
                          reassignThreshold = 1e-6,
                          mergeCutHeight = 0.15,

                          # == TOM == Archive the run results in TOM file (saves time)
                          saveTOMs = F,
                          saveTOMFileBase = "ER",

                          # == Output Options
                          numericLabels = T,
                          verbose = 3)
```

```
 Calculating module eigengenes block-wise from all genes
   Flagging genes and samples with too many missing values...
    ..step 1
 ....pre-clustering genes to determine blocks..
   Projective K-means:
   ..k-means clustering..
   ..merging smaller clusters...
Block sizes:
gBlocks
   1    2    3    4    5    6    7    8    9 
4996 4988 4984 4553 4489 3683 3437 2716 2629 
 ..Working on block 1 .
    TOM calculation: adjacency..
    ..will use 48 parallel threads.
     Fraction of slow calculations: 0.000000
    ..connectivity..
    ..matrix multiplication (system BLAS)..
    ..normalization..
    ..done.
 ....clustering..
 ....detecting modules..
 ....calculating module eigengenes..
 ....checking kME in modules..
     ..removing 21 genes from module 1 because their KME is too low.
 ..Working on block 2 .
    TOM calculation: adjacency..
    ..will use 48 parallel threads.
     Fraction of slow calculations: 0.000000
    ..connectivity..
    ..matrix multiplication (system BLAS)..
    ..normalization..
    ..done.
 ....clustering..
 ....detecting modules..
 ....calculating module eigengenes..
 ....checking kME in modules..
     ..removing 4 genes from module 1 because their KME is too low.
     ..removing 2 genes from module 2 because their KME is too low.
     ..removing 2 genes from module 4 because their KME is too low.
 ..Working on block 3 .
    TOM calculation: adjacency..
    ..will use 48 parallel threads.
     Fraction of slow calculations: 0.000000
    ..connectivity..
    ..matrix multiplication (system BLAS)..
    ..normalization..
    ..done.
 ....clustering..
 ....detecting modules..
 ....calculating module eigengenes..
 ....checking kME in modules..
     ..removing 45 genes from module 1 because their KME is too low.
     ..removing 19 genes from module 2 because their KME is too low.
     ..removing 7 genes from module 3 because their KME is too low.
     ..removing 7 genes from module 4 because their KME is too low.
     ..removing 16 genes from module 5 because their KME is too low.
     ..removing 4 genes from module 6 because their KME is too low.
     ..removing 28 genes from module 7 because their KME is too low.
     ..removing 14 genes from module 8 because their KME is too low.
     ..removing 3 genes from module 9 because their KME is too low.
     ..removing 1 genes from module 10 because their KME is too low.
     ..removing 5 genes from module 11 because their KME is too low.
     ..removing 2 genes from module 12 because their KME is too low.
     ..removing 1 genes from module 13 because their KME is too low.
     ..removing 5 genes from module 16 because their KME is too low.
     ..removing 1 genes from module 21 because their KME is too low.
     ..removing 1 genes from module 26 because their KME is too low.
 ..Working on block 4 .
    TOM calculation: adjacency..
    ..will use 48 parallel threads.
     Fraction of slow calculations: 0.000000
    ..connectivity..
    ..matrix multiplication (system BLAS)..
    ..normalization..
    ..done.
 ....clustering..
 ....detecting modules..
 ....calculating module eigengenes..
 ....checking kME in modules..
     ..removing 73 genes from module 1 because their KME is too low.
     ..removing 18 genes from module 2 because their KME is too low.
     ..removing 2 genes from module 3 because their KME is too low.
     ..removing 3 genes from module 4 because their KME is too low.
     ..removing 13 genes from module 5 because their KME is too low.
     ..removing 4 genes from module 7 because their KME is too low.
     ..removing 7 genes from module 8 because their KME is too low.
     ..removing 5 genes from module 9 because their KME is too low.
     ..removing 2 genes from module 10 because their KME is too low.
     ..removing 1 genes from module 11 because their KME is too low.
     ..removing 1 genes from module 12 because their KME is too low.
     ..removing 1 genes from module 15 because their KME is too low.
     ..removing 1 genes from module 19 because their KME is too low.
 ..Working on block 5 .
    TOM calculation: adjacency..
    ..will use 48 parallel threads.
     Fraction of slow calculations: 0.000000
    ..connectivity..
    ..matrix multiplication (system BLAS)..
    ..normalization..
    ..done.
 ....clustering..
 ....detecting modules..
 ....calculating module eigengenes..
 ....checking kME in modules..
     ..removing 71 genes from module 1 because their KME is too low.
     ..removing 54 genes from module 2 because their KME is too low.
     ..removing 37 genes from module 3 because their KME is too low.
     ..removing 18 genes from module 4 because their KME is too low.
     ..removing 2 genes from module 5 because their KME is too low.
     ..removing 5 genes from module 6 because their KME is too low.
     ..removing 3 genes from module 10 because their KME is too low.
     ..removing 1 genes from module 14 because their KME is too low.
     ..removing 2 genes from module 17 because their KME is too low.
 ..Working on block 6 .
    TOM calculation: adjacency..
    ..will use 48 parallel threads.
     Fraction of slow calculations: 0.000000
    ..connectivity..
    ..matrix multiplication (system BLAS)..
    ..normalization..
    ..done.
 ....clustering..
 ....detecting modules..
 ....calculating module eigengenes..
 ....checking kME in modules..
     ..removing 77 genes from module 1 because their KME is too low.
     ..removing 62 genes from module 2 because their KME is too low.
     ..removing 32 genes from module 3 because their KME is too low.
     ..removing 18 genes from module 5 because their KME is too low.
     ..removing 5 genes from module 6 because their KME is too low.
     ..removing 7 genes from module 7 because their KME is too low.
     ..removing 11 genes from module 8 because their KME is too low.
     ..removing 2 genes from module 9 because their KME is too low.
     ..removing 17 genes from module 10 because their KME is too low.
     ..removing 1 genes from module 11 because their KME is too low.
     ..removing 12 genes from module 13 because their KME is too low.
     ..removing 3 genes from module 16 because their KME is too low.
     ..removing 4 genes from module 17 because their KME is too low.
     ..removing 1 genes from module 19 because their KME is too low.
     ..removing 1 genes from module 21 because their KME is too low.
     ..removing 1 genes from module 25 because their KME is too low.
 ..Working on block 7 .
    TOM calculation: adjacency..
    ..will use 48 parallel threads.
     Fraction of slow calculations: 0.000000
    ..connectivity..
    ..matrix multiplication (system BLAS)..
    ..normalization..
    ..done.
 ....clustering..
 ....detecting modules..
 ....calculating module eigengenes..
 ....checking kME in modules..
     ..removing 123 genes from module 1 because their KME is too low.
     ..removing 14 genes from module 2 because their KME is too low.
     ..removing 23 genes from module 3 because their KME is too low.
     ..removing 1 genes from module 4 because their KME is too low.
     ..removing 5 genes from module 5 because their KME is too low.
     ..removing 3 genes from module 6 because their KME is too low.
     ..removing 4 genes from module 7 because their KME is too low.
     ..removing 12 genes from module 8 because their KME is too low.
     ..removing 5 genes from module 9 because their KME is too low.
     ..removing 1 genes from module 11 because their KME is too low.
     ..removing 1 genes from module 12 because their KME is too low.
     ..removing 2 genes from module 13 because their KME is too low.
     ..removing 1 genes from module 14 because their KME is too low.
 ..Working on block 8 .
    TOM calculation: adjacency..
    ..will use 48 parallel threads.
     Fraction of slow calculations: 0.000000
    ..connectivity..
    ..matrix multiplication (system BLAS)..
    ..normalization..
    ..done.
 ....clustering..
 ....detecting modules..
 ....calculating module eigengenes..
 ....checking kME in modules..
     ..removing 21 genes from module 1 because their KME is too low.
     ..removing 12 genes from module 2 because their KME is too low.
     ..removing 8 genes from module 3 because their KME is too low.
     ..removing 7 genes from module 4 because their KME is too low.
     ..removing 12 genes from module 5 because their KME is too low.
     ..removing 1 genes from module 6 because their KME is too low.
     ..removing 8 genes from module 7 because their KME is too low.
     ..removing 7 genes from module 8 because their KME is too low.
     ..removing 1 genes from module 9 because their KME is too low.
     ..removing 7 genes from module 10 because their KME is too low.
     ..removing 3 genes from module 11 because their KME is too low.
     ..removing 3 genes from module 19 because their KME is too low.
 ..Working on block 9 .
    TOM calculation: adjacency..
    ..will use 48 parallel threads.
     Fraction of slow calculations: 0.000000
    ..connectivity..
    ..matrix multiplication (system BLAS)..
    ..normalization..
    ..done.
 ....clustering..
 ....detecting modules..
 ....calculating module eigengenes..
 ....checking kME in modules..
     ..removing 33 genes from module 1 because their KME is too low.
     ..removing 30 genes from module 2 because their KME is too low.
     ..removing 11 genes from module 3 because their KME is too low.
     ..removing 1 genes from module 4 because their KME is too low.
     ..removing 9 genes from module 5 because their KME is too low.
     ..removing 8 genes from module 6 because their KME is too low.
     ..removing 9 genes from module 7 because their KME is too low.
     ..removing 1 genes from module 8 because their KME is too low.
     ..removing 1 genes from module 10 because their KME is too low.
  ..reassigning 35 genes from module 1 to modules with higher KME.
  ..reassigning 94 genes from module 2 to modules with higher KME.
  ..reassigning 24 genes from module 3 to modules with higher KME.
  ..reassigning 17 genes from module 4 to modules with higher KME.
  ..reassigning 14 genes from module 5 to modules with higher KME.
  ..reassigning 3 genes from module 7 to modules with higher KME.
  ..reassigning 2 genes from module 11 to modules with higher KME.
  ..reassigning 3 genes from module 12 to modules with higher KME.
  ..reassigning 1 genes from module 18 to modules with higher KME.
  ..reassigning 1 genes from module 20 to modules with higher KME.
  ..reassigning 2 genes from module 22 to modules with higher KME.
  ..reassigning 1 genes from module 25 to modules with higher KME.
  ..reassigning 3 genes from module 32 to modules with higher KME.
  ..reassigning 3 genes from module 33 to modules with higher KME.
  ..reassigning 1 genes from module 35 to modules with higher KME.
  ..reassigning 3 genes from module 36 to modules with higher KME.
  ..reassigning 1 genes from module 38 to modules with higher KME.
  ..reassigning 3 genes from module 39 to modules with higher KME.
  ..reassigning 1 genes from module 51 to modules with higher KME.
  ..reassigning 4 genes from module 56 to modules with higher KME.
  ..reassigning 10 genes from module 57 to modules with higher KME.
  ..reassigning 7 genes from module 58 to modules with higher KME.
  ..reassigning 1 genes from module 59 to modules with higher KME.
  ..reassigning 2 genes from module 60 to modules with higher KME.
  ..reassigning 4 genes from module 64 to modules with higher KME.
  ..reassigning 1 genes from module 65 to modules with higher KME.
  ..reassigning 1 genes from module 67 to modules with higher KME.
  ..reassigning 2 genes from module 76 to modules with higher KME.
  ..reassigning 2 genes from module 77 to modules with higher KME.
  ..reassigning 2 genes from module 78 to modules with higher KME.
  ..reassigning 1 genes from module 79 to modules with higher KME.
  ..reassigning 1 genes from module 81 to modules with higher KME.
  ..reassigning 1 genes from module 83 to modules with higher KME.
  ..reassigning 1 genes from module 84 to modules with higher KME.
  ..reassigning 3 genes from module 102 to modules with higher KME.
  ..reassigning 6 genes from module 103 to modules with higher KME.
  ..reassigning 1 genes from module 104 to modules with higher KME.
  ..reassigning 1 genes from module 105 to modules with higher KME.
  ..reassigning 1 genes from module 108 to modules with higher KME.
  ..reassigning 2 genes from module 115 to modules with higher KME.
  ..reassigning 1 genes from module 117 to modules with higher KME.
  ..reassigning 1 genes from module 118 to modules with higher KME.
  ..reassigning 1 genes from module 119 to modules with higher KME.
  ..reassigning 1 genes from module 121 to modules with higher KME.
  ..reassigning 2 genes from module 123 to modules with higher KME.
  ..reassigning 1 genes from module 124 to modules with higher KME.
  ..reassigning 1 genes from module 126 to modules with higher KME.
  ..reassigning 1 genes from module 127 to modules with higher KME.
  ..reassigning 1 genes from module 129 to modules with higher KME.
  ..reassigning 1 genes from module 133 to modules with higher KME.
  ..reassigning 2 genes from module 141 to modules with higher KME.
  ..reassigning 6 genes from module 143 to modules with higher KME.
  ..reassigning 1 genes from module 144 to modules with higher KME.
  ..reassigning 3 genes from module 146 to modules with higher KME.
  ..reassigning 1 genes from module 147 to modules with higher KME.
  ..reassigning 1 genes from module 152 to modules with higher KME.
 ..merging modules that are too close..
     mergeCloseModules: Merging modules whose distance is less than 0.15
       Calculating new MEs...
```

``` r
cor <- temp_cor     # Return cor function to original namespace
```