Closed MeyerBender closed 1 week ago
To generalize this a bit more, we could directly implement neighborhoods within spatialproteomics
. A big advantage of this would be that we could subset cells by neighborhoods, and then look at the ct distribution within that. For example, assuming that one neighborhood encodes the germinal center, we could check if there are major differences in the composition of this environment between samples (given that they do not cluster completely separate).
This requires a couple of things to be implemented:
pp.compute_neighbors(method='radius')
. This could add a new table of shape (cells, cell_types)
. We need to ensure that this is synchronizes with the obs column that holds the cell types.sp_dict = {'1': sp_obj_1, '2': sp_obj_2}
df = []
for id, sp_obj in sp_dict.items():
df.append(sp_obj.pp.get_layer_as_df('_neighborhoods'))
df = pd.DataFrame(df)
# clustering with k-means on the df
...
# adding the neighborhoods back into the graph
for id, sp_obj in sp_dict.items():
sp_obj.pp.add_obs(df['id' == id])
This is a bit cumbersome, however I think it makes sense to keep this apart from the package itself.
spatialproteomics
again.Addressed in #97. Now also includes an ImageContainer
, which allows you to do the entire analysis in one command. Next features should be: computation of distances and graph features, e. g. centrality, on specific neighborhoods.
Node-level features are now implemented and have been merged to main in #102. Another nice add-on would be to have graph-level features such as homophily to compare different samples.
Graph-level features implemented and merged in #104. Next up we need to look at distributions of node-level features to compare cores.
These will be shown in the manuscript, closing issue.
For visualizing neighborhoods, it would be cool to do a sort of Voronoi tessellation and then extract the edges from the tessellation and color in the corresponding neighborhoods while also plotting the borders in black or something like that.