esqLABS / esqlabsR

Utility functions for modelling and simulation workflows within esqLABS organization
https://esqlabs.github.io/esqlabsR/
GNU General Public License v2.0
18 stars 2 forks source link

Sensitivity Analysis: issue a warning when a PK parameter is not found #173

Closed PavelBal closed 2 years ago

PavelBal commented 2 years ago

Eg. here

ls_results <- sensitivityCalculation(
  simulation = simulation,
  outputPaths = outputPaths,
  parameterPaths = parameterPaths,
  pkParameters = c("AUC_tEnd", "AUC_tEnd_norm", "C_min_norm"),
  pkDataFilePath = "../Sensitivities.xlsx"
)

C_min_norm is not available. It should continue but show a warning. Separater PR please.

IndrajeetPatil commented 2 years ago

Currently, it works without any issues if one of the PK parameters is not available:

library(ospsuite)
library(esqlabsR)

# run time-consuming simulations just once
simPath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite")
simulation <- loadSimulation(simPath)
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"
)

set.seed(123)
results <- sensitivityCalculation(
  simulation = simulation,
  outputPaths = outputPaths,
  parameterPaths = parameterPaths,
  variationRange = c(0.1, 2, 20),
  pkParameters = c("AUC_tEnd", "AUC_tEnd_norm", "C_min_norm"),
)

unique(results$pkData$PKParameter)
#> [1] "AUC_tEnd"      "AUC_tEnd_norm"

Created on 2022-02-25 by the reprex package (v2.0.1.9000)

But instead of this higher level function signalling the unavailability of certain PK parameters, I am wondering if it would be better if the low-level functions in ospsuite issues warnings related to this?

PavelBal commented 2 years ago

Related issue here: https://github.com/Open-Systems-Pharmacology/OSPSuite-R/issues/792

But as you are using pkAnalysesToDataFrame, there is not in between step to check if the provided PK-parameter name is not included.

PavelBal commented 2 years ago

Also see my comment in the PR - I just realized that there are scenarios where the PK-parameter name provided here is not a "standard" pk param. So we should not check if its in ospsuite::StandardPKParameter but show a warning here that this parameter is not calculated.