ComplexHeatmap icon indicating copy to clipboard operation
ComplexHeatmap copied to clipboard

Unable to use_raster function while plotting heatmap for CopyKit

Open Urja25 opened this issue 1 year ago • 1 comments

Hi,

I am using CopyKit to analyze my single cell DNA data. I have merged 7 objects containing about 25k cells. I want to plot a combined heatmap for the same but am unable to do so using the following function:

pdf(glue("{outputdir}/allaneuploid_ht.pdf", height = 10, width = 8))
print(plotHeatmap(merged_ckobj_cbs[,colData(merged_ckobj_cbs)$is_aneuploid==T], col = col_fun, order_cells = "hclust", n_threads = 100))
dev.off()

I get the following error:

Error in Cairo(width, height, type = "png", file = filename, pointsize = pointsize,  : 
  Graphics API version mismatch
Error: The size of the temporary image for rasterization is too huge (12167 x 876 px) that it is cannot be handled by the device function Cairo:CairoPNG(). Please reduce the maximal size of temporary image by
setting proper values for ht_opt$raster_temp_image_max_width and ht_opt$raster_temp_image_max_height.
> sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: x86_64-pc-linux-gnu
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /omics/odcf/analysis/OE0585_projects/chromothripsis/urja_python/conda_environments/my_r_env/lib/libopenblasp-r0.3.21.so;  LAPACK version 3.9.0

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    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       

time zone: Europe/Berlin
tzcode source: system (glibc)

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

other attached packages:
 [1] magick_2.8.3                glue_1.8.0                  lubridate_1.9.3             forcats_1.0.0               stringr_1.5.1               dplyr_1.1.4                 purrr_1.0.2                 readr_2.1.5                
 [9] tidyr_1.3.1                 tibble_3.2.1                ggplot2_3.5.1               tidyverse_2.0.0             BiocParallel_1.38.0         magrittr_2.0.3              copykit_0.1.3               DNAcopy_1.78.0             
[17] Rsubread_2.16.1             SingleCellExperiment_1.26.0 SummarizedExperiment_1.34.0 Biobase_2.64.0              GenomicRanges_1.56.0        GenomeInfoDb_1.40.1         IRanges_2.38.0              S4Vectors_0.42.0           
[25] BiocGenerics_0.50.0         MatrixGenerics_1.16.0       matrixStats_1.4.1          

loaded via a namespace (and not attached):
  [1] RColorBrewer_1.1-3      rstudioapi_0.16.0       jsonlite_1.8.9          shape_1.4.6.1           modeltools_0.2-23       farver_2.1.2            GlobalOptions_0.1.2     fs_1.6.5                zlibbioc_1.50.0        
 [10] vctrs_0.6.5             ggtree_3.12.0           htmltools_0.5.8.1       S4Arrays_1.4.1          BiocNeighbors_1.22.0    SparseArray_1.4.8       gridGraphics_0.5-1      htmlwidgets_1.6.4       plotly_4.10.4          
 [19] igraph_2.0.3            mime_0.12               lifecycle_1.0.4         iterators_1.0.14        pkgconfig_2.0.3         Matrix_1.7-0            R6_2.5.1                fastmap_1.2.0           GenomeInfoDbData_1.2.12
 [28] shiny_1.8.1.1           clue_0.3-65             digest_0.6.36           aplot_0.2.2             colorspace_2.1-1        ggnewscale_0.5.0        patchwork_1.3.0         timechange_0.3.0        fansi_1.0.6            
 [37] httr_1.4.7              abind_1.4-8             compiler_4.4.0          withr_3.0.2             doParallel_1.0.17       viridis_0.6.5           MASS_7.3-60.2           DelayedArray_0.30.1     rjson_0.2.23           
 [46] bluster_1.14.0          gtools_3.9.5            tools_4.4.0             ape_5.8                 prabclus_2.3-4          httpuv_1.6.15           nnet_7.3-19             dbscan_1.1-12           nlme_3.1-165           
 [55] promises_1.3.0          grid_4.4.0              cluster_2.1.6           generics_0.1.3          gtable_0.3.6            tzdb_0.4.0              class_7.3-22            hms_1.1.3               data.table_1.16.2      
 [64] utf8_1.2.4              XVector_0.44.0          flexmix_2.3-19          foreach_1.5.2           pillar_1.9.0            yulab.utils_0.1.7       later_1.3.2             robustbase_0.99-4-1     circlize_0.4.16        
 [73] splines_4.4.0           treeio_1.28.0           lattice_0.22-6          survival_3.7-0          tidyselect_1.2.1        ComplexHeatmap_2.20.0   miniUI_0.1.1.1          gridExtra_2.3           mixtools_2.0.0         
 [82] diptest_0.77-1          scquantum_1.0.0         DEoptimR_1.1-3-1        stringi_1.8.4           UCSC.utils_1.0.0        lazyeval_0.2.2          ggfun_0.1.5             codetools_0.2-20        kernlab_0.9-33         
 [91] ggplotify_0.1.2         cli_3.6.3               uwot_0.2.2              xtable_1.8-4            segmented_2.1-1         munsell_0.5.1           Rcpp_1.0.13             png_0.1-8               parallel_4.4.0         
[100] mclust_6.1.1            ggalluvial_0.12.5       viridisLite_0.4.2       tidytree_0.4.6          scales_1.3.0            crayon_1.5.3            fpc_2.2-13              GetoptLong_1.0.5        rlang_1.1.4         

Urja25 avatar Jan 04 '25 18:01 Urja25

I got a similar error on Ubuntu 18, but I successfully plotted this heatmap using Windows. It might be related to the API of some functions on Linux.

baiyaer1 avatar Oct 27 '25 07:10 baiyaer1