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

ospsuite update seems to have broken sensitivity analysis functionality #276

Closed IndrajeetPatil closed 2 years ago

IndrajeetPatil commented 2 years ago
library(esqlabsR)

simPath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite")
simulation <- loadSimulation(simPath)
outputPaths <- "Organism|PeripheralVenousBlood|Aciclovir|Plasma (Peripheral Venous Blood)"
parameterPaths <- "Aciclovir|Lipophilicity"

sensitivityCalculation(
  simulation = simulation,
  outputPaths = outputPaths,
  parameterPaths = parameterPaths
)
#> Error in validateIsOfType(container, c("Simulation", "Container", "Molecule")): tryCatch: argument 'container' is of type 'NULL', but expected 'Simulation, or Container, or Molecule'!

Created on 2022-07-20 by the reprex package (v2.0.1.9000)

The error originates from here:

> traceback()
17: stop(messages$errorWrongType(objectName, class(object)[1], objectTypes)) at validation-type.R#88
16: validateIsOfType(container, c("Simulation", "Container", "Molecule")) at utilities-entity.R#115
15: .getAllEntitiesMatching(paths, container, Parameter) at utilities-parameter.R#26
14: getAllParametersMatching(parameterPath, purrr::pluck(simulationResults, 
        1L, "simulation")) at utilities-sensitivity-calculation.R#150
13: .addParameterColumns(., simulationResults, parameterPath)
12: dplyr::group_by(., ParameterPath, PKParameter)
11: dplyr::group_modify(., .f = ~.computePercentChange(.))
10: dplyr::ungroup(.)
9: dplyr::select(., "OutputPath", dplyr::starts_with("Parameter"), 
       dplyr::starts_with("PK"), Unit, PercentChangePK, dplyr::everything(), 
       -c("IndividualId"))
8: dplyr::arrange(., ParameterPath, PKParameter, ParameterFactor)
7: purrr::map_dfr(.x = simulationResults, .f = ~pkAnalysesToDataFrame(calculatePKAnalyses(.x)), 
       .id = "ParameterFactor") %>% dplyr::rename(OutputPath = QuantityPath, 
       PKParameter = Parameter, PKParameterValue = Value) %>% .addParameterColumns(simulationResults, 
       parameterPath) %>% dplyr::group_by(ParameterPath, PKParameter) %>% 
       dplyr::group_modify(.f = ~.computePercentChange(.)) %>% dplyr::ungroup() %>% 
       dplyr::select("OutputPath", dplyr::starts_with("Parameter"), 
           dplyr::starts_with("PK"), Unit, PercentChangePK, dplyr::everything(), 
           -c("IndividualId")) %>% dplyr::arrange(ParameterPath, 
       PKParameter, ParameterFactor) at utilities-sensitivity-calculation.R#75
6: .simulationResultsToPKDataFrame(.x, .y)
5: .f(.x[[1L]], .y[[1L]], ...)
4: map2(.x, .y, .f, ...)
3: purrr::map2_dfr(.x = simulationResultsBatch, .y = parameterPaths, 
       .f = ~.simulationResultsToPKDataFrame(.x, .y)) at utilities-sensitivity-calculation.R#61
2: .simulationResultsBatchToPKDataFrame(simulationResultsBatch, 
       parameterPaths) at sensitivity-calculation.R#194
1: sensitivityCalculation(simulation = simulation, outputPaths = outputPaths, 
       parameterPaths = parameterPaths)
IndrajeetPatil commented 2 years ago

I am guessing this commit introduced some change that affected esqlabsR.