iscc.sample.Resection ¶
A resected tumour specimen, cut into the samples the assays take.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tumor
|
GenotypeTumor
|
The grown (count-based) tumour standing in for the resected specimen. |
required |
compartment
|
(primary, met, both)
|
Which grid the specimen is taken from. |
"primary"
|
Examples:
>>> spec = Resection(tumor) # primary by default
>>> cut, remainder = spec.bisect(frac=0.42) # in-plane cut
>>> cd = spec.dissociate(cut, max_cells=50000) # sequencing sample (full depth)
>>> section = spec.slice(remainder, depth_frac=0.5) # imaging section (thin slice)
>>> met = Resection(tumor, compartment="met").dissociate() # the metastasis instead
Notes
Both samplers leave tumor.cell_data untouched — take as many cuts as you like without
redefining what the tumour itself exports.
Methods:
| Name | Description |
|---|---|
bisect |
In-plane cut: split the specimen into two disjoint 2-D parts. |
dissociate |
Dissociate a 2-D part into a per-cell table for the sequencing assays. |
slice |
Cut a thin histology / Visium section: a depth cut of a 2-D part. |
bisect ¶
In-plane cut: split the specimen into two disjoint 2-D parts.
Cuts each grid of the resected :attr:compartment at frac of its side along axis and
returns the deme indices on each side, ready to pass to :meth:dissociate / :meth:slice
(or make_cell_data(region=)). For compartment="both" each grid is cut at the same
fraction and the parts are unioned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frac
|
float
|
Fraction of the grid (along |
0.5
|
axis
|
(x, y)
|
Cut axis: |
"x"
|
Returns:
| Type | Description |
|---|---|
(list of int, list of int)
|
|
dissociate ¶
Dissociate a 2-D part into a per-cell table for the sequencing assays.
Materialises the part at FULL column depth (all ~K cells/deme, subsampled to max_cells);
the cells lose their spatial position, as in a real dissociation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
region
|
iterable of int
|
Deme indices of the part to dissociate (e.g. the first element of :meth: |
None
|
max_cells
|
int
|
Cap on materialised cells (a representative subsample above it). |
None
|
install
|
bool
|
Also make this sample the tumour's own |
False
|
Returns:
| Type | Description |
|---|---|
dict
|
The per-cell |
slice ¶
Cut a thin histology / Visium section: a depth cut of a 2-D part.
Keeps depth_frac of each deme's 3-D column (default half — "take away half"), leaving the
2-D field intact, so a spatial assay sees the whole structure at a realistic ~one-layer density.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
region
|
iterable of int
|
Deme indices of the part to section (e.g. the remainder from :meth: |
None
|
depth_frac
|
float
|
Fraction of each deme's column kept in the slice. Note this thins the same 3-D column
that |
0.5
|
max_cells
|
int
|
Cap on materialised cells (bounds the section at cm-scale). |
None
|
install
|
bool
|
Also make this section the tumour's own |
False
|
Returns:
| Type | Description |
|---|---|
dict
|
The per-cell |