Open swbioinf opened 1 year ago
An update: Turns out file paths are in largeImages, not images. I can plot from go.reload, so long as I specify the large image name.
spatInSituPlotPoints(go.reloaded,
show_image=TRUE,
largeImage_name = "composite",
use_overlap = FALSE, feats = list('rna' = c("JCHAIN")))
So my immediate question is answered, I can produce the plots. But is there a cleaner way I should do this?
Why have I got an image with name 'image' (in a single fov object) with a null file_path? And why does that same command (without specifing large images) work when its freshly loaded?
Contents of my object are as follows;
go.reloaded@largeImages[["composite"]]@name
: 'composite'go.reloaded@largeImages[["composite"]]@file_path
: "/path_to_dir/theFlatfileDir/CellComposite/CellComposite_F001.jpg"go.reloaded@images[['image']]@name
: 'image'go.reloaded@images[['image']]@file_path
: NULLThanks again.
Thanks Sarah for asking this; I am facing a similar scenario atm. I am using Giotto v3.3.1, and I am running my code on AWS EC2 instance. So I have processed the data and have been working on it for a couple of days now. I intentionally did not shout down the instance to avoid having any potential issues with the pointers when I reload it... but surprisingly, I am unable to run the exact same code I ran on the first day; Here is the code and the error I get.
spatInSituPlotPoints(fov_join,
show_image = T,
image_name = image_names,
show_polygon = TRUE,
spat_unit = 'cell',
feats = list('rna' = c("EPCAM")),
feats_color_code = c("yellow",),
point_size = 0.08,
use_overlap = T,
coord_fix_ratio = TRUE,
background_color = NA,
polygon_line_size = 0.02,
polygon_alpha = 0.3,
polygon_feat_type = 'cell',
polygon_fill = 'CellSubType',
polygon_fill_as_factor = TRUE,
polygon_fill_code = CellSubType_col,
save_param = list(
save_name = paste0(sampleName, '_spatInSituPlotPoints'),
base_width = 9,
base_height = 7,
save_format = 'png'
))
select image done
Error in gimage[[i]]@mg_object[[1]] :
object of type 'externalptr' is not subsettable
So I examined the image slot, and while I can see the image names under fov_join@images
, the file_paths are NULL looking at the @file_path
slot, for example fov_join@images$fov001-image@file_path
. Interestingly, I do not get to see the largeImage list in this object anymore.
fov_join@largeImages
$`fov001-composite`
Error in .Call(list(name = "CppField__get", address = <pointer: (nil)>, :
NULL value passed as symbol address
If I remove the image arguments from my code (i.e. commenting show_image = T
& image_name = image_names
), and run it with only polygons and points, I get a new Error:
Error in .External(list(name = "CppMethod__invoke_notvoid", address = <pointer: (nil)>, :
NULL value passed as symbol address
So, then I thought I would load the data that I had saved half way through (after normalisation/processing), and try to visualise the data using the reloaded object. While loading the data, I get similar messages as @swbioinf mentioned above "image : no filepaths found. Skipping.". I also get the exact same Error as I got in the first chunk of code when trying to plot it. However, removing the image arguments this time, allowed me to plot it. Interestingly, in this reloaded object, I can see the large image information when checking fov_join@largeImages
but still the file paths under the image slots are empty.
I also tried assigning largeimage_name argument instead of image_name argument in both data (using all three composite, overlay and compartment), but I get this error:
Error in get_giottoLargeImage(gobject = gobject, name = largeImage_name) :
composite was not found among the largeImage names. See showGiottoImageNames()
and running showGiottoImageNames()
gives me these names.
So, there are a few things I do not understand here and they seem to be related to the pointer issues and linking to image file paths:
Really appreciate any help/comments or insights into these. Many thanks! Sepideh
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux 8.7 (Ootpa)
Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblasp-r0.3.15.so
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] stats graphics grDevices utils datasets methods base
other attached packages:
[1] plyr_1.8.9 cowplot_1.1.1 plotly_4.10.3 broom_1.0.5 growthcurver_0.3.1 lubridate_1.9.3 forcats_1.0.0 stringr_1.5.0
[9] purrr_1.0.2 readr_2.1.4 tidyr_1.3.0 tibble_3.2.1 tidyverse_2.0.0 shinyWidgets_0.8.0 shiny_1.7.5 UpSetR_1.4.0
[17] Giotto_3.3.1 smfishHmrf_0.1 fs_1.6.3 pracma_2.4.2 singscore_1.18.0 InSituType_0.99.4 data.table_1.14.8 qs_0.25.5
[25] dplyr_1.1.3 patchwork_1.1.3 viridis_0.6.4 viridisLite_0.4.2 ggplot2_3.4.4 RColorBrewer_1.1-3
loaded via a namespace (and not attached):
[1] rappdirs_0.3.3 SnowballC_0.7.1 SparseM_1.81 scattermore_1.2 ragg_1.2.5
[6] SeuratObject_4.1.4 bit64_4.0.5 knitr_1.45 irlba_2.3.5.1 DelayedArray_0.24.0
[11] inline_0.3.19 KEGGREST_1.38.0 RCurl_1.98-1.12 doParallel_1.0.17 generics_0.1.3
[16] flowCore_2.10.0 BiocGenerics_0.44.0 callr_3.7.3 terra_1.7-55 usethis_2.2.2
[21] RSQLite_2.3.1 RApiSerialize_0.1.2 RANN_2.6.1 future_1.33.0 bit_4.0.5
[26] tzdb_0.4.0 spatstat.data_3.0-1 httpuv_1.6.11 StanHeaders_2.26.28 SummarizedExperiment_1.28.0
[31] xfun_0.41 hms_1.1.3 jquerylib_0.1.4 evaluate_0.23 promises_1.2.1
[36] fansi_1.0.5 igraph_1.5.1 DBI_1.1.3 htmlwidgets_1.6.2 spatstat.geom_3.2-5
[41] stats4_4.2.0 sccomp_1.2.1 ellipsis_0.3.2 RSpectra_0.16-1 ggpubr_0.6.0
[46] backports_1.4.1 cytolib_2.10.1 annotate_1.76.0 deldir_1.0-9 RcppParallel_5.1.7
[51] MatrixGenerics_1.10.0 vctrs_0.6.4 SingleCellExperiment_1.20.1 Biobase_2.58.0 remotes_2.4.2.1
[56] ROCR_1.0-11 abind_1.4-5 cachem_1.0.8 withr_2.5.2 progressr_0.14.0
[61] sctransform_0.4.0 prettyunits_1.2.0 goftest_1.2-3 mclust_6.0.0 cluster_2.1.4
[66] lazyeval_0.2.2 crayon_1.5.2 spatstat.explore_3.2-3 labeling_0.4.3 edgeR_3.40.2
[71] pkgconfig_2.0.3 GenomeInfoDb_1.34.9 pkgload_1.3.3 nlme_3.1-163 devtools_2.4.5
[76] rlang_1.1.2 globals_0.16.2 lifecycle_1.0.4 miniUI_0.1.1.1 polyclip_1.10-6
[81] matrixStats_1.1.0 lmtest_0.9-40 platetools_0.1.5 graph_1.76.0 Matrix_1.6-1.1
[86] loo_2.6.0 carData_3.0-5 boot_1.3-28.1 zoo_1.8-12 ggridges_0.5.4
[91] GlobalOptions_0.1.2 processx_3.8.2 png_0.1-8 rjson_0.2.21 stringfish_0.15.8
[96] bitops_1.0-7 KernSmooth_2.23-22 Biostrings_2.66.0 blob_1.2.4 shape_1.4.6
[101] spatstat.random_3.1-6 parallelly_1.36.0 rstatix_0.7.2 ggsignif_0.6.4 S4Vectors_0.36.2
[106] scales_1.2.1 memoise_2.0.1 GSEABase_1.60.0 magrittr_2.0.3 ica_1.0-3
[111] zlibbioc_1.44.0 compiler_4.2.0 rstantools_2.3.1.1 clue_0.3-65 fitdistrplus_1.1-11
[116] cli_3.6.1 urlchecker_1.0.1 XVector_0.38.0 listenv_0.9.0 pbapply_1.7-2
[121] ps_1.7.5 MASS_7.3-60 tidyselect_1.2.0 stringi_1.8.1 RProtoBufLib_2.10.0
[126] textshaping_0.3.6 yaml_2.3.7 askpass_1.2.0 locfit_1.5-9.8 ggrepel_0.9.4
[131] grid_4.2.0 sass_0.4.7 tools_4.2.0 timechange_0.2.0 future.apply_1.11.0
[136] parallel_4.2.0 circlize_0.4.15 rstudioapi_0.15.0 foreach_1.5.2 lsa_0.73.3
[141] gridExtra_2.3 farver_2.1.1 Rtsne_0.16 BiocManager_1.30.22 digest_0.6.33
[146] Rcpp_1.0.11 car_3.1-2 GenomicRanges_1.50.2 later_1.3.1 RcppAnnoy_0.0.21
[151] httr_1.4.7 QuickJSR_1.0.6 AnnotationDbi_1.60.2 ComplexHeatmap_2.14.0 Rdpack_2.5
[156] colorspace_2.1-0 tensor_1.5 XML_3.99-0.14 reticulate_1.34.0 umap_0.2.10.0
[161] IRanges_2.32.0 splines_4.2.0 uwot_0.1.16 spatstat.utils_3.0-3 sp_2.1-1
[166] systemfonts_1.0.4 sessioninfo_1.2.2 xtable_1.8-4 jsonlite_1.8.7 rstan_2.26.23
[171] R6_2.5.1 profvis_0.3.8 pillar_1.9.0 htmltools_0.5.7 mime_0.12
[176] glue_1.6.2 fastmap_1.1.1 codetools_0.2-19 pkgbuild_1.4.2 utf8_1.2.4
[181] spatstat.sparse_3.0-2 lattice_0.21-9 bslib_0.5.1 leiden_0.4.3 gtools_3.9.4
[186] openssl_2.1.1 survival_3.5-7 limma_3.54.2 rmarkdown_2.25 munsell_0.5.0
[191] GetoptLong_1.0.5 GenomeInfoDbData_1.2.9 iterators_1.0.14 reshape2_1.4.4 gtable_0.3.4
[196] rbibutils_2.2.15 Seurat_4.4.0
Thanks for letting us know and we're looking into this. We're currently making some major updates as part of a new big release so it might take us a little bit longer to figure this out.
If I run the following, everything looks ok - image is plotted.
But, if I reload from that save, it appears the image filepath isn't found:
go.reloaded <- loadGiotto(file.path(getwd(),"gosave"))
The loading message says filepath not found.
The contents of
go@images[["image"]]@file_path
is NULL.I understand I should probably use reconnectGiottoImage() as a fix? (I'm still working on the right way to provide filepaths for that). But am I right in thinking that these paths should normally be recorded at the createGiottoCosMxObject() stage so auto-reconnect can work? Any suggestions of how I could get them into the go object upon load?
(NB: Have the same problem when loading multiple FOVs, the names are stored, but paths are not)
Giotto suite v3.2
Thanks!