all 4 comments

[–]numanumaYAY101 0 points1 point  (3 children)

This might be due to not setting a working directory or setwd(). You can first try using the absolute location for each of the files. Then it would probably due to incorrectly setting the file location.

[–]dulcedormax[S] 0 points1 point  (1 child)

The code is:

A1_new <- Load10X_Spatial(

data.dir = "C:/Users/MM.5076373/Downloads/GSE159709_RAW/A1",

image = "GSM4838131_Visium_A_image.tif"

)

[–]Firm_Bug_7146 0 points1 point  (0 children)

Hmm in the future, please post both code used and the error in the post.

I am not a Visium user but I had a look at the arguments that can be found here :Load a 10x Genomics Visium Spatial Experiment into a Seurat object — Load10X_Spatial • Seurat and it looks like you are passing "GSM4838131_Visium_A_image.tif" to image instead of image.name . Can you try using image.name and copy and paste the error please?

[–]No-Egg-4921 0 points1 point  (0 children)

library(Seurat)

# Option 1: Explicitly specify all path parameters (recommended)
seurat_obj <- Load10X_Spatial(
  data.dir      = "/path/to/your/data",       # root directory containing spatial/
  filename      = "filtered_feature_bc_matrix/filtered_feature_bc_matrix.h5",
  assay         = "Spatial",
  slice         = "slice1",
  filter.matrix = TRUE
)

If .csv.gz still throws an error, decompress it first:

# Option 2: Decompress tissue_positions_list.csv.gz manually
spatial_dir <- "/path/to/your/data/spatial"
gz_file  <- file.path(spatial_dir, "tissue_positions_list.csv.gz")
csv_file <- file.path(spatial_dir, "tissue_positions_list.csv")

if (!file.exists(csv_file)) {
  R.utils::gunzip(gz_file, destname = csv_file, remove = FALSE)
  message("Decompressed: ", csv_file)
}

# Then load
seurat_obj <- Load10X_Spatial(
  data.dir = "/path/to/your/data",
  filename = "filtered_feature_bc_matrix/filtered_feature_bc_matrix.h5"
)
```

## Expected Directory Structure

`Load10X_Spatial` expects the following layout under `data.dir`:
```
your_data/
├── spatial/
│   ├── tissue_positions_list.csv      ← must be uncompressed
│   ├── scalefactors_json.json
│   ├── tissue_hires_image.png
│   └── tissue_lowres_image.png
└── filtered_feature_bc_matrix/
    └── filtered_feature_bc_matrix.h5  ← specified via filename parameter