Open rekren opened 2 years ago
Same issue observed for my data. @rekren did you solve it? @lazappi - Any advice for us? Thank you so much in advance.
So I tested.
Different versions of the package were not the issue.
When I analyze the data on our server instead of the local computer, the error went away.
Not sure the underlying issue still, but I hope it helps.
This sounds like it might be a dependency issue somewhere. Can you please post the full error message (the output from traceback()
might also be helpful)?
Thank you so much for your response.
Below is the full error message:
And traceback() output:
This looks like it is a problem rendering the plot rather than something inside {clustree}. Can you try the default settings without setting any arguments (except prefix
)? Do you have issues making any other plots or just this one? It might be useful if you are able to share the plot object.
Also small note, it's generally better to include code as text using the `code`
syntax rather than insert images.
Thank you for your advice. Please see below.
I do not have any issue making other plots using other packages. Only all the plotting functions of the clustree package that had this same error.
This error was not specific to my Seurat object, because here I used pbmc3k object available from SeuratData, and the same issue occured.
SeuratData::InstallData("pbmc3k")
pbmc3k.final$groups <- sample(c("group1", "group2"), size = ncol(pbmc3k.final), replace = TRUE)
colnames(pbmc3k.final@meta.data)
clustree(pbmc3k.final, prefix = "RNA_snn_res.")
> colnames(pbmc3k.final@meta.data)
[1] "orig.ident" "nCount_RNA" "nFeature_RNA" "seurat_annotations" "percent.mt"
[6] "RNA_snn_res.0.5" "seurat_clusters" "groups" "RNA_snn_res.1" "RNA_snn_res.1.5"
> clustree(pbmc3k.final, prefix = "RNA_snn_res.")
Error in check.length(gparname) :
'gpar' element 'lwd' must not be length 0
> traceback()
16: stop(gettextf("'gpar' element '%s' must not be length 0", gparname),
domain = NA)
15: check.length(gparname)
14: numnotnull("lwd")
13: validGP(list(...))
12: gpar(col = guide$ticks.colour, lwd = guide$ticks.linewidth *
.pt, lineend = "butt")
11: grob(x0 = x0, y0 = y0, x1 = x1, y1 = y1, arrow = arrow, name = name,
gp = gp, vp = vp, cl = "segments")
10: segmentsGrob(x0 = x0, y0 = y0, x1 = x1, y1 = y1, default.units = "cm",
gp = gpar(col = guide$ticks.colour, lwd = guide$ticks.linewidth *
.pt, lineend = "butt"))
9: guide_gengrob.colorbar(X[[i]], ...)
8: FUN(X[[i]], ...)
7: lapply(gdefs, guide_gengrob, theme)
6: guides_gengrob(gdefs, theme)
5: build_guides(plot$scales, plot$layers, plot$mapping, position,
theme, plot$guides, plot$labels)
4: ggplot_gtable.ggplot_built(data)
3: ggplot_gtable(data)
2: print.ggplot(x)
1: (function (x, ...)
UseMethod("print"))(x)
Can you please also post the output of sessionInfo()
?
> sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.4
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] leiden_0.4.2 igraph_1.3.3 reticulate_1.25 sp_1.5-0 SeuratObject_4.1.0 Seurat_4.1.1.9002
loaded via a namespace (and not attached):
[1] Rtsne_0.16 colorspace_2.0-3 deldir_1.0-6 ellipsis_0.3.2 ggridges_0.5.3 rprojroot_2.0.3
[7] fs_1.5.2 gridtext_0.1.4 ggtext_0.1.1 rstudioapi_0.13 spatstat.data_2.2-0 listenv_0.8.0
[13] remotes_2.4.2 ggrepel_0.9.1 SeuratData_0.2.2 fansi_1.0.3 xml2_1.3.3 codetools_0.2-18
[19] splines_4.2.0 cachem_1.0.6 pkgload_1.3.0 polyclip_1.10-0 jsonlite_1.8.0 ica_1.0-3
[25] cluster_2.1.3 png_0.1-7 rgeos_0.5-9 uwot_0.1.11 shiny_1.7.1 sctransform_0.3.3
[31] spatstat.sparse_2.1-1 BiocManager_1.30.18 compiler_4.2.0 httr_1.4.3 assertthat_0.2.1 Matrix_1.4-1
[37] fastmap_1.1.0 lazyeval_0.2.2 cli_3.3.0 later_1.3.0 prettyunits_1.1.1 htmltools_0.5.2
[43] tools_4.2.0 gtable_0.3.0 glue_1.6.2 RANN_2.6.1 reshape2_1.4.4 dplyr_1.0.9
[49] rappdirs_0.3.3 Rcpp_1.0.9 scattermore_0.8 vctrs_0.4.1 nlme_3.1-158 progressr_0.10.1
[55] lmtest_0.9-40 spatstat.random_2.2-0 stringr_1.4.0 ps_1.7.1 globals_0.15.1 mime_0.12
[61] miniUI_0.1.1.1 lifecycle_1.0.1 irlba_2.3.5 devtools_2.4.3 goftest_1.2-3 future_1.26.1
[67] MASS_7.3-58 zoo_1.8-10 scales_1.2.0 spatstat.core_2.4-4 promises_1.2.0.1 spatstat.utils_2.3-1
[73] parallel_4.2.0 RColorBrewer_1.1-3 memoise_2.0.1 pbapply_1.5-0 gridExtra_2.3 ggplot2_3.3.6.9000
[79] rpart_4.1.16 stringi_1.7.8 pkgbuild_1.3.1 rlang_1.0.4 pkgconfig_2.0.3 matrixStats_0.62.0
[85] lattice_0.20-45 ROCR_1.0-11 purrr_0.3.4 tensor_1.5 patchwork_1.1.1 htmlwidgets_1.5.4
[91] processx_3.7.0 cowplot_1.1.1 tidyselect_1.1.2 here_1.0.1 parallelly_1.32.0 RcppAnnoy_0.0.19
[97] plyr_1.8.7 magrittr_2.0.3 R6_2.5.1 generics_0.1.3 DBI_1.1.3 pillar_1.7.0
[103] mgcv_1.8-40 fitdistrplus_1.1-8 survival_3.3-1 abind_1.4-5 tibble_3.1.7 future.apply_1.9.0
[109] crayon_1.5.1 KernSmooth_2.23-20 utf8_1.2.2 spatstat.geom_2.4-0 plotly_4.10.0 usethis_2.1.6
[115] grid_4.2.0 data.table_1.14.2 callr_3.7.1 digest_0.6.29 xtable_1.8-4 tidyr_1.2.0
[121] httpuv_1.6.5 munsell_0.5.0 viridisLite_0.4.0 sessioninfo_1.2.2
This looks like it is a problem rendering the plot rather than something inside {clustree}. Can you try the default settings without setting any arguments (except
prefix
)? Do you have issues making any other plots or just this one? It might be useful if you are able to share the plot object.Also small note, it's generally better to include code as text using the
`code`
syntax rather than insert images.
Thanks for looking into this issue @lazappi !
I was using the Cairo graphics device backend setting and switched to default but the outcome didn't change. Just in case I tried all other backend settings and downgrading the installed ggplot from its developer version (ggplot2_3.3.6.9000
) to cran version (ggplot2_3.3.6
) didn't work either.
Still Error in check.length(gparname) : 'gpar' element 'lwd' must not be length 0
When I check traceback()
the output is exactly same with @denvercal1234GitHub 's.
It looks like you are both using a development version of {ggplot2}. Can you please try with the current release version (v3.3.6)?
It looks like you are both using a development version of {ggplot2}. Can you please try with the current release version (v3.3.6)?
I also used the current release version (v3.3.6), and the outcome didn't change.
Hmmm...ok. I'm running out of obvious ideas for where this might be coming from. I think it will take a bit more investigation to pin down. Unfortunately I won't have time to look into it too much for the next few weeks.
My issue is spontaneously resolved, presumably thanks to the update of one of the graphics/matrix dependency packages.
Below is my session info which runs the clustree()
flawlessly for the same dataset and also for "pbmc_small" test data of Seurat
package.
sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] grid stats graphics grDevices datasets utils methods base
other attached packages:
[1] clustree_0.5.0 ggraph_2.0.5 HGNChelper_0.8.1 harmony_0.1.0 Rcpp_1.0.9 SeuratWrappers_0.3.0 SeuratDisk_0.0.0.9020
[8] sp_1.5-0 SeuratObject_4.1.0 Seurat_4.1.1.9002 gridExtra_2.3 knitr_1.39 forcats_0.5.1 stringr_1.4.0
[15] dplyr_1.0.9 purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.8 ggplot2_3.3.6 tidyverse_1.3.2
loaded via a namespace (and not attached):
[1] ggprism_1.0.3.9000 scattermore_0.8 R.methodsS3_1.8.2 bit64_4.0.5 irlba_2.3.5
[6] DelayedArray_0.22.0 R.utils_2.12.0 data.table_1.14.2 rpart_4.1.16 RCurl_1.98-1.7
[11] doParallel_1.0.17 generics_0.1.3 BiocGenerics_0.42.0 cowplot_1.1.1 RANN_2.6.1
[16] future_1.27.0 bit_4.0.4 tzdb_0.3.0 spatstat.data_2.2-0 xml2_1.3.3
[21] lubridate_1.8.0 httpuv_1.6.5 SummarizedExperiment_1.26.1 assertthat_0.2.1 isoband_0.2.5
[26] viridis_0.6.2 gargle_1.2.0 xfun_0.31 hms_1.1.1 jquerylib_0.1.4
[31] evaluate_0.15 promises_1.2.0.1 fansi_1.0.3 dbplyr_2.2.1 readxl_1.4.0
[36] igraph_1.3.4 DBI_1.1.3 htmlwidgets_1.5.4 spatstat.geom_2.4-0 googledrive_2.0.0
[41] stats4_4.2.1 paletteer_1.4.0 ellipsis_0.3.2 RSpectra_0.16-1 ggpubr_0.4.0
[46] backports_1.4.1 deldir_1.0-6 MatrixGenerics_1.8.1 vctrs_0.4.1 SingleCellExperiment_1.18.0
[51] Biobase_2.56.0 remotes_2.4.2 ROCR_1.0-11 abind_1.4-5 cachem_1.0.6
[56] withr_2.5.0 ggforce_0.3.3 progressr_0.10.1 checkmate_2.1.0 rgdal_1.5-32
[61] sctransform_0.3.3 dittoSeq_1.8.1 goftest_1.2-3 cluster_2.1.3 lazyeval_0.2.2
[66] crayon_1.5.1 hdf5r_1.3.5 pkgconfig_2.0.3 labeling_0.4.2 tweenr_1.0.2
[71] GenomeInfoDb_1.32.2 nlme_3.1-158 vipor_0.4.5 rlang_1.0.4 globals_0.15.1
[76] lifecycle_1.0.1 miniUI_0.1.1.1 modelr_0.1.8 rsvd_1.0.5 ggrastr_1.0.1
[81] cellranger_1.1.0 polyclip_1.10-0 matrixStats_0.62.0 lmtest_0.9-40 Matrix_1.4-1
[86] carData_3.0-5 zoo_1.8-10 reprex_2.0.1 beeswarm_0.4.0 ggridges_0.5.3
[91] GlobalOptions_0.1.2 googlesheets4_1.0.0 pheatmap_1.0.12 png_0.1-7 viridisLite_0.4.0
[96] rjson_0.2.21 bitops_1.0-7 R.oo_1.25.0 KernSmooth_2.23-20 shape_1.4.6
[101] parallelly_1.32.1 spatstat.random_2.2-0 rstatix_0.7.0 S4Vectors_0.34.0 ggsignif_0.6.3
[106] scales_1.2.0 hexbin_1.28.2 magrittr_2.0.3 plyr_1.8.7 ica_1.0-3
[111] zlibbioc_1.42.0 compiler_4.2.1 RColorBrewer_1.1-3 clue_0.3-61 fitdistrplus_1.1-8
[116] snakecase_0.11.0 cli_3.3.0 XVector_0.36.0 listenv_0.8.0 patchwork_1.1.1
[121] pbapply_1.5-0 MASS_7.3-58 mgcv_1.8-40 tidyselect_1.1.2 stringi_1.7.8
[126] highr_0.9 yaml_2.3.5 ggrepel_0.9.1 sass_0.4.2 scCustomize_0.7.0
[131] tools_4.2.1 future.apply_1.9.0 parallel_4.2.1 circlize_0.4.15 rstudioapi_0.13
[136] foreach_1.5.2 janitor_2.1.0 farver_2.1.1 Rtsne_0.16 digest_0.6.29
[141] BiocManager_1.30.18 rgeos_0.5-9 shiny_1.7.2 GenomicRanges_1.48.0 car_3.1-0
[146] broom_1.0.0 later_1.3.0 RcppAnnoy_0.0.19 httr_1.4.3 rsconnect_0.8.27
[151] ComplexHeatmap_2.12.0 colorspace_2.0-3 rvest_1.0.2 fs_1.5.2 tensor_1.5
[156] reticulate_1.25 IRanges_2.30.0 splines_4.2.1 uwot_0.1.11 rematch2_2.1.2
[161] spatstat.utils_2.3-1 graphlayouts_0.8.0 renv_0.15.5 plotly_4.10.0 xtable_1.8-4
[166] jsonlite_1.8.0 tidygraph_1.2.1 R6_2.5.1 pillar_1.8.0 htmltools_0.5.3
[171] mime_0.12 glue_1.6.2 fastmap_1.1.0 codetools_0.2-18 utf8_1.2.2
[176] lattice_0.20-45 bslib_0.4.0 spatstat.sparse_2.1-1 ggbeeswarm_0.6.0 leiden_0.4.2
[181] zip_2.2.0 colorway_0.2.0 openxlsx_4.2.5 survival_3.3-1 rmarkdown_2.14
[186] munsell_0.5.0 GetoptLong_1.0.5 GenomeInfoDbData_1.2.8 iterators_1.0.14 haven_2.5.0
[191] reshape2_1.4.4 gtable_0.3.0 spatstat.core_2.4-4
I stumbled upon this error as well, which eventually resolved after updating ggraph
from 2.0.5
to 2.1.0
. Not sure exactly how this works since the ggraph
version appears unchanged at 2.0.5
in @rekren's posts above, so maybe it was some combination of package versions.
Ok, thanks for the update! If anyone is able to pin down exactly which package/version combinations are the issue I'm happy to update the dependencies but without that I'm not sure there is much I can do.
+1 for @yoda-vid recommendation - updating from ggraph
2.0.6
to 2.1.0
resolved this issue for me today as well. Used with SeuratObject_4.1.3
, Seurat_4.3.0
, and clustree_0.5.0
.
+1 for @yoda-vid recommendation as well. Updating ggraph package from 2.0.6 to 2.1.0 worked for me too.
( install.packages("ggraph", version = "2.1.0")
and restarting R )
+1 for @yoda-vid recommendation as well. Updating ggraph package from 2.0.5 to 2.1.0 worked for me too.
+1 for @yoda-vid recommendation as well. I reinstalled clustree and update ggraph from 2.0.6 to 2.1.0. Works well. Thanks a lot.
+1 @yoda-vid updating ggraph from 2.0.5 to 2.1.0 worked for me as well. Thanks alot.
Hello,
I was happily using
clustree
package for a while. However, I received an error message when I run this code;clustree(x = my_data,prefix = "RNA_snn_res.",exprs = "data",assay = "RNA")
Metadata of my data is below, and everything seems in order from my side.
I really appreciate if you can help me to fix the issue leading to
'gpar' element 'lwd' must not be length 0
error.