satijalab / seurat

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

Error when reading spatial data #6338

Closed potterae closed 2 years ago

potterae commented 2 years ago

Hi, I am trying to load a 10X example spatial dataset into Seurat. Unfortunately, when I try to load the image data it displays the following error: Error in file(file, "rt") : cannot open the connection When I try to use the Load10X_Spatial function it loads the h5 file but not the spatial image data, it returns the same error displayed for the Read10X_Image. The directory appears to be correct: using the list.files function in R all the files that should be there are present. Do you have any insight on what could be causing this error? Thanks

Andrew

Loading image:

dir <- "visium/spatial/" list.files(path = dir) [1] "aligned_fiducials.jpg" "aligned_tissue_image.jpg" [3] "cytassist_image.tiff" "detected_tissue_image.jpg" [5] "scalefactors_json.json" "spatial_enrichment.csv"
[7] "tissue_hires_image.png" "tissue_lowres_image.png"
[9] "tissue_positions.csv"
brain.img <- Read10X_Image(dir) Error in file(file, "rt") : cannot open the connection

Loading Spatial dataset: dir <- "visium/" list.files(path = dir) [1] "analysis" "CytAssist_FFPE_Mouse_Brain_Rep1_cloupe.cloupe"
[3] "CytAssist_FFPE_Mouse_Brain_Rep1_metrics_summary.csv" "CytAssist_FFPE_Mouse_Brain_Rep1_raw_feature_bc_matrix.h5" [5] "CytAssist_FFPE_Mouse_Brain_Rep1_web_summary.html" "spatial"
brain.seurat <- Load10X_Spatial(dir, filename = 'CytAssist_FFPE_Mouse_Brain_Rep1_raw_feature_bcmatrix.h5', assay = 'Spatial') Warning: Feature names cannot have underscores (''), replacing with dashes ('-') Error in file(file, "rt") : cannot open the connection

Operating System: Windows 11

dataset link: https://www.10xgenomics.com/resources/datasets/mouse-brain-coronal-section-1-ffpe-2-standard SessionInfo: R version 4.2.0 (2022-04-22 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 22000)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8 [4] LC_NUMERIC=C LC_TIME=English_United States.utf8

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

other attached packages: [1] png_0.1-7 ComplexHeatmap_2.12.0 CellChat_1.4.0 Biobase_2.56.0 BiocGenerics_0.42.0 igraph_1.3.4
[7] data.table_1.14.2 cowplot_1.1.1 gridExtra_2.3 writexl_1.4.0 patchwork_1.1.1 hdf5r_1.3.5
[13] forcats_0.5.1 stringr_1.4.0 dplyr_1.0.9 purrr_0.3.4 readr_2.1.2 tidyr_1.2.0
[19] tibble_3.1.8 ggplot2_3.3.6 tidyverse_1.3.2 sp_1.5-0 SeuratObject_4.1.0 Seurat_4.1.1

loaded via a namespace (and not attached): [1] utf8_1.2.2 reticulate_1.25 tidyselect_1.1.2 htmlwidgets_1.5.4 Rtsne_0.16 munsell_0.5.0
[7] codetools_0.2-18 ica_1.0-3 future_1.27.0 miniUI_0.1.1.1 withr_2.5.0 spatstat.random_2.2-0 [13] colorspace_2.0-3 progressr_0.10.1 ggalluvial_0.12.3 rstudioapi_0.13 stats4_4.2.0 ROCR_1.0-11
[19] tensor_1.5 listenv_0.8.0 NMF_0.24.0 labeling_0.4.2 polyclip_1.10-0 bit64_4.0.5
[25] farver_2.1.1 coda_0.19-4 parallelly_1.32.1 vctrs_0.4.1 generics_0.1.3 R6_2.5.1
[31] doParallel_1.0.17 clue_0.3-61 spatstat.utils_2.3-1 assertthat_0.2.1 promises_1.2.0.1 scales_1.2.0
[37] googlesheets4_1.0.0 rgeos_0.5-9 gtable_0.3.0 globals_0.16.0 goftest_1.2-3 rlang_1.0.4
[43] systemfonts_1.0.4 GlobalOptions_0.1.2 splines_4.2.0 lazyeval_0.2.2 gargle_1.2.0 spatstat.geom_2.4-0
[49] broom_1.0.0 reshape2_1.4.4 abind_1.4-5 modelr_0.1.8 backports_1.4.1 httpuv_1.6.5
[55] tools_4.2.0 gridBase_0.4-7 statnet.common_4.6.0 ellipsis_0.3.2 spatstat.core_2.4-4 RColorBrewer_1.1-3
[61] ggridges_0.5.3 Rcpp_1.0.9 plyr_1.8.7 rpart_4.1.16 deldir_1.0-6 pbapply_1.5-0
[67] GetoptLong_1.0.5 S4Vectors_0.34.0 zoo_1.8-10 haven_2.5.0 ggrepel_0.9.1 cluster_2.1.3
[73] fs_1.5.2 magrittr_2.0.3 RSpectra_0.16-1 sna_2.7 scattermore_0.8 circlize_0.4.15
[79] lmtest_0.9-40 reprex_2.0.1 RANN_2.6.1 googledrive_2.0.0 fitdistrplus_1.1-8 matrixStats_0.62.0
[85] hms_1.1.1 mime_0.12 xtable_1.8-4 readxl_1.4.0 IRanges_2.30.0 shape_1.4.6
[91] compiler_4.2.0 KernSmooth_2.23-20 crayon_1.5.1 htmltools_0.5.3 mgcv_1.8-40 later_1.3.0
[97] tzdb_0.3.0 lubridate_1.8.0 DBI_1.1.3 dbplyr_2.2.1 MASS_7.3-56 Matrix_1.4-1
[103] cli_3.3.0 parallel_4.2.0 pkgconfig_2.0.3 registry_0.5-1 plotly_4.10.0 spatstat.sparse_2.1-1 [109] xml2_1.3.3 foreach_1.5.2 svglite_2.1.0 rngtools_1.5.2 pkgmaker_0.32.2 rvest_1.0.2
[115] digest_0.6.29 sctransform_0.3.3 RcppAnnoy_0.0.19 spatstat.data_2.2-0 cellranger_1.1.0 leiden_0.4.2
[121] uwot_0.1.11 shiny_1.7.2 rjson_0.2.21 lifecycle_1.0.1 nlme_3.1-157 jsonlite_1.8.0
[127] network_1.17.2 viridisLite_0.4.0 fansi_1.0.3 pillar_1.8.0 lattice_0.20-45 fastmap_1.1.0
[133] httr_1.4.3 survival_3.3-1 glue_1.6.2 FNN_1.1.3.1 iterators_1.0.14 bit_4.0.4
[139] stringi_1.7.8 irlba_2.3.5 future.apply_1.9.0

potterae commented 2 years ago

I fixed this, it was becuase SpaceRanger apparently used a new name for one of the files, "tissue_positions_list.csv" was renamed to "tissue_positions.csv" so I changed the name. Thanks