bento.tl.lp_diff_discrete

bento.tl.lp_diff_discrete(sdata, instance_key='cell_boundaries', phenotype=None)

Test for differential localization patterns between discrete phenotype groups.

Performs pairwise statistical testing between phenotype groups for each pattern and gene combination. Missing patterns are excluded from analysis.

Parameters:
  • sdata (SpatialData) – Input SpatialData object with localization pattern results

  • instance_key (str, default “cell_boundaries”) – Key for cell boundaries in sdata.shapes

  • phenotype (str) – Column in sdata.shapes[instance_key] containing group labels

Returns:

Modifies sdata.tables[“table”].uns[f’diff_{phenotype}’] with: - Statistical results (p-values, z-scores) - Effect sizes (dy/dx) - Log2 fold changes between groups - Multiple testing corrected p-values

Return type:

None