kharchenkolab / Baysor

Bayesian Segmentation of Spatial Transcriptomics Data
MIT License
142 stars 29 forks source link

create a squidpy or R object using baysor output #126

Open shrutikhare-git opened 3 weeks ago

shrutikhare-git commented 3 weeks ago

Hi, I want to use baysor segmentation on my CosMx data and then visualize it in R/Python. CosMx usually outputs 5 files which are used by Seurat/Squidpy to create the object - metadata, tx, polygons, fov positions, exprMat. Can you please guide - how to reformat/create these 5 files to incorporate baysor segmentation? Thanks!

seigfried commented 2 weeks ago

I tried running a Baysor and made my own files. However I still get this error

Error in data.frame(x = md$CenterX_global_px, y = md$CenterY_global_px, : arguments imply differing number of rows: 0, 85911

I compared all columns and realised I did not have CenterX_local_px, CenterY_local_px, CenterX_global_px, CenterY_global_px in my metadata I tried to manually calculate this by taking the information from a polygons.csv of a different experiement and then calculated the centroid i.e. x1+x2+...+xn/n The results were close but not exactly the same as the CenterX_local_px, CenterY_local_px, CenterX_global_px, CenterY_global_px given in the metadata

So yes, my questions is also how I can convert Baysor output to say, a SquidPy or Seurat object