satijalab / seurat

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

Error with loading Vizgen mouse brain data from spatial vignette #9089

Open mabbasi6 opened 4 months ago

mabbasi6 commented 4 months ago

Hi! I have an issue with loading the public dataset from Vizgen that is used in this vignette. To give you a view of what the data structure looks like: image Here is the data structure in the cell_boundaries folder: image Here is the error I get when I run the code to load the data: image

Thank you in advance for your help with this issue!

Originally posted by @mabbasi6 in https://github.com/satijalab/seurat/issues/6854#issuecomment-2211404250

alikhuseynov commented 4 months ago

which Seurat and SeuratObject versions are you using? see this :

LitingKu commented 1 month ago

I also encounter the same issue running the vignette.

The files I used is the same

(base) LH3W0CD9W3:~ lku$ ls /Users/lku/Desktop/CCI2/vizgen/s2r1/
cell_boundaries                 cell_by_gene.csv                cell_metadata.csv               detected_transcripts.csv
(base) LH3W0CD9W3:~ lku$ ls /Users/lku/Desktop/CCI2/vizgen/s2r1/cell_boundaries 
feature_data_0.hdf5     feature_data_1007.hdf5  feature_data_1015.hdf5  feature_data_1028.hdf5  feature_data_1036.hdf5  feature_data_1044.hdf5
feature_data_100.hdf5   feature_data_1008.hdf5  feature_data_1016.hdf5  feature_data_1029.hdf5  feature_data_1037.hdf5  feature_data_1045.hdf5
feature_data_1000.hdf5  feature_data_1009.hdf5  feature_data_102.hdf5   feature_data_103.hdf5   feature_data_1038.hdf5  feature_data_1046.hdf5
feature_data_1001.hdf5  feature_data_101.hdf5   feature_data_1022.hdf5  feature_data_1030.hdf5  feature_data_1039.hdf5  feature_data_1047.hdf5
feature_data_1002.hdf5  feature_data_1010.hdf5  feature_data_1023.hdf5  feature_data_1031.hdf5  feature_data_104.hdf5   feature_data_1048.hdf5
feature_data_1003.hdf5  feature_data_1011.hdf5  feature_data_1024.hdf5  feature_data_1032.hdf5  feature_data_1040.hdf5
feature_data_1004.hdf5  feature_data_1012.hdf5  feature_data_1025.hdf5  feature_data_1033.hdf5  feature_data_1041.hdf5
feature_data_1005.hdf5  feature_data_1013.hdf5  feature_data_1026.hdf5  feature_data_1034.hdf5  feature_data_1042.hdf5
feature_data_1006.hdf5  feature_data_1014.hdf5  feature_data_1027.hdf5  feature_data_1035.hdf5  feature_data_1043.hdf5

but when using Seurat Version 5.1.0 and SeuratObject Version 5.0.2 and run

vizgen.obj <- LoadVizgen(data.dir = "/Users/lku/Desktop/CCI2/vizgen/s2r1/", fov = "s2r1")

it also output:

