Patient-specific modeling (pasmopy.patient_model
)
- class pasmopy.patient_model.PatientModelSimulations(path_to_models, patients, biomass_kws=None)
Run simulations of patient-specific models.
- response_characteristics
A dictionary containing functions to extract dynamic response characteristics from time-course simulations.
- run(n_proc=None, context='spawn', progress=True)
Run simulations of multiple patient-specific models in parallel.
- subtyping(fname, dynamical_features, normalization=None, progress=True, *, clustermap_kws=None)
Classify patients based on dynamic characteristics extracted from simulation results.
- Parameters:
fname (str, path-like or
None
) – The clustermap is saved as fname if it is notNone
.dynamical_features (Dict[str, Dict[str, List[str]]]) –
{"observable": {"condition": ["metric", ...], ...}, ...}
. Characteristics in the signaling dynamics used for classification.normalization (dict, optional (default:
None
)) –- ‘timepoint’Optional[int]
The time point at which simulated values are normalized. If
None
, the maximum value will be used for normalization.
- ’condition’list of strings
The experimental conditions to use for normalization. If empty, all conditions defined in
sim.conditions
will be used.
progress (bool (default:
True
)) – IfTrue
, the progress indicator will be shown.clustermap_kws (dict, optional) – Keyword arguments to pass to
seaborn.clustermap()
.
Examples
Subtype classification
>>> with open("models/breast/sample_names.txt", mode="r") as f: ... TCGA_ID = f.read().splitlines() >>> from pasmopy import PatientModelSimulations >>> simulations = PatientModelSimulations("models.breast", TCGA_ID) >>> simulations.subtyping( ... "subtype_classification.pdf", ... { ... "Phosphorylated_Akt": {"EGF": ["max"], "HRG": ["max"]}, ... "Phosphorylated_ERK": {"EGF": ["max"], "HRG": ["max"]}, ... "Phosphorylated_c-Myc": {"EGF": ["max"], "HRG": ["max"]}, ... }, ... { ... "Phosphorylated_Akt": {"timepoint": None, "condition": ["EGF", "HRG"]}, ... "Phosphorylated_ERK": {"timepoint": None, "condition": ["EGF", "HRG"]}, ... "Phosphorylated_c-Myc": {"timepoint": None, "condition": ["EGF", "HRG"]}, ... }, ... clustermap_kws={"figsize": (9, 12)} ... )
Add new characteristics
>>> import numpy as np >>> def get_droprate(time_course: np.ndarray) -> float: ... return - (time_course[-1] - np.max(time_course)) / (len(time_course) - np.argmax(time_course)) >>> simulations.response_characteristics["droprate"] = get_droprate