spatialLIBD icon indicating copy to clipboard operation
spatialLIBD copied to clipboard

[BUG/clarification] Fetching pseudobulk data does not pass check_sce_layer

Open DaydreamingElephant opened this issue 11 months ago • 1 comments

Describe the bug

fetch_data(spatialDLPFC_Visium_pseudobulk) provides a SpatialExperiment object which passes no checks out of 'check_spe', 'check_sce' or 'check_sce_layer'and no clear way to convert it for downstream applications

Provide a minimally reproducible example (reprex)

library(spatialLIBD) sce_layer <- spatialLIBD::fetch_data(type = "spatialDLPFC_Visium_pseudobulk") check_spe(sce_layer) Error in check_spe(sce_layer) : all(c("sample_id", "image_id", "data", "scaleFactor") %in% colnames(imgData(spe))) is not TRUE check_sce(sce_layer) Error in check_sce(sce_layer) : "image" %in% names(metadata(sce)) is not TRUE check_sce_layer(sce_layer) Error in check_sce_layer(sce_layer) : all(variables %in% colnames(colData(sce_layer))) is not TRUE

Expected behavior

The pseudobulk data is eminently useful for the function 'sig_genes_extract_all' as an input for 'sce_layer', however the provided objects heavily impacts reproducibility so the remotely hosted object should be shifted to a SingleCellExperiment class that passes 'check_sce_layer' for consistency sake.

R Session Information

options(width = 120)
R version 4.4.2 (2024-10-31)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 20.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3;  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   
 [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] stats4    splines   stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] zellkonverter_1.16.0        spatialLIBD_1.18.0          SpatialExperiment_1.16.0    SingleCellExperiment_1.28.1
 [5] SummarizedExperiment_1.36.0 Biobase_2.66.0              GenomicRanges_1.58.0        GenomeInfoDb_1.42.1        
 [9] IRanges_2.40.1              S4Vectors_0.44.0            BiocGenerics_0.52.0         MatrixGenerics_1.18.1      
[13] matrixStats_1.5.0           ggplot2_3.5.1               edgeR_4.4.1                 limma_3.62.2               

loaded via a namespace (and not attached):
  [1] RColorBrewer_1.1-3       rstudioapi_0.17.1        jsonlite_1.8.9           magrittr_2.0.3           ggbeeswarm_0.7.2        
  [6] magick_2.8.5             BiocIO_1.16.0            fields_16.3              zlibbioc_1.52.0          vctrs_0.6.5             
 [11] memoise_2.0.1            config_0.3.2             Rsamtools_2.22.0         paletteer_1.6.0          RCurl_1.98-1.16         
 [16] benchmarkme_1.0.8        htmltools_0.5.8.1        S4Arrays_1.6.0           AnnotationHub_3.14.0     curl_6.1.0              
 [21] BiocNeighbors_2.0.1      SparseArray_1.6.1        sass_0.4.9               bslib_0.8.0              basilisk_1.18.0         
 [26] htmlwidgets_1.6.4        plotly_4.10.4            cachem_1.1.0             GenomicAlignments_1.42.0 mime_0.12               
 [31] lifecycle_1.0.4          iterators_1.0.14         pkgconfig_2.0.3          rsvd_1.0.5               Matrix_1.7-2            
 [36] R6_2.5.1                 fastmap_1.2.0            GenomeInfoDbData_1.2.13  shiny_1.10.0             digest_0.6.37           
 [41] colorspace_2.1-1         rematch2_2.1.2           AnnotationDbi_1.68.0     scater_1.34.0            irlba_2.3.5.1           
 [46] ExperimentHub_2.14.0     RSQLite_2.3.9            beachmat_2.22.0          filelock_1.0.3           httr_1.4.7              
 [51] abind_1.4-8              compiler_4.4.2           withr_3.0.2              bit64_4.6.0-1            doParallel_1.0.17       
 [56] attempt_0.3.1            BiocParallel_1.40.0      viridis_0.6.5            DBI_1.2.3                maps_3.4.2.1            
 [61] sessioninfo_1.2.2        rappdirs_0.3.3           DelayedArray_0.32.0      rjson_0.2.23             tools_4.4.2             
 [66] vipor_0.4.7              beeswarm_0.4.0           httpuv_1.6.15            glue_1.8.0               restfulr_0.0.15         
 [71] promises_1.3.2           grid_4.4.2               generics_0.1.3           gtable_0.3.6             tidyr_1.3.1             
 [76] data.table_1.16.4        BiocSingular_1.22.0      ScaledMatrix_1.14.0      XVector_0.46.0           stringr_1.5.1           
 [81] ggrepel_0.9.6            BiocVersion_3.20.0       foreach_1.5.2            pillar_1.10.1            spam_2.11-1             
 [86] later_1.4.1              benchmarkmeData_1.0.4    dplyr_1.1.4              BiocFileCache_2.14.0     lattice_0.22-6          
 [91] rtracklayer_1.66.0       bit_4.5.0.1              tidyselect_1.2.1         locfit_1.5-9.10          Biostrings_2.74.1       
 [96] scuttle_1.16.0           gridExtra_2.3            statmod_1.5.0            DT_0.33                  stringi_1.8.4           
