drieslab / Giotto

Spatial omics analysis toolbox
https://drieslab.github.io/Giotto_website/
Other
256 stars 98 forks source link

.h5Seurat fileError in function readPNG(image_path): Unable to open file at path D/giotto/photo/image_rz1.png. #976

Closed worthing1016 closed 3 weeks ago

worthing1016 commented 2 months ago

Describe the Error

Error in function readPNG(image_path): Unable to open file at path D/giotto/photo/image_rz1.png.

Error Message

h5Seurat_files <- list.files(path = "D:/giotto", pattern = "\.h5Seurat$", full.names = TRUE) png_files <- list.files(path = "D:/giotto/photo", pattern = "\.png$", full.names = TRUE)

rhizomes <- list() rhiGiottoObj <- list() for(sfile in list.files()) {

  • if (!length(grep("h5Seurat", sfile)) == 0) {
  • sname <- strsplit(sfile, "\.")[[1]][1]
  • rhizomes[[sname]] <- LoadH5Seurat(sfile)
  • locations <- rhizomes[[sname]]@meta.data[, c('row', 'col')]
  • colnames(locations) <- c('x', 'y')
  • imagepath <- paste0("D/giotto/photo/image", sname, ".png")
  • image <- readPNG(image_path)
  • rhizomes[[sname]][['image']] <- new(Class = 'SlideSeq', assay = "SCT",
  • coordinates = locations,
  • spatial_image = image)
  • rhiGiottoObj[[sname]] <- seuratToGiottoV5(sobject = rhizomes[[sname]], spatial_assay = "SCT")
  • }
  • } Validating h5Seurat file Warning: Cannot find assay Spatial in the H5Seurat file Initializing SCT with data Adding counts for SCT Adding feature-level metadata for SCT Adding miscellaneous information for SCT Adding reduction HARMONY_PCA Adding cell embeddings for HARMONY_PCA Adding miscellaneous information for HARMONY_PCA Adding reduction PCA Adding cell embeddings for PCA Adding miscellaneous information for PCA Adding reduction UMAP.HARMONY Adding cell embeddings for UMAP.HARMONY Adding miscellaneous information for UMAP.HARMONY Adding reduction UMAP.UNINTEGRATED Adding cell embeddings for UMAP.UNINTEGRATED Adding miscellaneous information for UMAP.UNINTEGRATED Adding command information Adding cell-level metadata Adding miscellaneous information Adding tool-specific results Adding data that was not associated with an assay Error in function readPNG(image_path): Unable to open file at path D/giotto/photo/image_rz1.png.

</details>

**To Reproduce**

Steps to reproduce the behavior, i.e.:
1. Following tutorial file '...'
2. Download data '...'
3. Run function(s) '...'
4. See error 

**Expected behavior**

A clear and concise description of what you expected to happen.

**Screenshots**

If applicable, add screenshots to help explain your problem.
NOTE: Screenshots of the attempted function call and full error message(s) are helpful for troubleshooting!

**System Information**

<!-- R version can be found by running `R.version` in R -->
<!-- Giotto version can be found by running `packageVersion("Giotto")` in R -->

    - R4.4.1
    - Giotto

**Additional context**

How to import spatial transcriptomics data and spatiotemporal slice data from BGI (Beijing Genomics Institute, often referred to as "华大" in Chinese) into Giotto?

The is my data structure:.rpi, .png are my image input format,.h5Seurat is my file input format
josschavezf commented 3 weeks ago

@worthing1016 seems like you have a typo in the image path:

imagepath <- paste0("D/giotto/photo/image", sname, ".png")

It should be: imagepath <- paste0("D:/giotto/photo/image", sname, ".png")