This is a test version of Biostars. For the public version, visit https://www.biostars.org.
WGCNA module preservation using only adjacency matrix

Hello,

I've been trying to use WGCNA modulePreservation function for module preservation analysis. I have two adjacency matrices generated from two datasets, and two list of module colors. The two adjacency matrices have same dimension, and their columns/rows correspond to the same genes. Below is the example code I used (from Module preservation using adjacency matrix (WGCNA))

R <- matrix(runif(100), ncol=10) 
R <- (R * lower.tri(R)) + t(R * lower.tri(R)) 
diag(R) <- 1 

colnames(R)<-c("MEST","INHBA","IGF2","H19","GNAS","GRHL1","SNPRN","MEG3","PEG10","CDKN1C")
rownames(R)<-c("MEST","INHBA","IGF2","H19","GNAS","GRHL1","SNPRN","MEG3","PEG10","CDKN1C")

S <- matrix(runif(100), ncol=10) 
S <- (S * lower.tri(S)) + t(S * lower.tri(S)) 
diag(S) <- 1 

colnames(S)<-c("MEST","INHBA","IGF2","H19","GNAS","GRHL1","SNPRN","MEG3","PEG10","CDKN1C")
rownames(S)<-c("MEST","INHBA","IGF2","H19","GNAS","GRHL1","SNPRN","MEG3","PEG10","CDKN1C")

multiData =vector("list",2)

multiData[[1]] =list(data= R)
multiData[[2]] =list(data= S)

names(multiData)=c("Ref","SGA")
checkSets(multiData, checkStructure = FALSE, useSets = NULL)

multiColor =vector("list",2)

multiColor[[1]] =c('blue',"blue","red","red","grey","tan","tan","purple","grey","purple")
multiColor[[2]] =c('blue',"blue","red","red","grey","tan","tan","purple","grey","purple")

names(multiColor)=c("Ref","SGA")

modulePreservIndVsConsensus=modulePreservation(
  multiData,
  multiColor,
  dataIsExpr = F,
  networkType = "unsigned", 
  referenceNetworks = 1, 
  nPermutations = 100, 
  verbose = 5)

And I got this error message

  ..checking adjacencies for excessive amounts of missing data
     Flagging genes and samples with too many missing values...
      ..step 1
     Flagging genes and samples with too many missing values...
      ..step 1
  ..unassigned 'module' name: grey 
  ..all network sample 'module' name: gold
  ..calculating observed preservation values
     ..working on reference network Ref
       ..working on test network SGA
Error in .modulePreservationInternal(multiData, multiColor, multiWeights = multiWeights,  : 
  object 'weightsRef' not found

I read the documentation at https://rdrr.io/cran/WGCNA/man/modulePreservation.html and it looks like multiWeights is NULL and should be NULL when adjacency matrices are used (when dataIsExpr = F), however the error message is complaining about multiWeights being NULL.

I wonder if anyone has successfully ran WGCNA module preservation with adjacency matrix or has any suggestions. Thank you!

wgcna

0 answers

No answers yet.

Log in to answer this question.