WGCNA: consensusTOM() doesn't save TOMs & returns setNames error (but sets are named)
1
1
Entering edit mode
cats_dogs ▴ 20
@cats_dogs-15904
Last seen 5.0 years ago

Hi all,

For context, I'm still working on the dataset about which I raised this question. Running consensusTOM() results in neither the calibrated nor consensus TOMs being saved to disk/returned to the workspace and throws this error:

Error in .processFileName(calibratedIndividualTOMFilePattern, setNumber = set, : argument "setNames" is missing, with no default

I did run multiExprday <- setNames(multiExprday, c("Time1", "Time2", "Time3")) and names(multiExprday) returns them, and anyway, the function seems to be designed to be able to handle missing setNames.

Does anybody have any insight? It smells like a small technical error but I'm having a hard time understanding the source. Thank your for your time.

Command:

consTOM <- consensusTOM(multiExprday,
  checkMissingData = TRUE,
  maxBlockSize = 25000,
  blockSizePenaltyPower = 5,
  nPreclusteringCenters = NULL,
  randomSeed = 12345,
  corType = "bicor",
  maxPOutliers = 0.05,
  quickCor = 0,
  pearsonFallback = "individual",

  power = 12,
  networkType = "signed",
  checkPower = TRUE,

  TOMType = "signed",
  TOMDenom = "min",
  saveIndividualTOMs = TRUE,
  individualTOMFileNames = "individualTOM-Set%s-Block%b.RData",
  networkCalibration = "full quantile",

  saveCalibratedIndividualTOMs = TRUE,
  calibratedIndividualTOMFilePattern = "calibratedIndividualTOM-Set%s-Block%b.RData",

  calibrationQuantile = 0.95,
  sampleForCalibration = TRUE, sampleForCalibrationFactor = 5000,
  getNetworkCalibrationSamples = FALSE,

  consensusQuantile = 0,
  useMean = FALSE,
  setWeights = NULL,

  saveConsensusTOMs = TRUE,
  consensusTOMFilePattern = "consensusTOM-Block%b.RData",
  returnTOMs = TRUE,

  nThreads = 20,
  verbose = 5)

sessionInfo():

R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               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    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] tximportData_1.10.0         forcats_0.3.0               stringr_1.4.0               dplyr_0.8.0.1              
 [5] purrr_0.3.0                 readr_1.3.1                 tidyr_0.8.2                 tibble_2.0.1               
 [9] tidyverse_1.2.1             sva_3.30.1                  genefilter_1.64.0           mgcv_1.8-27                
[13] nlme_3.1-137                ggplot2_3.1.0               tximport_1.10.1             WGCNA_1.66                 
[17] fastcluster_1.1.25          dynamicTreeCut_1.63-1       GenomicFeatures_1.34.3      AnnotationDbi_1.44.0       
[21] limma_3.38.3                DESeq2_1.22.2               SummarizedExperiment_1.12.0 DelayedArray_0.8.0         
[25] BiocParallel_1.16.6         matrixStats_0.54.0          Biobase_2.42.0              GenomicRanges_1.34.0       
[29] GenomeInfoDb_1.18.2         IRanges_2.16.0              S4Vectors_0.20.1            BiocGenerics_0.28.0        

