Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compatibility with spaceranger 2.0 #6208

Merged

Conversation

stephenwilliams22
Copy link
Contributor

@stephenwilliams22 stephenwilliams22 commented Jul 18, 2022

This PR updates seurat to accommodate the latest changes made in spaceranger 2.0 which will break the released version of seurat. Will provide backwards compatibility to pre 2.0 releases.

Note

Thanks for your interest in contributing! Please make your PR to the develop branch. You can check out our wiki for the current developers guide.

@mojaveazure mojaveazure merged commit 9bb1fa7 into satijalab:develop Jul 19, 2022
@mojaveazure
Copy link
Member

Thanks for the PR, Stephen!

@stephenwilliams22
Copy link
Contributor Author

Thanks for the PR, Stephen!

You're welcome!

@stephenwilliams22
Copy link
Contributor Author

@mojaveazure do you have an approximate timeline as to when this fix will be available on the CRAN version of Seurat?

@mojaveazure
Copy link
Member

Hi Stephen, sorry for the delay. We just submitted this to CRAN as part of Seurat v4.2.0; hopefully it'll be accepted quickly

@stephenwilliams22
Copy link
Contributor Author

stephenwilliams22 commented Sep 22, 2022 via email

@shieldartin
Copy link

This is a fair way out of my comfort/skill range (apologies if not the right place to ask): I had a script working well for SpaceRanger1.0 data but since the update it's broken at the Load10X_Spatial step

data.dir = paste0(`sample_folder`,"/outs") #location of the folder with the SpaceRanger outputs

visium_data1 <- Load10X_Spatial(data.dir,
  filename = "filtered_feature_bc_matrix.h5",
                assay = "Spatial",
                slice = "slice1",
                filter.matrix = TRUE,
                to.upper = FALSE,
                image = NULL,)

It's throwing the same error due to the tissue_positions.csv naming issue. I've had a look at the Read10X_Image fix for spaceranger 2.0 and I think I understand what was done, but I cannot work out how to do the same fix for Load10X_Spatial or how to integrate them together. Is anyone able to help?

@stephenwilliams22
Copy link
Contributor Author

This is a fair way out of my comfort/skill range (apologies if not the right place to ask): I had a script working well for SpaceRanger1.0 data but since the update it's broken at the Load10X_Spatial step

data.dir = paste0(`sample_folder`,"/outs") #location of the folder with the SpaceRanger outputs

visium_data1 <- Load10X_Spatial(data.dir,
  filename = "filtered_feature_bc_matrix.h5",
                assay = "Spatial",
                slice = "slice1",
                filter.matrix = TRUE,
                to.upper = FALSE,
                image = NULL,)

It's throwing the same error due to the tissue_positions.csv naming issue. I've had a look at the Read10X_Image fix for spaceranger 2.0 and I think I understand what was done, but I cannot work out how to do the same fix for Load10X_Spatial or how to integrate them together. Is anyone able to help?

@shieldartin what exactly is the error?

@shieldartin
Copy link

shieldartin commented Oct 27, 2022

Sorry, this is the error

Warning in file(file, "rt") :
  cannot open file '/Volumes/Microscopy_Data_lab_scott/shieldartin.k/Visium/C213_Kristy_Shield-Artin_Claire_Scott/SpaceRanger/V10N16-054/C213_SFRC01057-A5/outs/spatial/tissue_positions_list.csv': No such file or directory
Error in file(file, "rt") : cannot open the connection

I can manually change the file name to get it to load, but i think the headers then cause an issue with 'SpatialFeaturePlot'

SpatialFeaturePlot(visium_data1, features = "nCount_Spatial") + theme(legend.position = "right")
Error in FUN(left, right) : non-numeric argument to binary operator

@stephenwilliams22
Copy link
Contributor Author

stephenwilliams22 commented Oct 27, 2022