> vizgen.obj <- LoadVizgen(data.dir = "/Users/lku/Desktop/CCI2/vizgen/s2r1/", fov = "s2r1")
|--------------------------------------------------|
|==================================================|
Warning in ReadVizgen(data.dir = data.dir, filter = "^Blank-", type = c("centroids",  :
  83546 cells missing polygon information
Error in UseMethod(generic = "CreateSegmentation", object = coords) : 
  no applicable method for 'CreateSegmentation' applied to an object of class "NULL"
In addition: There were 50 or more warnings (use warnings() to see the first 50)

Wondering is there any solution for this? I have checked previous issues #7080 , but still cannot find the solution.

I have also tried the code in #7080

obj <-
  LoadVizgen(data.dir = dir_use,  
             fov = "merfish.test", 
             assay = "Vizgen",
             metadata = c("volume", "fov"), # add cell volume info
             type = c("segmentations", "centroids"), # type of cell spatial coord matrices
             z = 3L,
             add.zIndex = TRUE, # add z slice section to a cell
             update.object = TRUE,
             use.BiocParallel = TRUE,
             workers.MulticoreParam = 14, # for `BiocParallel` processing
             verbose = TRUE
             )

but it output the error of:

Error in LoadVizgen(data.dir = dir_use, fov = "merfish.test", assay = "Vizgen",  : 
  unused arguments (metadata = c("volume", "fov"), type = c("segmentations", "centroids"), add.zIndex = TRUE, update.object = TRUE, use.BiocParallel = TRUE, workers.MulticoreParam = 14, min.area = 5, add.molecules = TRUE, verbose = TRUE)
alikhuseynov commented 1 month ago

I also encounter the same issue running the vignette.

The files I used is the same

(base) LH3W0CD9W3:~ lku$ ls /Users/lku/Desktop/CCI2/vizgen/s2r1/
cell_boundaries                 cell_by_gene.csv                cell_metadata.csv               detected_transcripts.csv
(base) LH3W0CD9W3:~ lku$ ls /Users/lku/Desktop/CCI2/vizgen/s2r1/cell_boundaries 
feature_data_0.hdf5     feature_data_1007.hdf5  feature_data_1015.hdf5  feature_data_1028.hdf5  feature_data_1036.hdf5  feature_data_1044.hdf5
feature_data_100.hdf5   feature_data_1008.hdf5  feature_data_1016.hdf5  feature_data_1029.hdf5  feature_data_1037.hdf5  feature_data_1045.hdf5
feature_data_1000.hdf5  feature_data_1009.hdf5  feature_data_102.hdf5   feature_data_103.hdf5   feature_data_1038.hdf5  feature_data_1046.hdf5
feature_data_1001.hdf5  feature_data_101.hdf5   feature_data_1022.hdf5  feature_data_1030.hdf5  feature_data_1039.hdf5  feature_data_1047.hdf5
feature_data_1002.hdf5  feature_data_1010.hdf5  feature_data_1023.hdf5  feature_data_1031.hdf5  feature_data_104.hdf5   feature_data_1048.hdf5
feature_data_1003.hdf5  feature_data_1011.hdf5  feature_data_1024.hdf5  feature_data_1032.hdf5  feature_data_1040.hdf5
feature_data_1004.hdf5  feature_data_1012.hdf5  feature_data_1025.hdf5  feature_data_1033.hdf5  feature_data_1041.hdf5
feature_data_1005.hdf5  feature_data_1013.hdf5  feature_data_1026.hdf5  feature_data_1034.hdf5  feature_data_1042.hdf5
feature_data_1006.hdf5  feature_data_1014.hdf5  feature_data_1027.hdf5  feature_data_1035.hdf5  feature_data_1043.hdf5

but when using Seurat Version 5.1.0 and SeuratObject Version 5.0.2 and run

vizgen.obj <- LoadVizgen(data.dir = "/Users/lku/Desktop/CCI2/vizgen/s2r1/", fov = "s2r1")

it also output:

> vizgen.obj <- LoadVizgen(data.dir = "/Users/lku/Desktop/CCI2/vizgen/s2r1/", fov = "s2r1")
|--------------------------------------------------|
|==================================================|
Warning in ReadVizgen(data.dir = data.dir, filter = "^Blank-", type = c("centroids",  :
  83546 cells missing polygon information
Error in UseMethod(generic = "CreateSegmentation", object = coords) : 
  no applicable method for 'CreateSegmentation' applied to an object of class "NULL"
In addition: There were 50 or more warnings (use warnings() to see the first 50)

Wondering is there any solution for this? I have checked previous issues #7080 , but still cannot find the solution.

I have also tried the code in #7080

obj <-
  LoadVizgen(data.dir = dir_use,  
             fov = "merfish.test", 
             assay = "Vizgen",
             metadata = c("volume", "fov"), # add cell volume info
             type = c("segmentations", "centroids"), # type of cell spatial coord matrices
             z = 3L,
             add.zIndex = TRUE, # add z slice section to a cell
             update.object = TRUE,
             use.BiocParallel = TRUE,
             workers.MulticoreParam = 14, # for `BiocParallel` processing
             verbose = TRUE
             )

but it output the error of:

Error in LoadVizgen(data.dir = dir_use, fov = "merfish.test", assay = "Vizgen",  : 
  unused arguments (metadata = c("volume", "fov"), type = c("segmentations", "centroids"), add.zIndex = TRUE, update.object = TRUE, use.BiocParallel = TRUE, workers.MulticoreParam = 14, min.area = 5, add.molecules = TRUE, verbose = TRUE)

To use that PR you need to install it firstremotes::install_github(repo = 'alikhuseynov/seurat', ref = 'vizgen_seurat5')

But I'm not sure if that fixes reading .hdf5 files, that data format is old, Vizgen is using .parquet now.

LitingKu commented 1 month ago

I also encounter the same issue running the vignette. The files I used is the same

(base) LH3W0CD9W3:~ lku$ ls /Users/lku/Desktop/CCI2/vizgen/s2r1/
cell_boundaries                 cell_by_gene.csv                cell_metadata.csv               detected_transcripts.csv
(base) LH3W0CD9W3:~ lku$ ls /Users/lku/Desktop/CCI2/vizgen/s2r1/cell_boundaries 
feature_data_0.hdf5     feature_data_1007.hdf5  feature_data_1015.hdf5  feature_data_1028.hdf5  feature_data_1036.hdf5  feature_data_1044.hdf5
feature_data_100.hdf5   feature_data_1008.hdf5  feature_data_1016.hdf5  feature_data_1029.hdf5  feature_data_1037.hdf5  feature_data_1045.hdf5
feature_data_1000.hdf5  feature_data_1009.hdf5  feature_data_102.hdf5   feature_data_103.hdf5   feature_data_1038.hdf5  feature_data_1046.hdf5
feature_data_1001.hdf5  feature_data_101.hdf5   feature_data_1022.hdf5  feature_data_1030.hdf5  feature_data_1039.hdf5  feature_data_1047.hdf5
feature_data_1002.hdf5  feature_data_1010.hdf5  feature_data_1023.hdf5  feature_data_1031.hdf5  feature_data_104.hdf5   feature_data_1048.hdf5
feature_data_1003.hdf5  feature_data_1011.hdf5  feature_data_1024.hdf5  feature_data_1032.hdf5  feature_data_1040.hdf5
feature_data_1004.hdf5  feature_data_1012.hdf5  feature_data_1025.hdf5  feature_data_1033.hdf5  feature_data_1041.hdf5
feature_data_1005.hdf5  feature_data_1013.hdf5  feature_data_1026.hdf5  feature_data_1034.hdf5  feature_data_1042.hdf5
feature_data_1006.hdf5  feature_data_1014.hdf5  feature_data_1027.hdf5  feature_data_1035.hdf5  feature_data_1043.hdf5

but when using Seurat Version 5.1.0 and SeuratObject Version 5.0.2 and run

vizgen.obj <- LoadVizgen(data.dir = "/Users/lku/Desktop/CCI2/vizgen/s2r1/", fov = "s2r1")

it also output:

> vizgen.obj <- LoadVizgen(data.dir = "/Users/lku/Desktop/CCI2/vizgen/s2r1/", fov = "s2r1")
|--------------------------------------------------|
|==================================================|
Warning in ReadVizgen(data.dir = data.dir, filter = "^Blank-", type = c("centroids",  :
  83546 cells missing polygon information
Error in UseMethod(generic = "CreateSegmentation", object = coords) : 
  no applicable method for 'CreateSegmentation' applied to an object of class "NULL"
In addition: There were 50 or more warnings (use warnings() to see the first 50)

Wondering is there any solution for this? I have checked previous issues #7080 , but still cannot find the solution. I have also tried the code in #7080

obj <-
  LoadVizgen(data.dir = dir_use,  
             fov = "merfish.test", 
             assay = "Vizgen",
             metadata = c("volume", "fov"), # add cell volume info
             type = c("segmentations", "centroids"), # type of cell spatial coord matrices
             z = 3L,
             add.zIndex = TRUE, # add z slice section to a cell
             update.object = TRUE,
             use.BiocParallel = TRUE,
             workers.MulticoreParam = 14, # for `BiocParallel` processing
             verbose = TRUE
             )

but it output the error of:

Error in LoadVizgen(data.dir = dir_use, fov = "merfish.test", assay = "Vizgen",  : 
  unused arguments (metadata = c("volume", "fov"), type = c("segmentations", "centroids"), add.zIndex = TRUE, update.object = TRUE, use.BiocParallel = TRUE, workers.MulticoreParam = 14, min.area = 5, add.molecules = TRUE, verbose = TRUE)

To use that PR you need to install it firstremotes::install_github(repo = 'alikhuseynov/seurat', ref = 'vizgen_seurat5')

But I'm not sure if that fixes reading .hdf5 files, that data format is old, Vizgen is using .parquet now.

Thank you for providing this, But since I don't have .parquet data, I'm using the same data as in the vignette.

I have tried to install

remotes::install_github(repo = 'alikhuseynov/seurat', ref = 'vizgen_seurat5')

But it doesn't fixes reading .hdf5 files.

I'm wondering if there is any way I could use Seurat to read the .hdf5 files of the Vizgen data?