drieslab / Giotto

Spatial omics analysis toolbox
https://drieslab.github.io/Giotto_website/
Other
258 stars 98 forks source link

Heatmap functions produce thumbnail image instead of normal size #861

Closed rbutleriii closed 9 months ago

rbutleriii commented 9 months ago

Describe the Error

Heatmap functions produce thumbnail image instead of normal size. I am having the issue with cellProximityHeatmap, but in fact it seems to be a problem with several heatmaps generated in the Mini SeqFISH tutorial. Potentially an issue with plot_output_handler? ...

Error Message

This should be big, not 1kb: s24 PS19-V inter_heatmap

To Reproduce

library(Giotto)
library(GiottoData)

# to automatically save figures in save_dir set save_plot to TRUE
temp_dir = getwd()
myinstructions = createGiottoInstructions(save_dir = temp_dir,
                                          save_plot = TRUE,
                                          show_plot = FALSE, 
                                          return_plot = FALSE)
# download data
data_directory = paste0(temp_dir, '/data/')
system("wget -P data https://github.com/drieslab/spatial-datasets/raw/master/data/2022_miniseqFISH/seqfish_field_expr.txt.gz")
system("wget -P data https://github.com/drieslab/spatial-datasets/raw/master/data/2022_miniseqFISH/seqfish_field_locs.txt")
# getSpatialDataset(dataset = 'mini_seqFISH', directory = data_directory, method = 'wget')

# giotto object
expr_path = paste0(data_directory, "seqfish_field_expr.txt.gz")
loc_path = paste0(data_directory, "seqfish_field_locs.txt")
seqfish_mini = createGiottoObject(expression = expr_path,
                                  spatial_locs = loc_path,
                                  instructions = myinstructions)
seqfish_mini = filterGiotto(gobject = seqfish_mini,
                            expression_threshold = 0.5,
                            feat_det_in_min_cells = 20,
                            min_det_feats_per_cell = 0)
seqfish_mini = normalizeGiotto(gobject = seqfish_mini, scalefactor = 6000, verbose = T)
seqfish_mini = addStatistics(gobject = seqfish_mini)
seqfish_mini = adjustGiottoMatrix(gobject = seqfish_mini,
                                  expression_values = c('normalized'),
                                  covariate_columns = c('nr_feats', 'total_expr'))
seqfish_mini = createSpatialNetwork(gobject = seqfish_mini, minimum_k = 2)
km_spatialgenes = binSpect(seqfish_mini)
# 1. calculate spatial correlation scores
ext_spatial_genes = km_spatialgenes[1:500]$feats
spat_cor_netw_DT = detectSpatialCorFeats(seqfish_mini,
                                         method = 'network',
                                         spatial_network_name = 'Delaunay_network',
                                         subset_feats = ext_spatial_genes)
# 2. cluster correlation scores
spat_cor_netw_DT = clusterSpatialCorFeats(spat_cor_netw_DT,
                                          name = 'spat_netw_clus', k = 8)
heatmSpatialCorFeats(seqfish_mini, spatCorObject = spat_cor_netw_DT,
                     use_clus_name = 'spat_netw_clus')

System Information

> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /home/rrbutler/.local/share/r-miniconda/envs/giotto_env/lib/libopenblasp-r0.3.25.so

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

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

other attached packages:
[1] GiottoData_0.2.6.2  data.table_1.14.8   qs_0.25.6
[4] Giotto_4.0.0        GiottoVisuals_0.1.0 GiottoClass_0.1.0
[7] GiottoUtils_0.1.0

loaded via a namespace (and not attached):
 [1] MatrixGenerics_1.10.0 Biobase_2.58.0        BiocSingular_1.14.0
 [4] jsonlite_1.8.8        foreach_1.5.2         R.utils_2.12.3
 [7] RcppParallel_5.1.7    stats4_4.2.2          pillar_1.9.0
[10] backports_1.4.1       lattice_0.22-5        glue_1.6.2
[13] limma_3.54.2          beachmat_2.14.2       reticulate_1.34.0
[16] digest_0.6.33         RColorBrewer_1.1-3    XVector_0.38.0
[19] checkmate_2.3.0       colorspace_2.1-0      stringfish_0.16.0
[22] R.oo_1.25.0           Matrix_1.6-4          pkgconfig_2.0.3
[25] GetoptLong_1.0.5      magick_2.8.1          zlibbioc_1.44.0
[28] scales_1.3.0          ScaledMatrix_1.6.0    terra_1.7-55
[31] RApiSerialize_0.1.2   BiocParallel_1.32.6   tibble_3.2.1
[34] generics_0.1.3        farver_2.1.1          IRanges_2.32.0
[37] ggplot2_3.4.4         withr_2.5.2           BiocGenerics_0.44.0
[40] cli_3.6.1             magrittr_2.0.3        crayon_1.5.2
[43] deldir_2.0-2          R.methodsS3_1.8.2     fansi_1.0.5
[46] doParallel_1.0.17     Cairo_1.6-2           textshaping_0.3.7
[49] tools_4.2.2           GlobalOptions_0.1.2   lifecycle_1.0.4
[52] matrixStats_1.1.0     ComplexHeatmap_2.14.0 S4Vectors_0.36.2
[55] munsell_0.5.0         cluster_2.1.5         DelayedArray_0.24.0
[58] irlba_2.3.5.1         compiler_4.2.2        rsvd_1.0.5
[61] systemfonts_1.0.5     rlang_1.1.2           grid_4.2.2
[64] iterators_1.0.14      rjson_0.2.21          rappdirs_0.3.3
[67] circlize_0.4.15       igraph_1.5.1          labeling_0.4.3
[70] gtable_0.3.4          codetools_0.2-19      R6_2.5.1
[73] dplyr_1.1.4           utf8_1.2.4            clue_0.3-65
[76] colorRamp2_0.1.0      ragg_1.2.6            shape_1.4.6
[79] parallel_4.2.2        Rcpp_1.0.11           vctrs_0.6.5
[82] png_0.1-8             tidyselect_1.2.0
jiajic commented 9 months ago

Thanks for the reprex! This should be fixed now in GiottoVisuals v0.1.2

I am now getting this: 4-heatmSpatialCorFeats