stereo.algorithm.co_occurrence.CoOccurrence.main#

CoOccurrence.main(cluster_res_key, method='stereopy', dist_thres=300, steps=10, genelist=None, gene_thresh=0, n_jobs=-1, res_key='co_occurrence')[source]#

Co-occurence calculates the score or probability of two or more cell types in spatial. Stereopy provided two method for co-occurence, ‘squidpy’ for method in squidpy, ‘stereopy’ for method in stereopy by default.

Parameters:
  • cluster_res_key – The key of the cluster or annotation result of cells stored in data.tl.result which ought to be equal to cells in length.

  • method – The method to calculate co-occurence choose from ['stereopy', 'squidpy'], 'stereopy' by default.

  • dist_thres – The max distance to measure co-occurence. Only used when method='stereopy'.

  • steps – The steps to generate threshold to measure co-occurence, use along with dist_thres, i.e. default params will generate [30,60,90……,270,300] as threshold. Only used when method='stereopy'.

  • genelist – Calculate co-occurence between clusters in cluster_res_key & genelist if provided, otherwise calculate between clusters in cluster_res_key. Only used when method='stereopy'.

  • gene_thresh – Threshold to determine whether a cell expresses targeted gene. Only used when method='stereopy'.

  • n_jobs – The number of threads to calculate co-occurence, default to all cores of the machine.

  • res_key – The key to store the result in data.tl.result.

Returns:

StereoExpData object with co_occurrence result in data.tl.result.