Average Cell Shapes

avg_shape(obj_names: list[str], gw_dist_dict: dict[tuple[str, str], float], iodms: dict[str, numpy.ndarray[Any, numpy.dtype[numpy.float64]]], gw_coupling_mat_dict: dict[tuple[str, str], scipy.sparse._coo.coo_matrix])

Compute capped and uncapped average distance matrices. In both cases the distance matrix is rescaled so that the minimal distance between two points is 1. The “capped” distance matrix has a max distance of 2.

Parameters
  • obj_names (list[str]) – Keys for the gw_dist_dict and iodms.

  • gw_dist_dict (dict[tuple[str, str], float]) – Dictionary mapping ordered pairs (cellA_name, cellB_name) to Gromov-Wasserstein distances.

  • iodms (dict[str, numpy.ndarray[Any, numpy.dtype[numpy.float64]]]) – (intra-object distance matrices) - Maps object names to intra-object distance matrices. Matrices are assumed to be given in vector form rather than squareform.

  • gw_coupling_mat_dict (dict[tuple[str, str], scipy.sparse._coo.coo_matrix]) – Dictionary mapping ordered pairs (cellA_name, cellB_name) to Gromov-Wasserstein coupling matrices from cellA to cellB.

avg_shape_spt(obj_names: list[str], gw_dist_dict: dict[tuple[str, str], float], iodms: dict[str, numpy.ndarray[Any, numpy.dtype[numpy.float64]]], gw_coupling_mat_dict: dict[tuple[str, str], scipy.sparse._coo.coo_matrix], k: int)

Given a set of cells together with their intracell distance matrices and the (precomputed) pairwise GW coupling matrices between cells, construct a morphological “average” of cells in the cluster. This function:

  • aligns all cells in the cluster with each other using the coupling matrices

  • takes a “local average” of all intracell distance matrices, forming a distance matrix which models the average local connectivity structure of the neurons

  • draws a minimum spanning tree through the intracell distance graph, allowing us to visualize this average morphology

Parameters
  • obj_names (list[str]) – Keys for the gw_dist_dict and iodms; unique identifiers for the cells.

  • gw_dist_dict (dict[tuple[str, str], float]) – Dictionary mapping ordered pairs (cellA_name, cellB_name) to Gromov-Wasserstein distances between them.

  • iodms (dict[str, numpy.ndarray[Any, numpy.dtype[numpy.float64]]]) – (intra-object distance matrices) - Maps object names to intra-object distance matrices. Matrices are assumed to be given in vector form rather than squareform.

  • k (int) – how many neighbors in the nearest-neighbors graph.

  • gw_coupling_mat_dict (dict[tuple[str, str], scipy.sparse._coo.coo_matrix]) –

Gw_coupling_mat_dict

Dictionary mapping ordered pairs (cellA_name, cellB_name) to Gromov-Wasserstein coupling matrices from cellA to cellB.