@shieldartin what version of spaceranger are you running for this sample? Can you please run ls /Volumes/Microscopy_Data_lab_scott/shieldartin.k/Visium/C213_Kristy_Shield-Artin_Claire_Scott/SpaceRanger/V10N16-054/C213_SFRC01057-A5/outs/spatial/ and post the results?

Also what version of Seurat are you running?

@shieldartin
Copy link

Results:
aligned_fiducials.jpg tissue_hires_image.png
detected_tissue_image.jpg tissue_lowres_image.png
scalefactors_json.json tissue_positions.csv
spatial_enrichment.csv

I didn't run the SpaceRanger process, but was told it was the new version that came out this year (and the file name changes are consistent).
I'm running Seurat v 4.2.0

@stephenwilliams22
Copy link
Contributor Author

Results: aligned_fiducials.jpg tissue_hires_image.png detected_tissue_image.jpg tissue_lowres_image.png scalefactors_json.json tissue_positions.csv spatial_enrichment.csv

I didn't run the SpaceRanger process, but was told it was the new version that came out this year (and the file name changes are consistent). I'm running Seurat v 4.2.0

@shieldartin can you please run

head tissue_positions.csv

restart R and run the following code?

library("Seurat")
packageVersion("Seurat")

@shieldartin
Copy link

library("Seurat")
Attaching SeuratObject
Attaching sp
> packageVersion("Seurat")
[1] ‘4.2.0’
> 

Okay, so it seems that the restart of R has fixed the issue. Many thanks for the support.

@stephenwilliams22
Copy link
Contributor Author

@shieldartin glad it's fixed!

@yuzhouf
Copy link

yuzhouf commented Oct 28, 2022

Sorry, this is the error

Warning in file(file, "rt") :
  cannot open file '/Volumes/Microscopy_Data_lab_scott/shieldartin.k/Visium/C213_Kristy_Shield-Artin_Claire_Scott/SpaceRanger/V10N16-054/C213_SFRC01057-A5/outs/spatial/tissue_positions_list.csv': No such file or directory
Error in file(file, "rt") : cannot open the connection

I can manually change the file name to get it to load, but i think the headers then cause an issue with 'SpatialFeaturePlot'

SpatialFeaturePlot(visium_data1, features = "nCount_Spatial") + theme(legend.position = "right")
Error in FUN(left, right) : non-numeric argument to binary operator

Step1: You can change the file name "tissue_positions.csv" to "tissue_positions_list.csv". Step2: Remove the first line of tissue_positions_list.csv (barcode,in_tissue,array_row,array_col,pxl_row_in_fullres,pxl_col_in_fullres). After these 2 steps, It works.

@shieldartin
Copy link

Sorry, this is the error

Warning in file(file, "rt") :
  cannot open file '/Volumes/Microscopy_Data_lab_scott/shieldartin.k/Visium/C213_Kristy_Shield-Artin_Claire_Scott/SpaceRanger/V10N16-054/C213_SFRC01057-A5/outs/spatial/tissue_positions_list.csv': No such file or directory
Error in file(file, "rt") : cannot open the connection

I can manually change the file name to get it to load, but i think the headers then cause an issue with 'SpatialFeaturePlot'

SpatialFeaturePlot(visium_data1, features = "nCount_Spatial") + theme(legend.position = "right")
Error in FUN(left, right) : non-numeric argument to binary operator

Step1: You can change the file name "tissue_positions.csv" to "tissue_positions_list.csv". Step2: Remove the first line of tissue_positions_list.csv (barcode,in_tissue,array_row,array_col,pxl_row_in_fullres,pxl_col_in_fullres). After these 2 steps, It works.

Thanks @yuzhouf
I was aiming to avoid manually changing any files and it appears that when I properly installed/loaded Seurat version 4.2.0 (and fixed a wonky network connection to where the data was stored) the issue seems to have resolved and the code will now work with data generated from Spaceranger 1.0 or 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants