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

sensitivityCalculation does not return a clear error message when parameterPath is NULL #709

Closed Felixmil closed 1 month ago

Felixmil commented 2 months ago

If parameterPaths is NULL (can happen when you retrieve paths programatically) then sensitivityCalculation() returns an error about missing column (because result dataframe is empty I think).

I think there should be aditionnal check to make sure that the provided parameterPaths argument is not NULL and also that the pkData is not NULL or an empty dataframe.

Thanks to Luis that helped us find out about this.

devtools::load_all()
#> ℹ Loading esqlabsR
#> Loading required package: ospsuite
#> 
#> Loading required package: rSharp
simPath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite")
simulation <- loadSimulation(simPath)
outputPaths <- "Organism|PeripheralVenousBlood|Aciclovir|Plasma (Peripheral Venous Blood)"
variationRange <- c(0.1, 2, 20) # 1.0 is deliberately left out for testing

parameterPaths <- NULL

results <- sensitivityCalculation(
  simulation = simulation,
  outputPaths = outputPaths,
  parameterPaths = parameterPaths,
  variationRange = variationRange
)
#> Error in `dplyr::filter()` at esqlabsR/R/sensitivity-calculation.R:229:5:
#> ℹ In argument: `PKParameter %in% filterValues`.
#> Caused by error:
#> ! object 'PKParameter' not found

Created on 2024-09-16 with reprex v2.1.1