waldronlab / VisiumIO

Import spaceranger output and 10X spatial data
0 stars 0 forks source link

I am not able to open a visium image #3

Closed alosdiallo closed 1 month ago

alosdiallo commented 3 months ago

Hi I am trying to load some 10x Visium data using TENxVisiumList, but am not able to load the data at all. I have verified that the data is there and in the correct form:

file.exists("/Users/adiallo/Desktop/Thesis/Data_Documents/All_Data/Visium_samples/Visium_Data/data/0_B11-10_A5/outs/filtered_feature_bc_matrix.h5") [1] TRUE file.exists("/Users/adiallo/Desktop/Thesis/Data_Documents/All_Data/Visium_samples/Visium_Data/data/0_B11-10_A5/outs/spatial/tissue_lowres_image.png") [1] TRUE file.exists("/Users/adiallo/Desktop/Thesis/Data_Documents/All_Data/Visium_samples/Visium_Data/data/0_B11-10_A5/outs/spatial/scalefactors_json.json") [1] TRUE

However I just can't seem to get the function to work:

library(SpatialExperiment) library(VisiumIO)

Define the correct path to the 'outs' directory

data_dir <- "/Users/adiallo/Desktop/Thesis/Data_Documents/All_Data/Visium_samples/Visium_Data/data/0_B11-10_A5/outs"

Check if the necessary directories and files exist

if (!dir.exists(data_dir)) {

  • stop("The specified data directory does not exist.")
  • } if (!file.exists(file.path(data_dir, "filtered_feature_bc_matrix.h5"))) {
  • stop("The filtered_feature_bc_matrix.h5 file does not exist.")
  • } if (!file.exists(file.path(data_dir, "spatial/tissue_lowres_image.png"))) {
  • stop("The tissue_lowres_image.png file does not exist.")
  • } if (!file.exists(file.path(data_dir, "spatial/scalefactors_json.json"))) {
  • stop("The scalefactors_json.json file does not exist.")
  • }

Try to load the data

spe <- TENxVisiumList(

  • sample_id = "sample01",
  • sampleFolders = data_dir,
  • spatialCoordsNames = c("x", "y"),
  • imageSources = file.path(data_dir, "spatial/tissue_lowres_image.png"),
  • scaleFactors = file.path(data_dir, "spatial/scalefactors_json.json")
  • ) Error: The 'outs' or 'filtered_feature_bc_matrix' directory was not found. Verify 'spacerangerOut' and 'processing' inputs.

Any advice or help would be greatly appreciated. Thank you!

R version 4.4.1 (2024-06-14) Version 1 of VisiumIO

LiNk-NY commented 3 months ago

Hi @alosdiallo I think you need to use the

/Users/adiallo/Desktop/Thesis/Data_Documents/All_Data/Visium_samples/Visium_Data/data/0_B11-10_A5

folder as input rather than ./outs.

alosdiallo commented 3 months ago

Hi @LiNk-NY I apologize for the delayed response. I will give that a shot. Thank you!

LiNk-NY commented 2 months ago

@alosdiallo Any updates on this?

alosdiallo commented 1 month ago

Hi @LiNk-NY Sorry for the slow response. When I try that I get: Error: The 'outs' or 'filtered_feature_bc_matrix' directory was not found. Verify 'spacerangerOut' and 'processing' inputs.

I was able to solve this using another package though, so please don't make this a big priority.

LiNk-NY commented 1 month ago

Hi Alos, @alosdiallo See our TENxVisiumList example here:

https://github.com/waldronlab/VisiumIO/blob/c8205f1e7d880fd615a6d725d3c464d10460a058/R/TENxVisiumList-class.R#L43-L59

It should work if you are providing a character vector of sample folders, e.g.,

> sample_dirs
[1] "VisiumIO/extdata/10xVisium/section1"
[2] "VisiumIO/extdata/10xVisium/section2"

If you only have one sample, use the TENxVisium constructor function.

Best, Marcel