troutpy.tl.communication_strength#
- troutpy.tl.communication_strength(sdata, source_layer='source_score', target_layer='target_score', copy=False)#
Compute a 3D interaction strength matrix by multiplying per-transcript source and target scores.
For each extracellular transcript, the outer product of its source-cell-type probability vector and its target-cell-type probability vector is computed. The resulting matrix of shape
(n_transcripts, n_source_types, n_target_types)is stored insdata["source_score"].uns["interaction_strength"].- Parameters:
sdata (spatialdata.SpatialData) – SpatialData object containing pre-computed
source_scoreandtarget_scoretables insdata.tables.source_layer (str, optional) – Key for the source-score AnnData in
sdata.tables. Defaults to"source_score".target_layer (str, optional) – Key for the target-score AnnData in
sdata.tables. Defaults to"target_score".copy (bool, optional) – If
True, return the updated SpatialData object; otherwise modify in place and returnNone. Defaults toFalse.
- Returns:
spatialdata.SpatialData or None Updated SpatialData with
interaction_strengthstored insdata["source_score"].unsifcopy=True; otherwiseNone.