mechanochat.tools.summarize_cluster#

mechanochat.tools.summarize_cluster(X: csr_matrix, clusterid, clusternames: list, rng, n_permutations: int)[source]#

Mean signal per cluster pair and its permutation p-value.

Parameters:
  • X (csr_matrix) – (n_cells, n_cells) signal matrix. X[i, j] is the signal from sender j to receiver i (row = receiver, column = sender).

  • clusterid (array-like) – Cluster label of each cell. Labels that are not in clusternames (e.g. NaN) are treated as unassigned and get the code -1.

  • clusternames (list) – Valid cluster names, defining the order of the rows and columns of the output.

  • rng (numpy.random.Generator) – Random generator used for the label permutations.

  • n_permutations (int) – Number of permutations.

Returns:

  • df_X (pandas.DataFrame) – (n, n) mean signal per cluster pair.

  • df_pvalue (pandas.DataFrame) – (n, n) one-sided permutation p-value, (count + 1) / (n_permutations + 1).

  • df_qvalue (pandas.DataFrame) – (n, n) Benjamini-Hochberg corrected p-values.