satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.26k stars 905 forks source link

LoadXenium : Error in `.local()`: ! NA values in coordinates #9069

Open savarycl opened 3 months ago

savarycl commented 3 months ago

Hello everyone,

I want to import Xenium data using the LoadXenium function of the Seurat R library (v.5.1.0).

I run the following command line:

 xenium_obj <- LoadXenium(data.dir = "/Users/xenium_data/raw/output-file", fov = "fov")

The function works on my local computer and on all samples (8/8), but when I run the same script on a remote HPC, I encounter the following error on 2/8 samples:

Error in `.local()`:
! NA values in coordinates
Backtrace:
  1. SeuratObject::CreateSegmentation(data_xe$segmentations)
  2. SeuratObject:::CreateSegmentation.data.frame(data_xe$segmentations)
  3. base::sapply(...)
  4. base::lapply(X = X, FUN = FUN, ...)
  5. SeuratObject (local) FUN(X[[i]], ...)
  8. sp::Polygon(coords = cx)
 10. sp::coordinates(coords)
 11. sp (local) .local(obj, ...)

When I separated the different steps of the function:

data_xe <- ReadXenium(data.dir = dir_path[[5]], type = c("centroids", "segmentations")) # working

segmentations.data <- list(
     centroids = CreateCentroids(data_xe$centroids), 
     segmentation = CreateSegmentation(data_xe$segmentations)
) # not working

Error in `.local()`:
! NA values in coordinates
Backtrace:
  1. SeuratObject::CreateSegmentation(data_xe$segmentations)
  2. SeuratObject:::CreateSegmentation.data.frame(data_xe$segmentations)
  3. base::sapply(...)
  4. base::lapply(X = X, FUN = FUN, ...)
  5. SeuratObject (local) FUN(X[[i]], ...)
  8. sp::Polygon(coords = cx)
 10. sp::coordinates(coords)
 11. sp (local) .local(obj, ...)

I did not find any NA in the segmentations data of the data_xe object.

How can I solve this issue?

Many thanks in advance.

Session info [HPC] | Not working:

R version 4.4.1 (2024-06-14)
Platform: x86_64-conda-linux-gnu
Running under: Rocky Linux 8.9 (Green Obsidian)

Matrix products: default
BLAS/LAPACK: /home/userid/tools/miniconda3/envs/env_scMultiome/lib/libopenblasp-r0.3.21.so;  LAPACK version 3.9.0

locale:
 [1] LC_CTYPE=en_AU.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_AU.UTF-8        LC_COLLATE=en_AU.UTF-8    
 [5] LC_MONETARY=en_AU.UTF-8    LC_MESSAGES=en_AU.UTF-8   
 [7] LC_PAPER=en_AU.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C       

time zone: :/etc/localtime
tzcode source: system (glibc)

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

other attached packages:
 [1] DT_0.33            cowplot_1.1.3      ggplot2_3.5.1      glue_1.7.0        
 [5] dplyr_1.1.4        here_1.0.1         harmony_1.2.0      Rcpp_1.0.12       
 [9] Seurat_5.1.0       SeuratObject_5.0.2 sp_2.1-4          

loaded via a namespace (and not attached):
  [1] deldir_2.0-4           pbapply_1.7-2          gridExtra_2.3         
  [4] rlang_1.1.4            magrittr_2.0.3         RcppAnnoy_0.0.22      
  [7] matrixStats_1.3.0      ggridges_0.5.6         compiler_4.4.1        
 [10] spatstat.geom_3.2-9    png_0.1-8              vctrs_0.6.5           
 [13] reshape2_1.4.4         stringr_1.5.1          pkgconfig_2.0.3       
 [16] fastmap_1.2.0          utf8_1.2.4             promises_1.3.0        
 [19] purrr_1.0.2            jsonlite_1.8.8         goftest_1.2-3         
 [22] later_1.3.2            spatstat.utils_3.0-5   irlba_2.3.5.1         
 [25] parallel_4.4.1         cluster_2.1.6          R6_2.5.1              
 [28] ica_1.0-3              stringi_1.8.4          RColorBrewer_1.1-3    
 [31] spatstat.data_3.1-2    reticulate_1.38.0      parallelly_1.37.1     
 [34] lmtest_0.9-40          scattermore_1.2        tensor_1.5            
 [37] future.apply_1.11.2    zoo_1.8-12             sctransform_0.4.1     
 [40] httpuv_1.6.15          Matrix_1.7-0           splines_4.4.1         
 [43] igraph_2.0.3           tidyselect_1.2.1       abind_1.4-5           
 [46] spatstat.random_3.2-3  codetools_0.2-20       miniUI_0.1.1.1        
 [49] spatstat.explore_3.2-7 listenv_0.9.1          lattice_0.22-6        
 [52] tibble_3.2.1           plyr_1.8.9             withr_3.0.0           
 [55] shiny_1.8.1.1          ROCR_1.0-11            Rtsne_0.17            
 [58] future_1.33.2          fastDummies_1.7.3      survival_3.7-0        
 [61] polyclip_1.10-6        fitdistrplus_1.1-11    pillar_1.9.0          
 [64] KernSmooth_2.23-24     plotly_4.10.4          generics_0.1.3        
 [67] rprojroot_2.0.4        RcppHNSW_0.6.0         munsell_0.5.1         
 [70] scales_1.3.0           globals_0.16.3         xtable_1.8-4          
 [73] lazyeval_0.2.2         tools_4.4.1            data.table_1.15.4     
 [76] RSpectra_0.16-1        RANN_2.6.1             leiden_0.4.3.1        
 [79] dotCall64_1.1-1        grid_4.4.1             tidyr_1.3.1           
 [82] colorspace_2.1-0       nlme_3.1-165           patchwork_1.2.0       
 [85] cli_3.6.3              spatstat.sparse_3.1-0  spam_2.10-0           
 [88] fansi_1.0.6            viridisLite_0.4.2      uwot_0.2.2            
 [91] gtable_0.3.5           digest_0.6.36          progressr_0.14.0      
 [94] ggrepel_0.9.5          htmlwidgets_1.6.4      htmltools_0.5.8.1     
 [97] lifecycle_1.0.4        httr_1.4.7             mime_0.12             
