cellcharter.gr.remove_intra_cluster_links#
- cellcharter.gr.remove_intra_cluster_links(adata, cluster_key, connectivity_key=None, distances_key=None, copy=False)#
Remove links between cells that belong to the same cluster.
Used in
cellcharter.gr.nhood_enrichment()
to consider only interactions between cells of different clusters.- Parameters:
adata (
AnnData
) – Annotated data object.cluster_key (
str
) – Key inanndata.AnnData.obs
of the cluster labeling to consider.connectivity_key (
Optional
[str
] (default:None
)) – Key inanndata.AnnData.obsp
where spatial connectivities are stored. Default is:anndata.AnnData.obsp
['spatial_connectivities']
.distances_key (
Optional
[str
] (default:None
)) – Key inanndata.AnnData.obsp
where spatial distances are stored. Default is:anndata.AnnData.obsp
['{{Key.obsp.spatial_dist()}}']
.copy (
bool
(default:False
)) – IfTrue
, return the result, otherwise save it to theadata
object.
- Return type:
- Returns:
If
copy = True
, returns atuple
with the new spatial connectivities and distances matrices.- Otherwise, modifies the
adata
with the following keys: anndata.AnnData.obsp
['{{connectivity_key}}']
- the new spatial connectivities.anndata.AnnData.obsp
['{{distances_key}}']
- the new spatial distances.
- Otherwise, modifies the