Error in DimPlot when rasterizing plot and highlighting cells at the same time #7379
Description
DimPlot fails with the following error when highlighting cells and setting raster=TRUE
Error in
geom_scattermore()
:
! Problem while converting geom to grob.
ℹ Error occurred in the 1st layer.
Code for reproducing the issue:
Seurat::DimPlot(pbmc_small, cells.highlight = WhichCells(pbmc_small, idents = 1), raster = T)
Solution:
Downgrading the scattermore
package to v0.8
resolves the issue.
It seems that the recent version of scattermore
does not accept a vector for pointsize
parameter in the geom_scattermore
function. When no cells are set to be highlighted, only one number is assigned to pointsize
by Seurat. However, when a vector of cells is set to be highlighted the SetHighlight
inner function returns a vector of pointsizes
which in turn is passed to geom_scattermore
.
SessionInfo
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 21.1
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so
locale:
[1] LC_CTYPE=en_CA.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_CA.UTF-8 LC_COLLATE=en_CA.UTF-8
[5] LC_MONETARY=en_CA.UTF-8 LC_MESSAGES=en_CA.UTF-8
[7] LC_PAPER=en_CA.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] SeuratObject_4.1.3 Seurat_4.3.0
loaded via a namespace (and not attached):
[1] nlme_3.1-155 matrixStats_0.63.0
[3] spatstat.sparse_3.0-1 RcppAnnoy_0.0.20
[5] RColorBrewer_1.1-3 httr_1.4.6
[7] sctransform_0.3.5 tools_4.1.2
[9] utf8_1.2.3 R6_2.5.1
[11] irlba_2.3.5.1 KernSmooth_2.23-20
[13] uwot_0.1.14 lazyeval_0.2.2
[15] colorspace_2.1-0 withr_2.5.0
[17] sp_1.6-0 tidyselect_1.2.0
[19] gridExtra_2.3 compiler_4.1.2
[21] progressr_0.13.0 cli_3.6.1
[23] spatstat.explore_3.2-1 plotly_4.10.1
[25] labeling_0.4.2 scales_1.2.1
[27] lmtest_0.9-40 spatstat.data_3.0-1
[29] ggridges_0.5.4 pbapply_1.7-0
[31] goftest_1.2-3 stringr_1.5.0
[33] digest_0.6.31 spatstat.utils_3.0-3
[35] pkgconfig_2.0.3 htmltools_0.5.5
[37] parallelly_1.35.0 fastmap_1.1.1
[39] htmlwidgets_1.6.2 rlang_1.1.1
[41] shiny_1.7.4 farver_2.1.1
[43] generics_0.1.3 zoo_1.8-12
[45] jsonlite_1.8.4 spatstat.random_3.1-5
[47] ica_1.0-3 dplyr_1.1.2
[49] magrittr_2.0.3 patchwork_1.1.2
[51] Matrix_1.5-4.1 Rcpp_1.0.10
[53] munsell_0.5.0 fansi_1.0.4
[55] abind_1.4-5 reticulate_1.28
[57] lifecycle_1.0.3 stringi_1.7.12
[59] MASS_7.3-55 Rtsne_0.16
[61] plyr_1.8.8 grid_4.1.2
[63] parallel_4.1.2 listenv_0.9.0
[65] promises_1.2.0.1 ggrepel_0.9.3
[67] crayon_1.5.2 deldir_1.0-9
[69] miniUI_0.1.1.1 lattice_0.20-45
[71] cowplot_1.1.1 splines_4.1.2
[73] tensor_1.5 pillar_1.9.0
[75] igraph_1.4.3 spatstat.geom_3.2-1
[77] future.apply_1.11.0 reshape2_1.4.4
[79] codetools_0.2-18 leiden_0.4.3
[81] glue_1.6.2 data.table_1.14.8
[83] png_0.1-8 vctrs_0.6.2
[85] httpuv_1.6.11 polyclip_1.10-4
[87] gtable_0.3.3 RANN_2.6.1
[89] purrr_1.0.1 tidyr_1.3.0
[91] scattermore_1.1 future_1.32.0
[93] ggplot2_3.4.2 mime_0.12
[95] xtable_1.8-4 later_1.3.1
[97] survival_3.2-13 viridisLite_0.4.2
[99] tibble_3.2.1 cluster_2.1.2
[101] globals_0.16.2 fitdistrplus_1.1-11
[103] ellipsis_0.3.2 ROCR_1.0-11