Skip to contents

The function receives an object of simulation results generated by running the simulation and returns time-values profiles for the chosen quantities. Results of a simulation of a single individual is treated as a population simulation with only one individual.

Usage

getOutputValues(
  simulationResults,
  quantitiesOrPaths = NULL,
  population = NULL,
  individualIds = NULL,
  stopIfNotFound = TRUE,
  addMetaData = TRUE
)

Arguments

simulationResults

Object of type SimulationResults produced by calling runSimulation on a Simulation object.

quantitiesOrPaths

Quantity instances (element or vector) typically retrieved using getAllQuantitiesMatching or quantity path (element or vector of strings) for which the results are to be returned. (optional) When providing the paths, only absolute full paths are supported (i.e., no matching with '*' possible). If quantitiesOrPaths is NULL (default value), returns the results for all output defined in the results.

population

population used to calculate the simulationResults (optional). This is used only to add the population covariates to the resulting data table.

individualIds

numeric IDs of individuals for which the results should be extracted. By default, all individuals from the results are considered. If the individual with the provided ID is not found, the ID is ignored.

stopIfNotFound

If TRUE (default) an error is thrown if no results exist for any path. If FALSE, a list of NA values is returned for the respective path.

addMetaData

If TRUE (default), the output is a list two sublists dataand metaData, with latter storing information about units and dimensions of the outputs. If FALSE, metaData is NULL. Setting this option to FALSE might improve the performance of the function.

Value

Returns the simulated values for the selected outputs (e.g molecules or parameters).

Examples

library(ospsuite)

simPath <- system.file("extdata", "simple.pkml", package = "ospsuite")
sim <- loadSimulation(simPath)

# Running an individual simulation
# results is an instance of `SimulationResults`
results <- runSimulation(sim)

getOutputValues(results)
#> $data
#>    IndividualId Time Organism|Liver|A Organism|Liver|B Organism|A Organism|B
#> 1             0    0        30.000000         5.000000  40.000000   10.00000
#> 2             0   15        25.820301         9.179699  34.427067   15.57293
#> 3             0   30        22.223164        12.776835  29.630886   20.36911
#> 4             0   45        19.129129        15.870872  25.505505   24.49450
#> 5             0   60        16.467295        18.532705  21.956394   28.04361
#> 6             0   75        14.176212        20.823788  18.901617   31.09838
#> 7             0   90        12.203826        22.796175  16.271769   33.72823
#> 8             0  105        10.505752        24.494247  14.007668   35.99233
#> 9             0  120         9.043887        25.956112  12.058517   37.94148
#> 10            0  135         7.785418        27.214582  10.380558   39.61944
#> 11            0  150         6.702065        28.297935   8.936086   41.06392
#> 12            0  165         5.769464        29.230536   7.692618   42.30738
#> 13            0  180         4.966637        30.033363   6.622183   43.37782
#> 14            0  195         4.275526        30.724474   5.700700   44.29930
#> 15            0  210         3.680582        31.319418   4.907443   45.09256
#> 16            0  225         3.168425        31.831575   4.224566   45.77543
#> 17            0  240         2.727535        32.272465   3.636713   46.36329
#> 18            0  255         2.347995        32.652004   3.130660   46.86934
#> 19            0  270         2.021268        32.978733   2.695024   47.30498
#> 20            0  285         1.740006        33.259995   2.320008   47.67999
#> 21            0  300         1.497881        33.502117   1.997175   48.00282
#> 
#> $metaData
#> $metaData$`Organism|Liver|A`
#> $metaData$`Organism|Liver|A`$unit
#> [1] "µmol"
#> 
#> $metaData$`Organism|Liver|A`$dimension
#> [1] "Amount"
#> 
#> 
#> $metaData$`Organism|Liver|B`
#> $metaData$`Organism|Liver|B`$unit
#> [1] "µmol"
#> 
#> $metaData$`Organism|Liver|B`$dimension
#> [1] "Amount"
#> 
#> 
#> $metaData$`Organism|A`
#> $metaData$`Organism|A`$unit
#> [1] "µmol"
#> 
#> $metaData$`Organism|A`$dimension
#> [1] "Amount"
#> 
#> 
#> $metaData$`Organism|B`
#> $metaData$`Organism|B`$unit
#> [1] "µmol"
#> 
#> $metaData$`Organism|B`$dimension
#> [1] "Amount"
#> 
#> 
#> $metaData$Time
#> $metaData$Time$unit
#> [1] "min"
#> 
#> $metaData$Time$dimension
#> [1] "Time"
#> 
#> 
#>