Closed PavelBal closed 2 years ago
Instead of
pkParams = c(
StandardPKParameter$C_max,
StandardPKParameter$t_max,
StandardPKParameter$AUC_tEnd
)
I was thinking the default will be NULL
, which would include all PK parameters. When not NULL
, only those PK parameters will be retained in data and plots. Sounds reasonable?
Hmm no, not really, there are 22 standard PK parameters defined in PK sim and it would generate just too much output. Most of the time people are just interested in
StandardPKParameter$C_max,
StandardPKParameter$t_max,
StandardPKParameter$AUC_inf
In that case, is it okay if the parameter actually takes in a vector of strings/character type specifying needed PK parameters? That is,
pkParams = c("C_max", "t_max", "AUC_inf")
And the documentation will make clear that the names of all available PK parameters can be found in names(StandardPKParameter)
?
Those enum
s evaluate to numbers and are difficult to work with further, while with a character vector, I can just filter out the needed PK parameters.
Ah yes... No idea why the enum
is defined that way.... Yes sure, it should be strings, I didn't realize these were integers in the enum.
We also have outputPath
argument for sensitivityAnalysis()
.
What needs to happen if there are multiple output paths specified by the user? Do they need to be mapped to color or shape or etc.?
What needs to happen if there are multiple output paths specified by the user? Do they need to be mapped to color or shape or etc.?
No, let's keep it simple and create one figure per path.
Okay, I have implemented this, but can't find a dataset to play with that has multiple output paths.
There is simple.pkml
in the package, but that doesn't seem to be a realistic dataset to try this out.
Any suggestions?
Current example, which has only a single path:
simulation <- loadSimulation("Aciclovir.pkml")
outputPaths <- "Organism|PeripheralVenousBlood|Aciclovir|Plasma (Peripheral Venous Blood)"
parameterPaths <- c(
"Aciclovir|Lipophilicity",
"Applications|IV 250mg 10min|Application_1|ProtocolSchemaItem|Dose",
"Neighborhoods|Kidney_pls_Kidney_ur|Aciclovir|Glomerular Filtration-GFR|GFR fraction"
)
variationRange <- c(seq(0.2, 1, by = 0.1), seq(2, 10, by = 1)) # c(0.1, 1, 2)
sensitivityAnalysis(
simulation = simulation,
outputPaths = outputPaths,
parameterPaths = parameterPaths,
variationRange = variationRange,
pkParams = NULL
)
Just add any other output from your model
Organism|VenousBlood|Plasma|Aciclovir
Also read https://docs.open-systems-pharmacology.org/shared-tools-and-example-workflows/sensitivity-analysis for introduction of how sensitivity analysis (SA) is performed in OSPS.
A function (or a set of functions) for convenient execution of local sensitivity analysis on models developed with OSPS. As inputs, the user should be able to specify:
Simulation
object"Organism|PeripheralVenousBlood|Aciclovir|Plasma (Peripheral Venous Blood)"
scaleFactors
that are multiplied by the reference parameter value (i.e., the value as in the suppliedSimulation
Sensitivity calculation
The first function, e.g.
sensitivityCalculation
, should perform the following:Run a simulation with parameter values as provided in the
Simulation
object and generate results for all outputs specified in the output paths argument. The values of parameters correspond to scale factor == 1, and results are considered asreferenceResults
.For each parameter to vary (== analyze how sensitive model outputs are to changing this parameter's value)
referenceValue * scaleFactor
referenceValue
For each simulation result (== for each combination of
inputParameter
andscaleFactor
), calculate the PK-parameters for each output.Results should be returned in a structure (data frame?) that can be passed to the functions that will create time-values profiles and sensitivity "spider plot" figures (definition below). Additionally, results should be saved in an excel file if the user specifies a path to the file (if the file with the specified name is already present, it will be overwritten). The excel file should have the following structure:
n
being the total number of defined model outputs to analyze. (Output paths cannot be used as sheet names as they can be very long).OutputPath
: full path of the output. All entries will be equal for one sheetParameterPath
: full path of the varied parameterParameterFactor
: scale factor by which the parameter withParameterPath
has been multiplied for this particular simulatoinParameterValue
: absolute value of the parameter used in the simulationCmax
): calculated value of the PK-parameterS_PKParamName
(e.g.S_Cmax
): denotes the "Sensitivity for PK parameter to the input parameter, and calculated as described in https://docs.open-systems-pharmacology.org/shared-tools-and-example-workflows/sensitivity-analysis#mathematical-background (NOT the average!)Time profiles visualization
A second function, eg.
sensivitityTimeProfiles
, should create time-values profile figures for the output generated bysensitivityCalculation
.For each output defined in
sensivitityTimeProfiles
:"Organism|PeripheralVenousBlood|Aciclovir|Plasma (Peripheral Venous Blood)"
)"Aciclovir|Lipophilicity"
)Dimension
[unit]
"Sensitivity spider plots
A third function, e.g.
sensitivitySpiderPlot
, generates a set of so-called sensitivity spider plots (example below. Be aware that the example shows % change on the y-axis, but the specification requires [% of reference]:)For each output defined in
sensivitityTimeProfiles
:"Organism|PeripheralVenousBlood|Aciclovir|Plasma (Peripheral Venous Blood)"
)Cmax
)Remarks