[100] MASS_7.3-61

Session info [local] | Working:

R version 4.4.0 (2024-04-24)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.5

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

tzcode source: internal

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

other attached packages:
 [1] DT_0.33            cowplot_1.1.3      ggplot2_3.5.1      glue_1.7.0         dplyr_1.1.4       
 [6] here_1.0.1         harmony_1.2.0      Rcpp_1.0.12        Seurat_5.1.0       SeuratObject_5.0.2
[11] sp_2.1-4          

loaded via a namespace (and not attached):
  [1] RColorBrewer_1.1-3          rstudioapi_0.16.0           jsonlite_1.8.8             
  [4] magrittr_2.0.3              spatstat.utils_3.0-5        rmarkdown_2.27             
  [7] zlibbioc_1.50.0             vctrs_0.6.5                 ROCR_1.0-11                
 [10] DelayedMatrixStats_1.26.0   spatstat.explore_3.2-7      S4Arrays_1.4.1             
 [13] htmltools_0.5.8.1           SparseArray_1.4.8           sass_0.4.9                 
 [16] sctransform_0.4.1           parallelly_1.37.1           KernSmooth_2.23-22         
 [19] bslib_0.7.0                 htmlwidgets_1.6.4           ica_1.0-3                  
 [22] plyr_1.8.9                  plotly_4.10.4               zoo_1.8-12                 
 [25] cachem_1.1.0                igraph_2.0.3                mime_0.12                  
 [28] lifecycle_1.0.4             pkgconfig_2.0.3             Matrix_1.7-0               
 [31] R6_2.5.1                    fastmap_1.2.0               GenomeInfoDbData_1.2.12    
 [34] MatrixGenerics_1.16.0       fitdistrplus_1.1-11         future_1.33.2              
 [37] shiny_1.8.1.1               digest_0.6.36               colorspace_2.1-0           
 [40] S4Vectors_0.42.0            patchwork_1.2.0             rprojroot_2.0.4            
 [43] tensor_1.5                  RSpectra_0.16-1             irlba_2.3.5.1              
 [46] GenomicRanges_1.56.1        crosstalk_1.2.1             progressr_0.14.0           
 [49] fansi_1.0.6                 spatstat.sparse_3.1-0       httr_1.4.7                 
 [52] polyclip_1.10-6             abind_1.4-5                 compiler_4.4.0             
 [55] bit64_4.0.5                 withr_3.0.0                 fastDummies_1.7.3          
 [58] R.utils_2.12.3              MASS_7.3-60.2               DelayedArray_0.30.1        
 [61] tools_4.4.0                 lmtest_0.9-40               httpuv_1.6.15              
 [64] future.apply_1.11.2         goftest_1.2-3               R.oo_1.26.0                
 [67] glmGamPoi_1.16.0            nlme_3.1-164                promises_1.3.0             
 [70] grid_4.4.0                  Rtsne_0.17                  cluster_2.1.6              
 [73] reshape2_1.4.4              generics_0.1.3              gtable_0.3.5               
 [76] spatstat.data_3.1-2         R.methodsS3_1.8.2           tidyr_1.3.1                
 [79] data.table_1.15.4           XVector_0.44.0              utf8_1.2.4                 
 [82] BiocGenerics_0.50.0         spatstat.geom_3.2-9         RcppAnnoy_0.0.22           
 [85] ggrepel_0.9.5               RANN_2.6.1                  pillar_1.9.0               
 [88] stringr_1.5.1               spam_2.10-0                 RcppHNSW_0.6.0             
 [91] later_1.3.2                 splines_4.4.0               lattice_0.22-6             
 [94] survival_3.5-8              bit_4.0.5                   deldir_2.0-4               
 [97] tidyselect_1.2.1            miniUI_0.1.1.1              pbapply_1.7-2              
[100] knitr_1.47                  gridExtra_2.3               IRanges_2.38.0             
[103] SummarizedExperiment_1.34.0 scattermore_1.2             stats4_4.4.0               
[106] xfun_0.45                   Biobase_2.64.0              matrixStats_1.3.0          
[109] UCSC.utils_1.0.0            stringi_1.8.4               lazyeval_0.2.2             
[112] yaml_2.3.8                  evaluate_0.24.0             codetools_0.2-20           
[115] tibble_3.2.1                cli_3.6.3                   uwot_0.2.2                 
[118] xtable_1.8-4                reticulate_1.38.0           munsell_0.5.1              
[121] jquerylib_0.1.4             GenomeInfoDb_1.40.1         globals_0.16.3             
[124] spatstat.random_3.2-3       png_0.1-8                   parallel_4.4.0             
[127] dotCall64_1.1-1             sparseMatrixStats_1.16.0    listenv_0.9.1              
[130] viridisLite_0.4.2           scales_1.3.0                ggridges_0.5.6             
[133] crayon_1.5.3                leiden_0.4.3.1              purrr_1.0.2                
[136] rlang_1.1.4