loaded via a namespace (and not attached):
  [1] colorspace_1.4-0         htmlTable_1.13.1         XVector_0.22.0           base64enc_0.1-3         
  [5] rstudioapi_0.9.0         bit64_0.9-7              lubridate_1.7.4          mvtnorm_1.0-8           
  [9] xml2_1.2.0               codetools_0.2-16         splines_3.5.2            doParallel_1.0.14       
 [13] impute_1.56.0            robustbase_0.93-3        geneplotter_1.60.0       knitr_1.21              
 [17] jsonlite_1.6             Formula_1.2-3            Rsamtools_1.34.1         broom_0.5.1             
 [21] annotate_1.60.0          cluster_2.0.7-1          GO.db_3.7.0              rrcov_1.4-7             
 [25] compiler_3.5.2           httr_1.4.0               backports_1.1.3          assertthat_0.2.0        
 [29] Matrix_1.2-15            lazyeval_0.2.1           cli_1.0.1                acepack_1.4.1           
 [33] htmltools_0.3.6          prettyunits_1.0.2        tools_3.5.2              gtable_0.2.0            
 [37] glue_1.3.0               GenomeInfoDbData_1.2.0   Rcpp_1.0.0               cellranger_1.1.0        
 [41] Biostrings_2.50.2        preprocessCore_1.44.0    rtracklayer_1.42.1       iterators_1.0.10        
 [45] xfun_0.4                 rvest_0.3.2              XML_3.98-1.17            DEoptimR_1.0-8          
 [49] zlibbioc_1.28.0          MASS_7.3-51.1            scales_1.0.0             hms_0.4.2               
 [53] RColorBrewer_1.1-2       yaml_2.2.0               memoise_1.1.0            gridExtra_2.3           
 [57] biomaRt_2.38.0           rpart_4.1-13             latticeExtra_0.6-28      stringi_1.3.1           
 [61] RSQLite_2.1.1            pcaPP_1.9-73             foreach_1.4.4            checkmate_1.9.1         
 [65] rlang_0.3.1              pkgconfig_2.0.2          bitops_1.0-6             evaluate_0.13           
 [69] lattice_0.20-38          GenomicAlignments_1.18.1 htmlwidgets_1.3          bit_1.1-14              
 [73] tidyselect_0.2.5         robust_0.4-18            plyr_1.8.4               magrittr_1.5            
 [77] R6_2.4.0                 generics_0.0.2           Hmisc_4.2-0              fit.models_0.5-14       
 [81] DBI_1.0.0                haven_2.0.0              pillar_1.3.1             foreign_0.8-71          
 [85] withr_2.1.2              survival_2.43-3          RCurl_1.95-4.11          nnet_7.3-12             
 [89] modelr_0.1.3             crayon_1.3.4             rmarkdown_1.11           progress_1.2.0          
 [93] readxl_1.3.0             locfit_1.5-9.1           grid_3.5.2               data.table_1.12.0       
 [97] blob_1.1.1               digest_0.6.18            xtable_1.8-3             munsell_0.5.0
WGCNA • 1.1k views
ADD COMMENT
2
Entering edit mode
@peter-langfelder-4469
Last seen 22 days ago
United States

Indeed, this is a bug in the current WGCNA version, thanks for reporting it. I fixed it in a development version and posted the tarball on dropbox at this link: https://www.dropbox.com/s/lganlp7h41tg06n/WGCNA_1.66-90.tar.gz?dl=0. If you are able to install source packages, please give it a try and let me know if it works.

ADD COMMENT
0
Entering edit mode

Thanks so much for the quick response! I downloaded and installed 1.66; it's running now, and I'll update this post when the job finishes, likely tomorrow.

quick edit: It killed the function with

