bimberlabinternal / CellMembrane

An R package with wrappers and pipelines for single cell RNA-seq analysis
10 stars 3 forks source link

Add "niche" detection to spatial analyses #215

Closed GWMcElfresh closed 8 months ago

GWMcElfresh commented 8 months ago

Hi all,

There are a ton of ways to define cellular niches, and I haven't found a good fit with the tools out there. Currently, you either need to leverage the seuratObj@images ... slot? layer? (which is an efficient way to store images, but difficult to encode post-hoc) or accept louvain/leiden clustering as your cellular niche.

This approach leverages transcriptomic information provided in via a metadata field reflecting either cell types or clusters, then performs DBSCAN to isolate cellular substructures. I have had a tough time dealing with non-uniform cellular density between the inside and outside of B cell follicles, so this method segments the images into a "target cell type(s)" layer, performs spatial clustering on those cells, and then classifies all of the cells relative to those substructures via a convex hull around each substructure.

Here is an example of automatically defining a B cell follicle. The top image shows simplified cell type metadata, while the bottom left image shows indexed follicles (zero is always a "null" cluster, indicating it isn't identified as a structure). The bottom right shows a gross inclusion of cells into any of the current substructure.

image

One could nest different substructures by calling the function multiple times, so I'm not fully certain where to leave the verbosity of the output. Currently, this will yield at least one metadata column per FOV and one extra column per substructure within the FOV.

TODO before pull request: