Skip to content

iscc.sample.Biopsy

Biopsy(cell_data, rng=None, grid_size=None)

Bases: object

Spatial region selection over a tumour's cell_data.

Parameters:

Name Type Description Default
cell_data dict[str, DataFrame]

The isccsim ground truth (must include cell_crd; cell_type and cell_evo enable liquid biopsy).

required
rng Generator

Seeded generator for reproducibility.

None
grid_size int

Grid extent. If omitted, bounds are inferred from cell_crd.

None

Methods:

Name Description
punch_mask

Disk of radius around center. Returns (mask, geometry).

needle_mask

Narrow strip of width along angle (deg) through center.

multiregion

k disjoint disks, each tagged with its own region_i label.

liquid_mask

Small circulating-cell sample biased toward high-dispersal clones.

sample

Run a biopsy. Returns (chosen_index, region_series, geometry).

punch_mask

punch_mask(center=None, radius=None)

Disk of radius around center. Returns (mask, geometry).

needle_mask

needle_mask(center=None, width=None, angle=0.0)

Narrow strip of width along angle (deg) through center.

The core is the set of cells whose perpendicular distance to the line through center in direction angle is <= width/2 — an infinite strip clipped by the tumour, i.e. a needle core.

multiregion

multiregion(k=3, radius=None, max_tries=2000)

k disjoint disks, each tagged with its own region_i label.

Centres are drawn from occupied cells and kept pairwise >= 2*radius apart, so the disks never overlap. Returns (mask, region_array, geometry); region_array is full-length over self.index with "" for unsampled cells.

liquid_mask

liquid_mask(n=20, signal=None)

Small circulating-cell sample biased toward high-dispersal clones.

CTCs are tumour cells, so the pool is restricted to cancer clones (falls back to all cells if none). Sampling weight comes from a per-cell dispersal signal in cell_evo (n_mut_disp then dispersal_rate); if absent, degrades gracefully to a uniform draw.

sample

sample(biopsy_type='punch', center=None, radius=None, width=None, angle=0.0, n_regions=3, n_liquid=20, signal=None)

Run a biopsy. Returns (chosen_index, region_series, geometry).

region_series is a pandas Series of the region label indexed by the chosen cell names (the contents of cell_region.csv).