iscc.tumor.Tumor ¶
Tumor(config=None, genome_params=dict(), cancer_cell_params=dict(), epithelial_cell_params=dict(), stromal_cell_params=dict(), immune_cell_params=dict(), deme_params=dict(), selection_params=dict(), seed=42, layout_seed=None)
Bases: object
Shared base for the cell-level and count-based tumour engines; holds the common construction parameters.
Both GlandularTumor (cell-level) and
GenotypeTumor (count-based) share the construction
parameters below — a single config YAML path, or the individual nested-dict
parameter blocks — and forward them here.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
str or Path
|
Path to a YAML config that defines the parameter blocks below (keys
|
None
|
genome_params
|
dict
|
Genome geometry — |
dict()
|
selection_params
|
dict
|
The CINner fitness model — driver / dispersal / resistance proportions and
effect sizes, viability limits, and the optional |
dict()
|
deme_params
|
dict
|
Per-deme demography — |
dict()
|
cancer_cell_params
|
dict
|
Cancer-cell dynamics — |
dict()
|
epithelial_cell_params
|
dict
|
Seeding parameters for each non-cancer (static) cell type — the tissue structure, cell-type labels and local immune density that the cancer death rate reads. |
dict()
|
stromal_cell_params
|
dict
|
Seeding parameters for each non-cancer (static) cell type — the tissue structure, cell-type labels and local immune density that the cancer death rate reads. |
dict()
|
immune_cell_params
|
dict
|
Seeding parameters for each non-cancer (static) cell type — the tissue structure, cell-type labels and local immune density that the cancer death rate reads. |
dict()
|
seed
|
int
|
EVOLUTION seed (default 42): drives the per-run stochastic dynamics and the
spatial seeding. Two runs differing only in |
42
|
layout_seed
|
int
|
GENOME-LAYOUT seed (config-determined, shared across runs of the same config):
fixes driver identities and baseline expression so a cohort is comparable by
construction. Defaults to the fixed |
None
|
Methods:
| Name | Description |
|---|---|
get_genotype_frequencies |
Frequencies of the cancer genotypes (normal cell types excluded). |
is_extinct |
Whether the tumour has died out — |
grow |
Advance the tumour by |
get_tumor_size |
Total number of live cells across all genotypes (cancer and normal). |
make_cell_data |
Make a dataframe containing, for each cell: |
write |
Write the tumour to |
plot_muller |
Render a Muller plot of the clonal dynamics (cancer genotype frequencies over steps). |
get_genotype_frequencies ¶
Frequencies of the cancer genotypes (normal cell types excluded).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
normalize
|
bool
|
If |
True
|
Returns:
| Type | Description |
|---|---|
tuple of (list, numpy.ndarray)
|
An (unused) |
is_extinct ¶
Whether the tumour has died out — True when the total deme event rate is zero.
grow ¶
Advance the tumour by n_steps update steps and materialise the result.
Each step samples demes proportionally to their event rates and applies the
birth / death / mutation / dispersal process, appending a population snapshot to
self.traces; treatment dosing is applied per step when a treatment is given.
Finally calls make_cell_data to build the per-cell ground truth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_steps
|
int
|
Number of update steps to run (default 10). |
10
|
seed
|
int
|
Evolution seed for this call (default 42); each step draws a fresh generator
from |
42
|
treatment
|
Treatment
|
A therapy whose dosing schedule and rate modifiers are applied each step;
|
None
|
batch_size
|
int
|
Number of demes updated per step (default 1). |
1
|
Returns:
| Type | Description |
|---|---|
list
|
The per-step population snapshots recorded during this call. |
get_tumor_size ¶
Total number of live cells across all genotypes (cancer and normal).
make_cell_data ¶
Make a dataframe containing, for each cell: type, evolutionary_parameters, deme_id, gene_exp, gene_mut, gene_cnv
write ¶
Write the tumour to output_path in the canonical iscc layout.
Creates the directory and writes the population traces (trace_counts.csv,
parents.csv, genotypes.csv), the per-gene gene_data matrices and the
per-cell cell_data matrices, so the sampling and data-generation stages can
consume it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
str or Path
|
Directory to create and write into. |
required |
plot_muller ¶
Render a Muller plot of the clonal dynamics (cancer genotype frequencies over steps).
Stacks each cancer genotype's abundance through the recorded traces, nested by ancestry; normal cell types are excluded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ax
|
Axes
|
Axes to draw into; a new figure is created when |
None
|
colormap
|
str
|
Matplotlib colormap name for the clones (default |
'gnuplot'
|
normalize
|
bool
|
Plot frequencies ( |
True
|
smoothing_std
|
float
|
Standard deviation of the band smoothing (default 0.1). |
0.1
|
show_axes
|
bool
|
Draw axis labels ( |
True
|