theMILOlab / SPATA2

A Toolbox for Spatial Transcriptomics Analysis
https://themilolab.github.io/SPATA2/
102 stars 17 forks source link

Error in asSPATA2() #173

Open khpark00 opened 1 month ago

khpark00 commented 1 month ago

I'd like to convert my seurat object a (Seurat V5) into spata2 object, but it fails. Would you help how can I fix this problem? Error in dplyr::rename(): ! Can't rename columns that don't exist. ✖ Column cell doesn't exist. Run rlang::last_trace() to see where the error occurred.

Best,

a An object of class Seurat 36149 features across 3660 samples within 2 assays Active assay: SCT (18064 features, 3000 variable features) 3 layers present: counts, data, scale.data 1 other assay present: Spatial 3 dimensional reductions calculated: pca, umap, harmony 1 image present: S2243709

spata_object1 <- asSPATA2(object = a, sample_name = "test", platform = "VisiumSmall", img_name = names(a@images), img_scale_fct = "lowres", assay_name = "Spatial", assay_modality = "gene" ) 17:28:11 Initiating SPATA2 object of spatial platform: VisiumSmall 17:28:11 Transferring data. 17:28:11 Active assay: 'gene'. 17:28:11 No directory was specified to store the image. Unloading won't be possible. Set with setImageDir(). Error in dplyr::rename(): ! Can't rename columns that don't exist. ✖ Column cell doesn't exist. Run rlang::last_trace() to see where the error occurred.

simonmfr commented 1 month ago

Hi @khpark00, thanks for reporting. If you could provide the traceback, that would be helpful (rlang::last_trace()).

khpark00 commented 1 month ago

Thank you for your consideration. Here's last_trace()

rlang::last_trace() <error/vctrs_error_subscript_oob> Error in dplyr::rename(): ! Can't rename columns that don't exist. ✖ Column cell doesn't exist.

Backtrace: ▆

  1. ├─SPATA2::asSPATA2(...)
  2. ├─SPATA2::asSPATA2(...)
  3. │ └─SPATA2 (local) .local(object, ...)
  4. │ └─Seurat::GetTissueCoordinates(object) %>% ...
  5. ├─dplyr::rename(., barcodes = cell, x_orig = x, y_orig = y)
  6. └─dplyr:::rename.data.frame(., barcodes = cell, x_orig = x, y_orig = y) Run rlang::last_trace(drop = FALSE) to see 18 hidden frames.
simonmfr commented 1 month ago

Unfortunately I cannot reproduce this error using the test dataset from our tutorial: https://themilolab.github.io/SPATA2/articles/package-compatibility.html.

Does that one work for you? If it works in your environment, feel free to share your dataset (or a subset) and I can troubleshoot.

Thanks, Simon

orange511 commented 2 weeks ago

Unfortunately I cannot reproduce this error using the test dataset from our tutorial: https://themilolab.github.io/SPATA2/articles/package-compatibility.html.

Does that one work for you? If it works in your environment, feel free to share your dataset (or a subset) and I can troubleshoot.

Thanks, Simon

Hi @simonmfr, I met the same error when I tried to convert my seurat object (V4) into a SPATA2 object. I have uploaded my a subset (one of the seurat_cluster) of my seurat spatial object for reproducing.
stobj_subset.zip Best,

simonmfr commented 2 weeks ago

Hi, thanks. Did you try running the tutorial with the test dataset as suggested above? Best, Simon

orange511 commented 2 weeks ago

Hi, thanks. Did you try running the tutorial with the test dataset as suggested above? Best, Simon

Hi, yes. I was able to successfully run the process with the test data, but it doesn't work when I use my own data . Best,

simonmfr commented 2 weeks ago

Hi, for some reason the object comes with differently formatted coordinates. It should work now. Can you please try after installing the dev branch via devtools::install_github("theMILOlab/SPATA2", "dev")? The change will be included in the next release - thanks for reporting.