LieberInstitute / spatialLIBD

Code for the spatialLIBD R/Bioconductor package and shiny app
http://LieberInstitute.github.io/spatialLIBD/
78 stars 16 forks source link

[BUG] run_app() error in frame_limits in newer R version #51

Closed erkinacar5 closed 9 months ago

erkinacar5 commented 9 months ago

Describe the bug

I have custom object from my project that I have been running on spatialLIBD using 1.10.0 version on R 4.2.2. Currently, my collaborator told me she cannot run it on R 4.3.2 with a later version of the spatialLIBD (1.13.4). I tested it myself and I have the same issue with her. If we provide our custom www folder (which works fine in previous version) We get:

Warning: Error in if: argument is of length zero
  75: detect_html_document
  74: includeHTML
  60: ui
   3: runApp
   2: print.shiny.appobj
   1: <Anonymous>

And if we use the default www the package has, we get:

Warning: Error in frame_limits: all(c("array_row", "array_col", "pxl_row_in_fullres", "pxl_col_in_fullres") %in%  .... is not TRUE
  107: <Anonymous>
  106: stop
  105: stopifnot
  104: frame_limits
  103: renderPlotly
  102: func
   99: shinyRenderWidget
   98: func
   85: renderFunc
   84: output$histology_plotly
    3: runApp
    2: print.shiny.appobj
    1: <Anonymous>

Provide a minimally reproducible example (reprex)

Since we are about to publish our work, unfortunately, I cannot provide the object :/

Expected behavior

Normally I would just get the interactive app with my object.

R Session Information

Please report the output of either sessionInfo() or sessioninfo::session_info() here.

```R options(width = 120) ## insert session info here > sessioninfo::session_info() ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────── setting value version R version 4.3.2 (2023-10-31 ucrt) os Windows 10 x64 (build 19045) system x86_64, mingw32 ui RStudio language (EN) collate English_Switzerland.utf8 ctype English_Switzerland.utf8 tz Europe/Zurich date 2023-11-15 rstudio 2023.09.1+494 Desert Sunflower (desktop) pandoc NA ─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── package * version date (UTC) lib source abind 1.4-5 2016-07-21 [1] CRAN (R 4.3.1) AnnotationDbi 1.64.1 2023-11-03 [1] Bioconductor AnnotationHub 3.10.0 2023-10-24 [1] Bioconductor attempt 0.3.1 2020-05-03 [1] CRAN (R 4.3.2) beachmat 2.18.0 2023-10-24 [1] Bioconductor beeswarm 0.4.0 2021-06-01 [1] CRAN (R 4.3.1) benchmarkme 1.0.8 2022-06-12 [1] CRAN (R 4.3.2) benchmarkmeData 1.0.4 2020-04-23 [1] CRAN (R 4.3.2) Biobase * 2.62.0 2023-10-24 [1] Bioconductor BiocFileCache 2.10.1 2023-10-26 [1] Bioconductor BiocGenerics * 0.48.1 2023-11-01 [1] Bioconductor BiocIO 1.12.0 2023-10-24 [1] Bioconductor BiocManager 1.30.22 2023-08-08 [1] CRAN (R 4.3.2) BiocNeighbors 1.20.0 2023-10-24 [1] Bioconductor BiocParallel 1.36.0 2023-10-24 [1] Bioconductor BiocSingular 1.18.0 2023-10-24 [1] Bioconductor BiocVersion 3.18.0 2023-04-26 [1] Bioconductor Biostrings 2.70.1 2023-10-25 [1] Bioconductor bit 4.0.5 2022-11-15 [1] CRAN (R 4.3.2) bit64 4.0.5 2020-08-30 [1] CRAN (R 4.3.2) bitops 1.0-7 2021-04-24 [1] CRAN (R 4.3.1) blob 1.2.4 2023-03-17 [1] CRAN (R 4.3.2) bslib 0.5.1 2023-08-11 [1] CRAN (R 4.3.2) cachem 1.0.8 2023-05-01 [1] CRAN (R 4.3.2) cli 3.6.1 2023-03-23 [1] CRAN (R 4.3.2) codetools 0.2-19 2023-02-01 [2] CRAN (R 4.3.2) colorspace 2.1-0 2023-01-23 [1] CRAN (R 4.3.2) commonmark 1.9.0 2023-03-17 [1] CRAN (R 4.3.2) config 0.3.2 2023-08-30 [1] CRAN (R 4.3.2) cowplot 1.1.1 2020-12-30 [1] CRAN (R 4.3.2) crayon 1.5.2 2022-09-29 [1] CRAN (R 4.3.2) curl 5.1.0 2023-10-02 [1] CRAN (R 4.3.2) data.table 1.14.8 2023-02-17 [1] CRAN (R 4.3.2) DBI 1.1.3 2022-06-18 [1] CRAN (R 4.3.2) dbplyr 2.4.0 2023-10-26 [1] CRAN (R 4.3.2) DelayedArray 0.28.0 2023-10-24 [1] Bioconductor DelayedMatrixStats 1.24.0 2023-10-24 [1] Bioconductor digest 0.6.33 2023-07-07 [1] CRAN (R 4.3.2) doParallel 1.0.17 2022-02-07 [1] CRAN (R 4.3.2) dotCall64 1.1-0 2023-10-17 [1] CRAN (R 4.3.2) dplyr 1.1.3 2023-09-03 [1] CRAN (R 4.3.2) DT 0.30 2023-10-05 [1] CRAN (R 4.3.2) edgeR 4.0.1 2023-10-29 [1] Bioconductor ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.3.2) ExperimentHub 2.10.0 2023-10-24 [1] Bioconductor fansi 1.0.5 2023-10-08 [1] CRAN (R 4.3.2) farver 2.1.1 2022-07-06 [1] CRAN (R 4.3.2) fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.2) fields 15.2 2023-08-17 [1] CRAN (R 4.3.2) filelock 1.0.2 2018-10-05 [1] CRAN (R 4.3.2) fontawesome 0.5.2 2023-08-19 [1] CRAN (R 4.3.2) foreach 1.5.2 2022-02-02 [1] CRAN (R 4.3.2) fs 1.6.3 2023-07-20 [1] CRAN (R 4.3.2) generics 0.1.3 2022-07-05 [1] CRAN (R 4.3.2) GenomeInfoDb * 1.38.1 2023-11-08 [1] Bioconductor GenomeInfoDbData 1.2.11 2023-11-15 [1] Bioconductor GenomicAlignments 1.38.0 2023-10-24 [1] Bioconductor GenomicRanges * 1.54.1 2023-10-29 [1] Bioconductor ggbeeswarm 0.7.2 2023-04-29 [1] CRAN (R 4.3.2) ggplot2 3.4.4 2023-10-12 [1] CRAN (R 4.3.2) ggrepel 0.9.4 2023-10-13 [1] CRAN (R 4.3.2) glue 1.6.2 2022-02-24 [1] CRAN (R 4.3.2) golem 0.4.1 2023-06-05 [1] CRAN (R 4.3.2) gridExtra 2.3 2017-09-09 [1] CRAN (R 4.3.2) gtable 0.3.4 2023-08-21 [1] CRAN (R 4.3.2) htmltools 0.5.7 2023-11-03 [1] CRAN (R 4.3.2) htmlwidgets 1.6.2 2023-03-17 [1] CRAN (R 4.3.2) httpuv 1.6.12 2023-10-23 [1] CRAN (R 4.3.2) httr 1.4.7 2023-08-15 [1] CRAN (R 4.3.2) interactiveDisplayBase 1.40.0 2023-10-24 [1] Bioconductor IRanges * 2.36.0 2023-10-24 [1] Bioconductor irlba 2.3.5.1 2022-10-03 [1] CRAN (R 4.3.2) iterators 1.0.14 2022-02-05 [1] CRAN (R 4.3.2) jquerylib 0.1.4 2021-04-26 [1] CRAN (R 4.3.2) jsonlite 1.8.7 2023-06-29 [1] CRAN (R 4.3.2) KEGGREST 1.42.0 2023-10-24 [1] Bioconductor later 1.3.1 2023-05-02 [1] CRAN (R 4.3.2) lattice 0.21-9 2023-10-01 [2] CRAN (R 4.3.2) lazyeval 0.2.2 2019-03-15 [1] CRAN (R 4.3.2) lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.3.2) limma 3.58.1 2023-10-31 [1] Bioconductor locfit 1.5-9.8 2023-06-11 [1] CRAN (R 4.3.2) magick 2.8.1 2023-10-22 [1] CRAN (R 4.3.2) magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.2) maps 3.4.1.1 2023-11-03 [1] CRAN (R 4.3.2) markdown * 1.11 2023-10-19 [1] CRAN (R 4.3.2) Matrix 1.6-1.1 2023-09-18 [2] CRAN (R 4.3.2) MatrixGenerics * 1.14.0 2023-10-24 [1] Bioconductor matrixStats * 1.1.0 2023-11-07 [1] CRAN (R 4.3.2) memoise 2.0.1 2021-11-26 [1] CRAN (R 4.3.2) mime 0.12 2021-09-28 [1] CRAN (R 4.3.1) munsell 0.5.0 2018-06-12 [1] CRAN (R 4.3.2) paletteer 1.5.0 2022-10-19 [1] CRAN (R 4.3.2) pillar 1.9.0 2023-03-22 [1] CRAN (R 4.3.2) pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.3.2) plotly 4.10.3 2023-10-21 [1] CRAN (R 4.3.2) png 0.1-8 2022-11-29 [1] CRAN (R 4.3.1) prismatic 1.1.1 2022-08-15 [1] CRAN (R 4.3.2) promises 1.2.1 2023-08-10 [1] CRAN (R 4.3.2) purrr 1.0.2 2023-08-10 [1] CRAN (R 4.3.2) R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.2) rappdirs 0.3.3 2021-01-31 [1] CRAN (R 4.3.2) RColorBrewer 1.1-3 2022-04-03 [1] CRAN (R 4.3.1) Rcpp 1.0.11 2023-07-06 [1] CRAN (R 4.3.2) RCurl 1.98-1.13 2023-11-02 [1] CRAN (R 4.3.2) rematch2 2.1.2 2020-05-01 [1] CRAN (R 4.3.2) restfulr 0.0.15 2022-06-16 [1] CRAN (R 4.3.2) rjson 0.2.21 2022-01-09 [1] CRAN (R 4.3.1) rlang 1.1.2 2023-11-04 [1] CRAN (R 4.3.2) Rsamtools 2.18.0 2023-10-24 [1] Bioconductor RSQLite 2.3.3 2023-11-04 [1] CRAN (R 4.3.2) rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.3.2) rsvd 1.0.5 2021-04-16 [1] CRAN (R 4.3.2) rtracklayer 1.62.0 2023-10-24 [1] Bioconductor S4Arrays 1.2.0 2023-10-24 [1] Bioconductor S4Vectors * 0.40.1 2023-10-26 [1] Bioconductor sass 0.4.7 2023-07-15 [1] CRAN (R 4.3.2) ScaledMatrix 1.10.0 2023-10-24 [1] Bioconductor scales 1.2.1 2022-08-20 [1] CRAN (R 4.3.2) scater 1.30.0 2023-10-24 [1] Bioconductor scuttle 1.12.0 2023-10-24 [1] Bioconductor sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.2) shiny * 1.7.5.1 2023-10-14 [1] CRAN (R 4.3.2) shinyWidgets 0.8.0 2023-08-30 [1] CRAN (R 4.3.2) SingleCellExperiment * 1.24.0 2023-10-24 [1] Bioconductor spam 2.10-0 2023-10-23 [1] CRAN (R 4.3.2) SparseArray 1.2.2 2023-11-07 [1] Bioconductor sparseMatrixStats 1.14.0 2023-10-24 [1] Bioconductor SpatialExperiment * 1.12.0 2023-10-24 [1] Bioconductor spatialLIBD * 1.13.4 2023-05-25 [1] Bioconductor statmod 1.5.0 2023-01-06 [1] CRAN (R 4.3.2) SummarizedExperiment * 1.32.0 2023-10-24 [1] Bioconductor tibble 3.2.1 2023-03-20 [1] CRAN (R 4.3.2) tidyr 1.3.0 2023-01-24 [1] CRAN (R 4.3.2) tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.3.2) utf8 1.2.4 2023-10-22 [1] CRAN (R 4.3.2) vctrs 0.6.4 2023-10-12 [1] CRAN (R 4.3.2) vipor 0.4.5 2017-03-22 [1] CRAN (R 4.3.2) viridis 0.6.4 2023-07-22 [1] CRAN (R 4.3.2) viridisLite 0.4.2 2023-05-02 [1] CRAN (R 4.3.2) xfun 0.41 2023-11-01 [1] CRAN (R 4.3.2) XML 3.99-0.15 2023-11-02 [1] CRAN (R 4.3.2) xtable 1.8-4 2019-04-21 [1] CRAN (R 4.3.2) XVector 0.42.0 2023-10-24 [1] Bioconductor yaml 2.3.7 2023-01-23 [1] CRAN (R 4.3.2) zlibbioc 1.48.0 2023-10-24 [1] Bioconductor [1] C:/Users/Marit/AppData/Local/R/win-library/4.3 [2] C:/Program Files/R/R-4.3.2/library ```

Indicate whether BiocManager::valid() returns TRUE.

Note. To avoid potential issues with version mixing and reproducibility, do not install packages from GitHub.

Additional Context

Here is my code:

# We load the libraries
library("spatialLIBD")
library("markdown")

options("golem.app.prod" = TRUE)

## Load the data (all paths are relative)
spe_wrapper <- readRDS("spe.rds")
vars <- colnames(colData(spe_wrapper))

## Run the app. This will start a separate window
run_app(
  spe_wrapper,
  sce_layer = NULL,
  modeling_results = NULL,
  sig_genes = NULL,
  title = "spatialLIBD: Mouse brain results",
  spe_discrete_vars = c("SCT_snn_res.0.5", "seurat_clusters",
                        "SCT_snn_res.0.8","ManualAnnotation"),
  spe_continuous_vars = c("nCount_SCT", "percent.ribo","sum_umi",
                          "sum_gene", "expr_chrM", "expr_chrM_ratio"),
  default_cluster = "seurat_clusters"
  # docs_path = "www"
)

Is the package installed via bioconda?

No

Thank you in advance for your assistance and sorry if I am missing something obvious.

erkinacar5 commented 9 months ago

Hello, I wanted to give an update since I have been working on this :)

Apparently, my object doesn't like auto_crop, so setting the auto_crop_default = F helped with the app working.

For the wwwerror, I had my footer.html file empty for my local use, but the code doesn't like this. So I left some text in there and that is also working now. I hope this helps other people in the future.