bento.tl.colocation

bento.tl.colocation(sdata, ranks, instance_key='cell_boundaries', feature_key='feature_name', iterations=3, plot_error=True)

Decompose a tensor of pairwise colocalization quotients into signatures.

Parameters:
  • sdata (SpatialData) – SpatialData object.

  • ranks (List[int]) – List of ranks to decompose the tensor.

  • instance_key (str, default “cell_boundaries”) – Key that specifies cell_boundaries instance in sdata.

  • feature_key (str, default “feature_name”) – Key that specifies genes in sdata.

  • iterations (int, default 3) – Number of iterations to run the decomposition.

  • plot_error (bool, default True) – Whether to plot the error of the decomposition.

Returns:

Updated SpatialData object with: - .tables[“table”].uns[‘factors’]: Decomposed tensor factors. - .tables[“table”].uns[‘factors_error’]: Decomposition error.

Return type:

SpatialData