LieberInstitute / spatialLIBD

Code for the spatialLIBD R/Bioconductor package and shiny app

Home Page:http://LieberInstitute.github.io/spatialLIBD/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

an error when use check_sce() function

SiyuanHuang1 opened this issue · comments

As you said before (#35), I downloaded the three files manually: modeling_results, sce, sce_layer. But when I tried to convert sce to spe object, error happened. I used check_sce(), there was the same message.

Code

library(spatialLIBD)
load("Human_DLPFC_Visium_processedData_sce_scran_spatialLIBD.Rdata")
load("Human_DLPFC_Visium_processedData_sce_scran_sce_layer_spatialLIBD.Rdata")
load("Human_DLPFC_Visium_modeling_results.Rdata")

spe <- sce_to_spe(sce)
check_sce(sce)

error information

Error in check_sce(sce) : 
  Not all of all(c("imagerow", "imagecol", "sample_name", "key", variables) %in% .... are TRUE

I found this was because the downloaded sce object didn't include the ManualAnnotation and spatialLIBD columns

#the variables vector is from check_sce() source code

> c("imagerow","imagecol","sample_name","key",variables)[! c("imagerow","imagecol","sample_name","key",variables) %in% colnames(colData(sce))]
[1] "ManualAnnotation" "spatialLIBD"

So the ManualAnnotation and spatialLIBD are important? could you provide them as .Rdata for us?
or should I delete these terms in check_sce() code for smooth running?

R session information

options(width = 120)
sessioninfo::session_info()

- Session info -------------------------------------------------------------------------------------------------------
 setting  value
 version  R version 4.1.2 (2021-11-01)
 os       Windows 10 x64 (build 19042)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  Chinese (Simplified)_China.936
 ctype    Chinese (Simplified)_China.936
 tz       Asia/Taipei
 date     2022-03-04
 rstudio  1.3.1073 Giant Goldenrod (desktop)
 pandoc   2.10 @ D:\\hsy\\software\\anaconda\\Scripts\\pandoc.exe

- Packages -----------------------------------------------------------------------------------------------------------
 ! package                * version  date (UTC) lib source
   AnnotationDbi            1.56.2   2021-11-09 [1] Bioconductor
   AnnotationHub            3.2.2    2022-03-01 [1] Bioconductor
   assertthat               0.2.1    2019-03-21 [1] CRAN (R 4.1.2)
   attempt                  0.3.1    2020-05-03 [1] CRAN (R 4.1.2)
   beachmat                 2.10.0   2021-10-26 [1] Bioconductor
   beeswarm                 0.4.0    2021-06-01 [1] CRAN (R 4.1.1)
   benchmarkme              1.0.7    2021-03-21 [1] CRAN (R 4.1.2)
   benchmarkmeData          1.0.4    2020-04-23 [1] CRAN (R 4.1.2)
   Biobase                * 2.54.0   2021-10-26 [1] Bioconductor
   BiocFileCache            2.2.1    2022-01-23 [1] Bioconductor
   BiocGenerics           * 0.40.0   2021-10-26 [1] Bioconductor
   BiocIO                   1.4.0    2021-10-26 [1] Bioconductor
   BiocManager              1.30.16  2021-06-15 [1] CRAN (R 4.1.2)
   BiocNeighbors            1.12.0   2021-10-26 [1] Bioconductor
   BiocParallel             1.28.3   2021-12-09 [1] Bioconductor
   BiocSingular             1.10.0   2021-10-26 [1] Bioconductor
   BiocVersion              3.14.0   2021-05-27 [1] Bioconductor
   Biostrings               2.62.0   2021-10-26 [1] Bioconductor
   bit                      4.0.4    2020-08-04 [1] CRAN (R 4.1.2)
   bit64                    4.0.5    2020-08-30 [1] CRAN (R 4.1.2)
   bitops                   1.0-7    2021-04-24 [1] CRAN (R 4.1.1)
   blob                     1.2.2    2021-07-23 [1] CRAN (R 4.1.2)
   brio                     1.1.3    2021-11-30 [1] CRAN (R 4.1.2)
   bslib                    0.3.1    2021-10-06 [1] CRAN (R 4.1.2)
   cachem                   1.0.6    2021-08-19 [1] CRAN (R 4.1.2)
   callr                    3.7.0    2021-04-20 [1] CRAN (R 4.1.2)
   cli                      3.2.0    2022-02-14 [1] CRAN (R 4.1.2)
   codetools                0.2-18   2020-11-04 [1] CRAN (R 4.1.2)
   colorspace               2.0-3    2022-02-21 [1] CRAN (R 4.1.2)
   config                   0.3.1    2020-12-17 [1] CRAN (R 4.1.2)
   cowplot                  1.1.1    2020-12-30 [1] CRAN (R 4.1.2)
   crayon                   1.5.0    2022-02-14 [1] CRAN (R 4.1.2)
   curl                     4.3.2    2021-06-23 [1] CRAN (R 4.1.2)
   data.table               1.14.2   2021-09-27 [1] CRAN (R 4.1.2)
   DBI                      1.1.2    2021-12-20 [1] CRAN (R 4.1.2)
   dbplyr                   2.1.1    2021-04-06 [1] CRAN (R 4.1.2)
   DelayedArray             0.20.0   2021-10-26 [1] Bioconductor
   DelayedMatrixStats       1.16.0   2021-10-26 [1] Bioconductor
   desc                     1.4.0    2021-09-28 [1] CRAN (R 4.1.2)
   digest                   0.6.29   2021-12-01 [1] CRAN (R 4.1.2)
   dockerfiler              0.1.4    2021-09-03 [1] CRAN (R 4.1.2)
   doParallel               1.0.17   2022-02-07 [1] CRAN (R 4.1.2)
   dotCall64                1.0-1    2021-02-11 [1] CRAN (R 4.1.2)
   dplyr                    1.0.8    2022-02-08 [1] CRAN (R 4.1.2)
   dqrng                    0.3.0    2021-05-01 [1] CRAN (R 4.1.2)
   DropletUtils             1.14.2   2022-01-09 [1] Bioconductor
   DT                       0.21     2022-02-26 [1] CRAN (R 4.1.2)
   edgeR                    3.36.0   2021-10-26 [1] Bioconductor
   ellipsis                 0.3.2    2021-04-29 [1] CRAN (R 4.1.2)
   ExperimentHub            2.2.1    2022-01-23 [1] Bioconductor
   fansi                    1.0.2    2022-01-14 [1] CRAN (R 4.1.2)
   fastmap                  1.1.0    2021-01-25 [1] CRAN (R 4.1.2)
   fields                   13.3     2021-10-30 [1] CRAN (R 4.1.2)
   filelock                 1.0.2    2018-10-05 [1] CRAN (R 4.1.2)
   foreach                  1.5.2    2022-02-02 [1] CRAN (R 4.1.2)
   fs                       1.5.2    2021-12-08 [1] CRAN (R 4.1.2)
   generics                 0.1.2    2022-01-31 [1] CRAN (R 4.1.2)
   GenomeInfoDb           * 1.30.1   2022-01-30 [1] Bioconductor
   GenomeInfoDbData         1.2.7    2022-03-03 [1] Bioconductor
   GenomicAlignments        1.30.0   2021-10-26 [1] Bioconductor
   GenomicRanges          * 1.46.1   2021-11-18 [1] Bioconductor
   ggbeeswarm               0.6.0    2017-08-07 [1] CRAN (R 4.1.2)
   ggplot2                  3.3.5    2021-06-25 [1] CRAN (R 4.1.2)
   ggrepel                  0.9.1    2021-01-15 [1] CRAN (R 4.1.2)
   glue                     1.6.2    2022-02-24 [1] CRAN (R 4.1.2)
   golem                    0.3.1    2021-04-17 [1] CRAN (R 4.1.2)
   gridExtra                2.3      2017-09-09 [1] CRAN (R 4.1.2)
   gtable                   0.3.0    2019-03-25 [1] CRAN (R 4.1.2)
   HDF5Array                1.22.1   2021-11-14 [1] Bioconductor
   htmltools                0.5.2    2021-08-25 [1] CRAN (R 4.1.2)
   htmlwidgets              1.5.4    2021-09-08 [1] CRAN (R 4.1.2)
   httpuv                   1.6.5    2022-01-05 [1] CRAN (R 4.1.2)
   httr                     1.4.2    2020-07-20 [1] CRAN (R 4.1.2)
   interactiveDisplayBase   1.32.0   2021-10-26 [1] Bioconductor
   IRanges                * 2.28.0   2021-10-26 [1] Bioconductor
   irlba                    2.3.5    2021-12-06 [1] CRAN (R 4.1.2)
   iterators                1.0.14   2022-02-05 [1] CRAN (R 4.1.2)
   jquerylib                0.1.4    2021-04-26 [1] CRAN (R 4.1.2)
   jsonlite                 1.8.0    2022-02-22 [1] CRAN (R 4.1.2)
   KEGGREST                 1.34.0   2021-10-26 [1] Bioconductor
   knitr                    1.37     2021-12-16 [1] CRAN (R 4.1.2)
   later                    1.3.0    2021-08-18 [1] CRAN (R 4.1.2)
   lattice                  0.20-45  2021-09-22 [1] CRAN (R 4.1.2)
   lazyeval                 0.2.2    2019-03-15 [1] CRAN (R 4.1.2)
   lifecycle                1.0.1    2021-09-24 [1] CRAN (R 4.1.2)
   limma                    3.50.1   2022-02-17 [1] Bioconductor
   locfit                   1.5-9.4  2020-03-25 [1] CRAN (R 4.1.2)
   magick                   2.7.3    2021-08-18 [1] CRAN (R 4.1.2)
   magrittr                 2.0.2    2022-01-26 [1] CRAN (R 4.1.2)
   maps                     3.4.0    2021-09-25 [1] CRAN (R 4.1.2)
   Matrix                   1.4-0    2021-12-08 [1] CRAN (R 4.1.2)
   MatrixGenerics         * 1.6.0    2021-10-26 [1] Bioconductor
   matrixStats            * 0.61.0   2021-09-17 [1] CRAN (R 4.1.2)
   memoise                  2.0.1    2021-11-26 [1] CRAN (R 4.1.2)
   mime                     0.12     2021-09-28 [1] CRAN (R 4.1.1)
   munsell                  0.5.0    2018-06-12 [1] CRAN (R 4.1.2)
   pillar                   1.7.0    2022-02-01 [1] CRAN (R 4.1.2)
   pkgbuild                 1.3.1    2021-12-20 [1] CRAN (R 4.1.2)
   pkgconfig                2.0.3    2019-09-22 [1] CRAN (R 4.1.2)
   pkgload                  1.2.4    2021-11-30 [1] CRAN (R 4.1.2)
   plotly                   4.10.0   2021-10-09 [1] CRAN (R 4.1.2)
   png                      0.1-7    2013-12-03 [1] CRAN (R 4.1.1)
   Polychrome               1.3.1    2021-07-16 [1] CRAN (R 4.1.2)
   prettyunits              1.1.1    2020-01-24 [1] CRAN (R 4.1.2)
   processx                 3.5.2    2021-04-30 [1] CRAN (R 4.1.2)
   promises                 1.2.0.1  2021-02-11 [1] CRAN (R 4.1.2)
   ps                       1.6.0    2021-02-28 [1] CRAN (R 4.1.2)
   purrr                    0.3.4    2020-04-17 [1] CRAN (R 4.1.2)
   R.methodsS3              1.8.1    2020-08-26 [1] CRAN (R 4.1.1)
   R.oo                     1.24.0   2020-08-26 [1] CRAN (R 4.1.1)
   R.utils                  2.11.0   2021-09-26 [1] CRAN (R 4.1.2)
   R6                       2.5.1    2021-08-19 [1] CRAN (R 4.1.2)
   rappdirs                 0.3.3    2021-01-31 [1] CRAN (R 4.1.2)
   RColorBrewer             1.1-2    2014-12-07 [1] CRAN (R 4.1.1)
   Rcpp                     1.0.8    2022-01-13 [1] CRAN (R 4.1.2)
   RCurl                    1.98-1.6 2022-02-08 [1] CRAN (R 4.1.2)
   remotes                  2.4.2    2021-11-30 [1] CRAN (R 4.1.2)
   restfulr                 0.0.13   2017-08-06 [1] CRAN (R 4.1.2)
   rhdf5                    2.38.0   2021-10-26 [1] Bioconductor
 D rhdf5filters             1.6.0    2021-10-26 [1] Bioconductor
   Rhdf5lib                 1.16.0   2021-10-26 [1] Bioconductor
   rjson                    0.2.21   2022-01-09 [1] CRAN (R 4.1.2)
   rlang                    1.0.1    2022-02-03 [1] CRAN (R 4.1.2)
   roxygen2                 7.1.2    2021-09-08 [1] CRAN (R 4.1.2)
   rprojroot                2.0.2    2020-11-15 [1] CRAN (R 4.1.2)
   Rsamtools                2.10.0   2021-10-26 [1] Bioconductor
   RSQLite                  2.2.10   2022-02-17 [1] CRAN (R 4.1.2)
   rstudioapi               0.13     2020-11-12 [1] CRAN (R 4.1.2)
   rsvd                     1.0.5    2021-04-16 [1] CRAN (R 4.1.2)
   rtracklayer              1.54.0   2021-10-26 [1] Bioconductor
   S4Vectors              * 0.32.3   2021-11-21 [1] Bioconductor
   sass                     0.4.0    2021-05-12 [1] CRAN (R 4.1.2)
   ScaledMatrix             1.2.0    2021-10-26 [1] Bioconductor
   scales                   1.1.1    2020-05-11 [1] CRAN (R 4.1.2)
   scater                   1.22.0   2021-10-27 [1] Bioconductor
   scatterplot3d            0.3-41   2018-03-14 [1] CRAN (R 4.1.1)
   scuttle                  1.4.0    2021-10-26 [1] Bioconductor
   sessioninfo              1.2.2    2021-12-06 [1] CRAN (R 4.1.2)
   shiny                    1.7.1    2021-10-02 [1] CRAN (R 4.1.2)
   shinyWidgets             0.6.4    2022-02-06 [1] CRAN (R 4.1.2)
   SingleCellExperiment   * 1.16.0   2021-10-26 [1] Bioconductor
   spam                     2.8-0    2022-01-06 [1] CRAN (R 4.1.2)
   sparseMatrixStats        1.6.0    2021-10-26 [1] Bioconductor
   SpatialExperiment      * 1.4.0    2021-10-26 [1] Bioconductor
   spatialLIBD            * 1.6.5    2022-01-12 [1] Bioconductor
   stringi                  1.7.6    2021-11-29 [1] CRAN (R 4.1.2)
   stringr                  1.4.0    2019-02-10 [1] CRAN (R 4.1.2)
   SummarizedExperiment   * 1.24.0   2021-10-26 [1] Bioconductor
   testthat                 3.1.2    2022-01-20 [1] CRAN (R 4.1.2)
   tibble                   3.1.6    2021-11-07 [1] CRAN (R 4.1.2)
   tidyr                    1.2.0    2022-02-01 [1] CRAN (R 4.1.2)
   tidyselect               1.1.2    2022-02-21 [1] CRAN (R 4.1.2)
   usethis                  2.1.5    2021-12-09 [1] CRAN (R 4.1.2)
   utf8                     1.2.2    2021-07-24 [1] CRAN (R 4.1.2)
   vctrs                    0.3.8    2021-04-29 [1] CRAN (R 4.1.2)
   vipor                    0.4.5    2017-03-22 [1] CRAN (R 4.1.2)
   viridis                  0.6.2    2021-10-13 [1] CRAN (R 4.1.2)
   viridisLite              0.4.0    2021-04-13 [1] CRAN (R 4.1.2)
   withr                    2.4.3    2021-11-30 [1] CRAN (R 4.1.2)
   xfun                     0.30     2022-03-02 [1] CRAN (R 4.1.2)
   XML                      3.99-0.9 2022-02-24 [1] CRAN (R 4.1.2)
   xml2                     1.3.3    2021-11-30 [1] CRAN (R 4.1.2)
   xtable                   1.8-4    2019-04-21 [1] CRAN (R 4.1.2)
   XVector                  0.34.0   2021-10-26 [1] Bioconductor
   yaml                     2.3.5    2022-02-21 [1] CRAN (R 4.1.2)
   zlibbioc                 1.40.0   2021-10-26 [1] Bioconductor

 [1] D:/hsy/software/R-4.1.2/library

 D -- DLL MD5 mismatch, broken installation.

----------------------------------------------------------------------------------------------------------------------

Hi,

I believe that you meant to use check_spe() not the one that ends in sce.

Best,
Leo

No, maybe my code confused you. I re-show it:

> load("D:/hsy/project/ST/data/DLPFC/Human_DLPFC_Visium_processedData_sce_scran_spatialLIBD.Rdata")
> check_sce(sce)
Error in check_sce(sce) : 
  Not all of all(c("imagerow", "imagecol", "sample_name", "key", variables) %in% .... are TRUE
> spe <- sce_to_spe(sce)
Error in check_sce(sce) : 
  Not all of all(c("imagerow", "imagecol", "sample_name", "key", variables) %in% .... are TRUE

The reason is that there is not ManualAnnotation&spatialLIBD in Human_DLPFC_Visium_processedData_sce_scran_spatialLIBD.Rdata

Hi @SiyuanHuang1 ,

I tried reproducing your error and couldn't initially:

master > sce <- fetch_data("sce")
snapshotDate(): 2022-03-01
2022-03-04 19:00:27 loading file /Users/leocollado/Library/Caches/org.R-project.R/R/BiocFileCache/3ae9464272d_Human_DLPFC_Visium_processedData_sce_scran_spatialLIBD.Rdata%3Fdl%3D1
master > check_sce(sce)
class: SingleCellExperiment 
dim: 33538 47681 
metadata(1): image
assays(2): counts logcounts
rownames(33538): ENSG00000243485 ENSG00000237613 ...
  ENSG00000277475 ENSG00000268674
rowData names(9): source type ... gene_search is_top_hvg
colnames(47681): AAACAACGAATAGTTC-1 AAACAAGTATCTCCCA-1 ...
  TTGTTTCCATACAACT-1 TTGTTTGTGTAAATTC-1
colData names(74): barcode sample_name ... spatialLIBD
  ManualAnnotation
reducedDimNames(6): PCA TSNE_perplexity50 ...
  TSNE_perplexity80 UMAP_neighbors15
mainExpName: NULL
altExpNames(0):

However, I was forgetting about https://github.com/LieberInstitute/spatialLIBD/blob/master/R/fetch_data.R#L150 which is defined at https://github.com/LieberInstitute/spatialLIBD/blob/master/R/fetch_data.R#L161-L170. So in your case you would need to do this:

library("spatialLIBD")
load("Human_DLPFC_Visium_processedData_sce_scran_spatialLIBD.Rdata", verbose = TRUE)
## You could use the same name, but I'm using different ones here for clarity
updated_sce <- spatialLIBD:::.update_sce(sce)
## Note the ::: and not the :: in the line above, that's because .update_sce() is a non-exported function in spatialLIBD
check_sce(updated_sce)

## Continue along ^^

Have a good weekend!

Best,
Leo

I got it! Thank u for your advice

Hi,
I followed the steps, but I still encountered an error in the final step. What should I do to resolve it?
library("spatialLIBD")
load("Human_DLPFC_Visium_processedData_sce_scran_spatialLIBD.Rdata", verbose = TRUE)

You could use the same name, but I'm using different ones here for clarity

updated_sce <- spatialLIBD:::.update_sce(sce)

Note the ::: and not the :: in the line above, that's because .update_sce() is a non-exported function in spatialLIBD

check_sce(updated_sce)
image