iscc.sample.Biopsy ¶
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 |
required |
rng
|
Generator
|
Seeded generator for reproducibility. |
None
|
grid_size
|
int
|
Grid extent. If omitted, bounds are inferred from |
None
|
Methods:
| Name | Description |
|---|---|
punch_mask |
Disk of |
needle_mask |
Narrow strip of |
multiregion |
|
liquid_mask |
Small circulating-cell sample biased toward high-dispersal clones. |
sample |
Run a biopsy. Returns (chosen_index, region_series, geometry). |
punch_mask ¶
Disk of radius around center. Returns (mask, geometry).
needle_mask ¶
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 ¶
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 ¶
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).