tangram.utils.df_to_cell_types

tangram.utils.df_to_cell_types(df, cell_types)

Utility function that “randomly” assigns cell coordinates in a voxel to known numbers of cell types in that voxel. Used for deconvolution.

Parameters
  • df (DataFrame) – Columns correspond to cell types. Each row in the DataFrame corresponds to a voxel and specifies the known number of cells in that voxel for each cell type (int). The additional column ‘centroids’ specifies the coordinates of the cells in the voxel (sequence of (x,y) pairs).

  • cell_types (sequence) – Sequence of cell type names to be considered for deconvolution. Columns in ‘df’ not included in ‘cell_types’ are ignored for assignment.

Returns

A dictionary <cell type name> -> <list of (x,y) coordinates for the cell type>