tdm.dataset.ExtrapolateNeighborsDataset#

class tdm.dataset.ExtrapolateNeighborsDataset(tissue: Tissue, neighborhood_size: float = 7.999999999999999e-05)[source]#

A NeighoborsDataset that includes cells near the edge of the tissue, correcting the bias due to partially observed neighborhoods.

We can’t observe the entire neighborhood of cells near tissue edges. For example, we can observe only half the neighborhood of a cell near the middle of an edge. To correct for this bias we multiply this cell’s counts by 2.

Generally:

corrected_counts = counts / fraction_of_neighborhood_observed
__init__(tissue: Tissue, neighborhood_size: float = 7.999999999999999e-05) None[source]#

Initializes the ExtrapolateNeighborsDataset.

Parameters:
  • tissue (Tissue) – The tissue instance.

  • neighborhood_size (float, optional) – The neighborhood radius. Defaults to 80 microns.

construct_dataset(tissue: Tissue, cell_type: str) tuple[DataFrame, DataFrame][source]#
Parameters:
  • tissue – instance of type Tissue

  • cell_type – str from the list CELL_TYPES_ARRAY, as defined in tdm.tissue.cell_types

Returns:

features: dataframe with shape (n_cells, n_features) observations: dataframe with shape (n_cells, 2) holding observations. columns: division, death

Return type:

features,observations (tuple)