tdm.dataset.RestrictedNeighborsDataset#
- class tdm.dataset.RestrictedNeighborsDataset(nds: Dataset, allowed_neighbor_types: list[str] | None = None, required_neighbor_types: list[str] | None = None, keep_types: list[str] | None = None)[source]#
Filters out cells according to lists of allowed cell types and cell types that must be neighboring each cell.
- __init__(nds: Dataset, allowed_neighbor_types: list[str] | None = None, required_neighbor_types: list[str] | None = None, keep_types: list[str] | None = None) None [source]#
- Parameters:
nds (NeighborsDataset) – instance of NeighborsDataset
allowed_neighbor_types (list[str], optional) – A list of cell types. Cells that are or have neighbors outside this list are excluded from the restricted dataset. Default behavior: allow all types.
required_neighbor_types (list[str], optional) – A list of cell types. Cells that do not have at least one neighbors of each type in this list are excluded from the restricted dataset. Note that a cell is by definition a neighbor of itself. Default behavior: don’t require any type.
keep_types (list[str], optional) – A list of cell types. Drops all columns for cell types outside this list. If not provided, uses allowed_types because all columns outside allowed_neighbor_types will have only zeros.