Error in .Call("tomSimilarity_call", selExpr, selWeights, as.integer(CcorType),  : 
  Incorrect number of arguments (19), expecting 18 for 'tomSimilarity_call'
Timing stopped at: 20.16 0.368 20.53

edit 2: .traceback():

3.
blockwiseIndividualTOMs(multiExpr = multiExpr, checkMissingData = checkMissingData, blocks = blocks, maxBlockSize = maxBlockSize, blockSizePenaltyPower = blockSizePenaltyPower, nPreclusteringCenters = nPreclusteringCenters, randomSeed = NULL, corType = corType, maxPOutliers = maxPOutliers, quickCor = quickCor, ...
2.
system.time({ individualTOMInfo = blockwiseIndividualTOMs(multiExpr = multiExpr, checkMissingData = checkMissingData, blocks = blocks, maxBlockSize = maxBlockSize, blockSizePenaltyPower = blockSizePenaltyPower, ...
1.
consensusTOM(multiExprday.n, checkMissingData = TRUE, blocks = NULL, maxBlockSize = 25000, blockSizePenaltyPower = 5, nPreclusteringCenters = NULL, randomSeed = 12345, corType = "bicor", maxPOutliers = 0.05, quickCor = 0, pearsonFallback = "individual", cosineCorrelation = FALSE, ...
ADD REPLY
0
Entering edit mode

I think I may have found the issue:

The function in consensusTOM.R in the documentation seems to pass 18 arguments to tomSimilarity_call in networkFunctions.c, but in the updated version, it passes 19 arguments

   .Call("tomSimilarity_call", data, weights,
          as.integer(CcorType), as.integer(CnetworkType), 
          as.double(networkOptions$power), as.integer(CTOMType),
          as.integer(CTOMDenom),
          as.double(networkOptions$maxPOutliers),
          as.double(networkOptions$quickCor),
          as.integer(networkOptions$pearsonFallback.code),
          as.integer(networkOptions$cosineCorrelation),
          as.integer(networkOptions$replaceMissingAdjacencies),
          as.integer(networkOptions$suppressTOMForZeroAdjacencies),
          as.integer(networkOptions$suppressNegativeTOM), #this argument is new I think
          as.integer(networkOptions$useInternalMatrixAlgebra),
          warn, as.integer(min(1, networkOptions$nThreads)),
          as.integer(callVerb), as.integer(callInd), PACKAGE = "WGCNA");
}

In the updated networkFunctions.c, the argument correspondingly takes 19 arguments:

SEXP tomSimilarity_call(SEXP expr_s, 
                        SEXP weights_s,
                        SEXP corType_s, SEXP adjType_s, SEXP power_s,
                        SEXP tomType_s, SEXP denomType_s,
                        SEXP maxPOutliers_s, SEXP quick_s,  
                        SEXP fallback_s, SEXP cosine_s, 
                        SEXP replaceMissing_s,
                        SEXP suppressTOMForZeroAdj_s,
                        SEXP suppressNegativeTOM_s, #there it is
                        SEXP useInternalMatrixAlgebra_s,
                        SEXP warn_s, // This is an "output" variable
                        SEXP nThreads_s, SEXP verbose_s, SEXP indent_s)

And it seems to expect 19 arguments further down in networkFunctions.c

void R_init_WGCNA(DllInfo * info)
{
  static const R_CallMethodDef callMethods[]  = {
    {"tomSimilarity_call", (DL_FUNC) &tomSimilarity_call, 19},
    {"tomSimilarityFromAdj_call", (DL_FUNC) &tomSimilarityFromAdj_call, 8},
    {"cor1Fast_call", (DL_FUNC) &cor1Fast_call, 9},
    {"bicor1_call", (DL_FUNC) &bicor1_call, 11},
    {"bicor2_call", (DL_FUNC) &bicor2_call, 16},
    {"corFast_call", (DL_FUNC) &corFast_call, 12},
    {"parallelQuantile", (DL_FUNC) &parallelQuantile, 2},
    {"parallelMean", (DL_FUNC) &parallelMean, 2},
    {"parallelMin", (DL_FUNC) &parallelMin, 1},
    {"minWhich_call", (DL_FUNC) &minWhich_call, 2},
    {"quantileC_call", (DL_FUNC) &quantileC_call, 2},
    {"rowQuantileC_call", (DL_FUNC) &rowQuantileC_call, 2},
    {"qorder", (DL_FUNC) &qorder, 1},
    {NULL, NULL, 0}
  };

The old version of WGCNA is unloaded and uninstalled, so I'm not clear on what is still expecting 18 arguments. Is it calling a function in another file that I'm missing? (Sorry, I don't really know C...) Thank you!

ADD REPLY
1
Entering edit mode

Strange. The function consensusTOM works in my installation. I would double-check that the new package was compiled and installed from source and that there is no confusion between a system-wide and personal library. It does look like your installation mixes new R code with old compiled code.

ADD REPLY
0
Entering edit mode

Ah yeah, it was a discrepancy in my .profile. Fixed now and the function works - thanks so much for your help!

ADD REPLY
0
Entering edit mode

Glad you got it worked out.

ADD REPLY

Login before adding your answer.

Traffic: 921 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6