dpeerlab / ENVI

MIT License
38 stars 6 forks source link

Question on computing niches on spatial data #8

Open abs51295 opened 7 months ago

abs51295 commented 7 months ago

Hey,

I just want to use the COVET method to compute niches on spatial data. I have several batches in my data. Should I just use compute_covet function with batch_key to get the COVET_SQRT representation of the spatial data? Can I just compute neighbors and run louvain clustering on that representation to cluster my data? I am assuming adding batch information wouldn't result in separate clusters per batch.

Also, can I use a latent space representation like one from scVI instead of selecting HVGs and compute COVET on the latent representation instead of genes?

Thanks

DoronHav commented 7 months ago

Hi!

Regarding batch information. Yes, just add the batch_key for make sure that COVET knows to ensure that spatial neighbors are only with-in batch. You can just ran analysis on 'COVET_SQRT' from there on out.

Right now, the COVET code just uses the .X from the anndata. In a future version, we will add the option to use any layer/obsm instead. As a hack, you can create an anndata where the .X is the scVI latent and run compute_covet with 'g=-1' and it should produce what you are looking for.

abs51295 commented 7 months ago

Thanks for the quick response! I did run the function with batch_key and I computed the neighbors using sc.pp.neighbors and louvain clusters with sc.tl.louvain with resolution=0.5 and it gave me 1000s of clusters. Is that expected? I have 1.3M cells in my data from a Xenium experiment.