[101] UCSC.utils_1.2.0         lazyeval_0.2.2           yaml_2.3.10              shinyWidgets_0.8.7       codetools_0.2-20        
[106] tibble_3.2.1             BiocManager_1.30.25      cli_3.6.3                reticulate_1.40.0        xtable_1.8-4            
[111] jquerylib_0.1.4          munsell_0.5.1            golem_0.5.1              Rcpp_1.0.14              dir.expiry_1.14.0       
[116] dbplyr_2.5.0             png_0.1-8                XML_3.99-0.18            parallel_4.4.2           blob_1.2.4              
[121] basilisk.utils_1.18.0    dotCall64_1.2            bitops_1.0-9             viridisLite_0.4.2        scales_1.3.0            
[126] purrr_1.0.2              crayon_1.5.3             rlang_1.1.5              cowplot_1.1.3            KEGGREST_1.46.0        

Indicate whether BiocManager::valid() returns TRUE.

  • [+] BiocManager::valid() is TRUE

Is the package installed via bioconda?

No, Biocmanager

DaydreamingElephant avatar Jan 27 '25 22:01 DaydreamingElephant

Hi,

I couldn't reproduce your issue using the latest version of spatialLIBD:

devel* > sce_layer <- spatialLIBD::fetch_data(type = "spatialDLPFC_Visium_pseudobulk")
snapshotDate(): 2024-10-24
adding rname 'https://www.dropbox.com/s/pbti4strsfk1m55/sce_pseudo_BayesSpace_k09.rds?dl=1'
  |===========================================================================================| 100%
  |===========================================================================================| 100%

2025-02-28 16:43:46.719131 loading file /Users/leocollado/Library/Caches/org.R-project.R/R/BiocFileCache/9c5c633345f2_sce_pseudo_BayesSpace_k09.rds%3Fdl%3D1
devel* > sce_layer
class: SpatialExperiment 
dim: 12225 268 
metadata(1): PCA_var_explained
assays(2): counts logcounts
rownames(12225): ENSG00000237491 ENSG00000228794 ... ENSG00000198727 ENSG00000278817
rowData names(7): source type ... gene_type gene_search
colnames(268): Br2720_ant_Sp09D01 Br2720_mid_Sp09D01 ... Br8667_mid_Sp09D09
  Br8667_post_Sp09D09
colData names(9): age BayesSpace ... subject BayesSpace_colors
reducedDimNames(3): PCA MDS runPCA
mainExpName: NULL
altExpNames(0):
spatialCoords names(0) :
imgData names(1): sample_id
devel > packageVersion("spatialLIBD")
[1] ‘1.19.8’

Do you still see this issue with the latest version if you install it with BiocManager::install("LieberInstitute/spatialLIBD")?

Best, Leo

lcolladotor avatar Feb 28 '25 21:02 lcolladotor

Closed after we didn't get any more details from the OP for 5 months.

lcolladotor avatar May 21 '25 14:05 lcolladotor