spatialdm.weight_matrix

spatialdm.weight_matrix(adata, l, cutoff=None, n_neighbors=None, n_nearest_neighbors=6, single_cell=False)

compute weight matrix based on radial basis kernel. cutoff & n_neighbors are two alternative options to restrict signaling range. :type l: :param l: radial basis kernel parameter, need to be customized for optimal weight gradient and to restrain the range of signaling before downstream processing. :type cutoff: :param cutoff: (for secreted signaling) minimum weight to be kept from the rbf weight matrix. Weight below cutoff will be made zero :type n_neighbors: :param n_neighbors: (for secreted signaling) number of neighbors per spot from the rbf weight matrix. :type n_nearest_neighbors: :param n_nearest_neighbors: (for adjacent signaling) number of neighbors per spot from the rbf weight matrix. Non-neighbors will be made 0 :type single_cell: :param single_cell: if single cell resolution, diagonal will be made 0. :return: secreted signaling weight matrix: adata.obsp[‘weight’], and adjacent signaling weight matrix: adata.obsp[‘nearest_neighbors’]