Entering edit mode
Hi everyone,
I need help please. I keep getting this error in the WGCNA What could I be doing wrong?
Thanks in advance
[1] 20 3
> dim(moduleTraitCor)
[1] 401 3
> class(design2)
[1] "matrix" "array"
> class(moduleTraitCor)
[1] "matrix" "array"
> # Display the correlation values within a heatmap plot
> labeledHeatmap(Matrix = moduleTraitCor,
+ xLabels = names(design2),
+ yLabels = names(MEs),
+ ySymbols = names(MEs),
+ colorLabels = FALSE,
+ colors = greenWhiteRed(50),
+ textMatrix = textMatrix,
+ setStdMargins = FALSE,
+ cex.text = 0.5,
+ zlim = c(-1,1),
+ main = paste("Module-trait relationships"))
Error in labeledHeatmap(Matrix = moduleTraitCor, xLabels = names(design2), :
Length of 'xLabels' must equal the number of columns in 'Matrix.'
sessionInfo( )
R version 4.0.4 (2021-02-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] parallel stats4 stats graphics grDevices utils datasets methods base
other attached packages:
[1] flashClust_1.01-2 WGCNA_1.70-3 fastcluster_1.2.3 dynamicTreeCut_1.63-1
[5] edgeR_3.32.1 limma_3.46.0 DESeq2_1.30.1 SummarizedExperiment_1.20.0
[9] Biobase_2.50.0 MatrixGenerics_1.2.1 matrixStats_0.61.0 GenomicRanges_1.42.0
[13] GenomeInfoDb_1.26.7 IRanges_2.24.1 S4Vectors_0.28.1 BiocGenerics_0.36.1
loaded via a namespace (and not attached):
[1] colorspace_2.0-2 ellipsis_0.3.2 class_7.3-19 htmlTable_2.3.0
[5] XVector_0.30.0 base64enc_0.1-3 rstudioapi_0.13 listenv_0.8.0
[9] bit64_4.0.5 AnnotationDbi_1.52.0 prodlim_2019.11.13 fansi_0.5.0
[13] lubridate_1.8.0 codetools_0.2-18 splines_4.0.4 doParallel_1.0.16
[17] impute_1.64.0 cachem_1.0.6 knitr_1.36 geneplotter_1.68.0
[21] Formula_1.2-4 pROC_1.18.0 caret_6.0-90 annotate_1.68.0
[25] cluster_2.1.2 GO.db_3.12.1 png_0.1-7 pheatmap_1.0.12
[29] BiocManager_1.30.16 compiler_4.0.4 httr_1.4.2 backports_1.3.0
[33] assertthat_0.2.1 Matrix_1.3-4 fastmap_1.1.0 htmltools_0.5.2
[37] tools_4.0.4 gtable_0.3.0 glue_1.4.2 GenomeInfoDbData_1.2.4
[41] reshape2_1.4.4 dplyr_1.0.7 Rcpp_1.0.7 vctrs_0.3.8
[45] preprocessCore_1.52.1 nlme_3.1-153 iterators_1.0.13 timeDate_3043.102
[49] xfun_0.28 gower_0.2.2 stringr_1.4.0 globals_0.14.0
[53] lifecycle_1.0.1 XML_3.99-0.8 future_1.23.0 zlibbioc_1.36.0
[57] MASS_7.3-54 scales_1.1.1 ipred_0.9-12 RColorBrewer_1.1-2
[61] memoise_2.0.0 gridExtra_2.3 ggplot2_3.3.5 rpart_4.1-15
[65] latticeExtra_0.6-29 stringi_1.7.5 RSQLite_2.2.8 genefilter_1.72.1
[69] foreach_1.5.1 checkmate_2.0.0 BiocParallel_1.24.1 lava_1.6.10
[73] rlang_0.4.12 pkgconfig_2.0.3 bitops_1.0-7 lattice_0.20-45
[77] purrr_0.3.4 htmlwidgets_1.5.4 recipes_0.1.17 bit_4.0.4
[81] tidyselect_1.1.1 parallelly_1.28.1 plyr_1.8.6 magrittr_2.0.1
[85] R6_2.5.1 generics_0.1.1 Hmisc_4.6-0 DelayedArray_0.16.3
[89] DBI_1.1.1 pillar_1.6.4 foreign_0.8-81 withr_2.4.2
[93] survival_3.2-13 RCurl_1.98-1.5 nnet_7.3-16 tibble_3.1.5
[97] future.apply_1.8.1 crayon_1.4.2 utf8_1.2.2 jpeg_0.1-9
[101] locfit_1.5-9.4 grid_4.0.4 data.table_1.14.2 blob_1.2.2
[105] ModelMetrics_1.2.2.2 digest_0.6.28 xtable_1.8-4 munsell_0.5.0
Length of 'xLabels' must equal the number of columns in 'Matrix.
indicates that you provided more trait labels in names(design2) than how much it is present incolnames(moduleTraitCor)
.Thank you for your reply , The dim function shows that both have the same column number
I resolved the issue by changing design2 into a data frame.
Many thanks.