Entering edit mode
                    19 months ago
        Nicolas
        
    
        •
    
    0
    Hello im having troubles with WGCNA generating the TOMfiles the code aappears to run correctly but whrn i check eh bwnet object it has a TOMfiles NULL value
This is the code im using
gsg <- goodSamplesGenes(t(mcounts))
summary(gsg)
gsg$allOK
table(gsg$goodGenes)
table(gsg$goodSamples)
Wdds <- DESeqDataSetFromMatrix(countData = mcounts,
                              colData = metadata,
                              design = ~ 1)
Wdds75 <- Wdds[rowSums(counts(Wdds) >= 15) >= 8,]
nrow(Wdds75)
Wdds_norm <- vst(Wdds75)
tcounts <- assay(Wdds_norm) %>% 
           t()
power <- c(c(1:10), seq(from = 12, to = 50, by = 2))
sft <- pickSoftThreshold(tcounts,
                         powerVector = power,
                         networkType = "signed",
                         verbose = 5)
sft_data <- sft$fitIndices
a1 <- ggplot(sft_data, aes(Power, SFT.R.sq, label = Power)) +
      geom_point() +
      geom_text(nudge_y = 0.1) +
      geom_hline(yintercept = 0.8, color = "#C21807") + 
      labs(x = "Power", y = "Scale free topology model fit, signed R^2") +
      theme_classic()
a2 <- ggplot(sft_data, aes(Power, mean.k., label = Power)) +
      geom_point() +
      geom_text(nudge_y = 0.1) +
      labs(x = "Power", y = "Mean Conectivity") +
      theme_classic()
grid.arrange(a1, a2, ncol = 2)
tcounts[] <- sapply(tcounts, as.numeric)
soft_power <- 16
temp_cor <- cor
cor <- WGCNA::cor
bwnet <- blockwiseModules(tcounts,
                 maxBlockSize = 15000,
                 TOMType = "signed",
                 power = soft_power,
                 mergeCutHeight = 0.25,
                 numericLabels = FALSE,
                 randomSeed = 1234,
                 verbose = 3)
cor <- temp_cor
module_eigengenes <- bwnet$MEs
head(module_eigengenes)
table(bwnet$colors)
plotDendroAndColors(bwnet$dendrograms[[1]], cbind(bwnet$unmergedColors, bwnet$colors),
                    c("unmerged", "merged"),
                    dendroLabels = FALSE,
                    addGuide = TRUE,
                    hang= 0.03,
                    guideHang = 0.05)
The output from blockwisemodules is this
Calculating module eigengenes block-wise from all genes
   Flagging genes and samples with too many missing values...
    ..step 1
 ..Working on block 1 .
    TOM calculation: adjacency..
    ..will not use multithreading.
     Fraction of slow calculations: 0.000000
    ..connectivity..
    ..matrix multiplication (system BLAS)..
    ..normalization..
    ..done.
 ....clustering..
 ....detecting modules..
 ....calculating module eigengenes..
 ....checking kME in modules..
     ..removing 1 genes from module 14 because their KME is too low.
  ..reassigning 2 genes from module 1 to modules with higher KME.
  ..reassigning 1 genes from module 5 to modules with higher KME.
 ..merging modules that are too close..
     mergeCloseModules: Merging modules whose distance is less than 0.25
       Calculating new MEs...
The dimentions of my data are 10 14379
https://www.rdocumentation.org/packages/WGCNA/versions/1.72-5/topics/blockwiseModules
note the
saveTOMsargument.