theMILOlab / SPATA2

A Toolbox for Spatial Gene Expression Analysis
77 stars 15 forks source link

Converting giotto object to SPATA2 #86

Closed archana433 closed 8 months ago

archana433 commented 10 months ago

Hi, When I am converting gitto object into spata2 object for cnv analysis , I am getting error : spata2_obj <- SPATA2::asSPATA2( object = giotto_object, sample_name = "visium", spatial_method = "Visium", transfer_meta_data = TRUE, coordinates = spatial_locs, image_ebi = image_ebi, verbose = TRUE )

Error in as.data.frame.default(x[[i]], optional = TRUE) : cannot cast class 'structure("cellMetaObj", package = "Giotto")' to data.frame

giotto_object

Please help, how to resolve this error ? Thank you

simonmfr commented 10 months ago

Hi, did you follow the pipeline described at https://themilolab.github.io/SPATA2/articles/spata-v2-platform-compatibility.html?

If you like you can send me a subset of your giotto file and I will have a try.

Best, Simon

simonmfr commented 10 months ago

@archana433 Thank you for sending the file, however it does not seem to be complete. Plotting your file with Giotto::spatPlot(giotto_object_error) causes an error: Error in `:=`(cell_ID, NULL) : Check that is.data.table(DT) == TRUE. Otherwise, := and `:=`(...) are defined for use in j, once only and in particular ways. See help(":=").

Can you try to export your giotto_object as follows and share all 3 files (giotto_image.png, giotto_spatial_locs.rds, giotto_object.rds) with me?

magick::image_write(giotto_object@images$image$mg_object, path = "giotto_image.png", format = "png")  
saveRDS(giotto_object@spatial_locs, file = “giotto_spatial_locs.rds")  
giotto_object@images <- NULL 
saveRDS(giotto_object, file = “giotto_object.rds")  
simonmfr commented 8 months ago

Closed due to inactivity, please feel free to re-open.