| Title: | R package to manipulate OSPSuite Models |
|---|---|
| Description: | The ospsuite-R package provides the functionality of loading, manipulating, and simulating the simulations created in the Open Systems Pharmacology Software tools PK-Sim and MoBi. |
| Authors: | Open-Systems-Pharmacology Community [cph, fnd], Michael Sevestre [aut, cre], Pavel Balazki [aut], Juri Solodenko [aut] (ORCID: <https://orcid.org/0000-0001-6922-588X>), Indrajeet Patil [aut] (ORCID: <https://orcid.org/0000-0003-1995-6531>, Twitter: @patilindrajeets), Felix MIL [aut] |
| Maintainer: | Michael Sevestre <[email protected]> |
| License: | GPL-2 | file LICENSE |
| Version: | 12.4.3.9015 |
| Built: | 2026-07-15 13:06:48 UTC |
| Source: | https://github.com/Open-Systems-Pharmacology/OSPSuite-R |
Gather files and files from folders to one location
.gatherFiles(...).gatherFiles(...)
... |
character strings of file paths or folder paths |
A temporary directory with all files copied to it
Get SimulationResults from ConcurrentSimulationRunner
.getConcurrentSimulationRunnerResults( results, resultsIdSimulationIdMap, simulationIdSimulationMap, silentMode, stopIfFails ).getConcurrentSimulationRunnerResults( results, resultsIdSimulationIdMap, simulationIdSimulationMap, silentMode, stopIfFails )
results |
.NET object created by |
resultsIdSimulationIdMap |
Map of results ids as keys with values being the ids of simulations the respective batch was created with. The order of IDs is as they were added to the batch. |
simulationIdSimulationMap |
A named list of simulation ids as keys and simulation objects as values to the id of a result |
silentMode |
If |
stopIfFails |
Whether to stop the execution if one of the simulations failed. Default is |
Create a list of SimulationResults-objects from the results of a
ConcurrentSimulationRunner
A named list of SimulationResults objects with the names being the ids of simulations or
simulation-batch values pairs they were produced by
get OSP Dimensions from OSPSuite.Dimensions.xml data
.getOspDimensions(xmlData).getOspDimensions(xmlData)
xmlData |
XML data from |
a list of supported dimensions
get OSP Units from OSPSuite.Dimensions.xml data
.getOspUnits(xmlData).getOspUnits(xmlData)
xmlData |
XML data from |
a list of supported units
Retrieves the display path of the quantity defined by path in the simulation
.getQuantityDisplayPaths(paths, simulation).getQuantityDisplayPaths(paths, simulation)
paths |
A single string or array of paths path relative to the |
simulation |
A |
a display path for each entry in paths
ParameterValue into a list with 2 entries: paths, values.
A 3rd optional entry units will be defined if the parameter addUnits is set to TRUE.
Note: Units are only available for .NET object of type ParameterValueWithUnit
Converts a list of .NET ParameterValue into a list with 2 entries: paths, values.
A 3rd optional entry units will be defined if the parameter addUnits is set to TRUE.
Note: Units are only available for .NET object of type ParameterValueWithUnit
.parameterValueListFrom(netParameterValues, addUnits = FALSE).parameterValueListFrom(netParameterValues, addUnits = FALSE)
netParameterValues |
List of.NET |
addUnits |
If |
A list with 3 sublist: paths, values, and optionally units containing the corresponding values from each parameter value
parse OSPSuite.Dimensions.xml containing dimensions and units
.parseDimensionsXML().parseDimensionsXML()
An XML document
Saves the pK-analyses to csv file
.savePKAnalysesToCSV(pkAnalyses, filePath).savePKAnalysesToCSV(pkAnalyses, filePath)
pkAnalyses |
pK-Analyses to export (typically calculated using |
filePath |
Full path where the pK-Analyses will be saved. |
Saves the population to csv file
.savePopulationToCSV(population, filePath).savePopulationToCSV(population, filePath)
population |
Population to export to csv (typically imported from file using |
filePath |
Full path where the population will be saved. |
csvPath <- system.file("extdata", "pop.csv", package = "ospsuite") # Load the population population <- loadPopulation(csvPath) # Exports the population exportPopulationToCSV(population, tempfile())csvPath <- system.file("extdata", "pop.csv", package = "ospsuite") # Load the population population <- loadPopulation(csvPath) # Exports the population exportPopulationToCSV(population, tempfile())
Saves the simulation results to csv file
.saveResultsToCSV(results, filePath).saveResultsToCSV(results, filePath)
results |
Results to export (typically calculated using |
filePath |
Full path where the results will be saved. |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath) # Add some outputs to the simulation addOutputs("Organism|**|*", sim) # Run the simulation results <- runSimulations(sim)[[1]] # Export the results to csv file exportResultsToCSV(results, tempfile())simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath) # Add some outputs to the simulation addOutputs("Organism|**|*", sim) # Run the simulation results <- runSimulations(sim)[[1]] # Export the results to csv file exportResultsToCSV(results, tempfile())
Saves the simulation analysis results to csv file
.saveSensitivityAnalysisResultsToCSV(results, filePath).saveSensitivityAnalysisResultsToCSV(results, filePath)
results |
Results to export (typically calculated using |
filePath |
Full path where the results will be saved. |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath) # Create a new sensitivity object for the simulation sensitivity <- SensitivityAnalysis$new(sim) # Runs the sensitivity analysis results <- runSensitivityAnalysis(sensitivity) # Export the results to csv file exportSensitivityAnalysisResultsToCSV(results, tempfile())simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath) # Create a new sensitivity object for the simulation sensitivity <- SensitivityAnalysis$new(sim) # Runs the sensitivity analysis results <- runSensitivityAnalysis(sensitivity) # Export the results to csv file exportSensitivityAnalysisResultsToCSV(results, tempfile())
Scale current values of quantities using a factor
.scaleQuantityValues(quantities, factor).scaleQuantityValues(quantities, factor)
quantities |
A single or a list of |
factor |
A numeric value that will be used to scale all quantities |
Either extends or shortens the simulation time to the specified end time. Time points that are later than the specified end time are removed. Intervals that start after the specified end time are removed. Intervals that start before the specified end time are shortened to the specified end time.
.setEndSimulationTime(simulation, endTime).setEndSimulationTime(simulation, endTime)
simulation |
Simulation for which the end time should be set |
endTime |
End time of the simulation in min |
Set values of quantity
.setQuantityValues(quantities, values, units = NULL).setQuantityValues(quantities, values, units = NULL)
quantities |
A single or a list of |
values |
A numeric value that should be assigned to the quantity or a vector of numeric values, if the value of more than one quantity should be changed. Must have the same length as 'quantities'. Alternatively, the value can be a unique number. In that case, the same value will be set in all parameters |
units |
A string or a list of strings defining the units of the
|
Check if quantity can be represented in the unit
.validateHasUnit(quantity, unit).validateHasUnit(quantity, unit)
quantity |
|
unit |
Unit name to check for |
If validations are successful, NULL is returned. Otherwise, error is
signaled.
Adds an interval to the output schema of the simulation
addOutputInterval( simulation, startTime, endTime, resolution, intervalName = NULL )addOutputInterval( simulation, startTime, endTime, resolution, intervalName = NULL )
simulation |
Simulation for which a new interval should be created |
startTime |
Start time of the interval in min |
endTime |
End time of the interval in min |
resolution |
resolution in points/min |
intervalName |
Optional Name of interval. If not specified, a unique name will be assigned. |
Returns the interval created.
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath, addToCache = FALSE, loadFromCache = FALSE) # clears the previous output schema clearOutputIntervals(sim) # Adds a new interval starting at 1h and ending at 10h with a resolution of 10 points per hour addOutputInterval(sim, 1 * 60, 10 * 60, 1 / 6) # Adds another interval starting at 10h and ending at 17h with a resolution of 4 points per hour # and a specified name addOutputInterval(sim, 10 * 60, 17 * 60, 4 / 60, intervalName = "Second Interval")simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath, addToCache = FALSE, loadFromCache = FALSE) # clears the previous output schema clearOutputIntervals(sim) # Adds a new interval starting at 1h and ending at 10h with a resolution of 10 points per hour addOutputInterval(sim, 1 * 60, 10 * 60, 1 / 6) # Adds another interval starting at 10h and ending at 17h with a resolution of 4 points per hour # and a specified name addOutputInterval(sim, 10 * 60, 17 * 60, 4 / 60, intervalName = "Second Interval")
simulation. The quantities
can either be specified using explicit instances or using paths.Adds the quantities as output into the simulation. The quantities
can either be specified using explicit instances or using paths.
addOutputs(quantitiesOrPaths, simulation, stopIfNotFound = TRUE)addOutputs(quantitiesOrPaths, simulation, stopIfNotFound = TRUE)
quantitiesOrPaths |
Quantity instances (element or vector) (typically
retrieved using |
simulation |
Instance of a simulation for which output selection should be updated. |
stopIfNotFound |
Boolean. If |
simPath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite") sim <- loadSimulation(simPath) paths <- c("Organism|VenousBlood|Plasma|Aciclovir", "Organism|ArterialBlood|**|Aciclovir") addOutputs(paths, sim) parameter <- getParameter("Organism|Liver|Volume", sim) addOutputs(parameter, sim)simPath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite") sim <- loadSimulation(simPath) paths <- c("Organism|VenousBlood|Plasma|Aciclovir", "Organism|ArterialBlood|**|Aciclovir") addOutputs(paths, sim) parameter <- getParameter("Organism|Liver|Volume", sim) addOutputs(parameter, sim)
Calculates residuals between observed and predicted values and adds them as
a new column to the provided data frame or data table. The calculation
supports three scaling methods: "log", "linear" (alias "lin"), and
"ratio".
addResidualColumn( pairedData, observed = "yValuesObserved", predicted = "yValuesSimulated", residuals = "residualValues", scaling = "log" )addResidualColumn( pairedData, observed = "yValuesObserved", predicted = "yValuesSimulated", residuals = "residualValues", scaling = "log" )
pairedData |
A |
observed |
A string specifying the column name for observed values.
Default is |
predicted |
A string specifying the column name for predicted
(simulated) values. Default is |
residuals |
A string specifying the name for the new residuals column
to be added. Default is |
scaling |
A character string specifying the scaling method. One of
|
"linear" / "lin": Absolute residuals as
.
"log": Log-scale residuals as
.
Data points where the observed or predicted value is zero or negative
produce undefined logarithms; these are set to NaN and a warning is
issued reporting the number of such points.
"ratio": Ratio of observed to predicted as
.
A warning is issued when predicted values are zero or negative.
The input pairedData with an additional column named according to
the residuals argument. The column carries a "label" attribute
describing how residuals were computed (e.g.
"residuals\nlog(predicted) - log(observed)"), which can be used as a
y-axis label in plots.
Other data-combined:
DataCombined,
calculateResiduals(),
convertUnits()
## Not run: paired <- data.frame( yValuesObserved = c(1, 2, 4), yValuesSimulated = c(1.1, 1.9, 3.8) ) addResidualColumn(paired, scaling = "log") addResidualColumn(paired, scaling = "linear") addResidualColumn(paired, scaling = "ratio") ## End(Not run)## Not run: paired <- data.frame( yValuesObserved = c(1, 2, 4), yValuesSimulated = c(1.1, 1.9, 3.8) ) addResidualColumn(paired, scaling = "log") addResidualColumn(paired, scaling = "linear") addResidualColumn(paired, scaling = "ratio") ## End(Not run)
Adds and returns a User-Defined PK-Parameter to the managed list of PK-Parameters
addUserDefinedPKParameter( name, standardPKParameter, displayName = NULL, displayUnit = NULL )addUserDefinedPKParameter( name, standardPKParameter, displayName = NULL, displayUnit = NULL )
name |
Name of the user defined PK-Parameter |
standardPKParameter |
Defined the standard PK-Parameter to use to perform the calculations |
displayName |
Display Name to use when exporting the values (optional, default value is name) |
displayUnit |
Unit in which the value will be exported |
The newly created UserDefinedPKParameterthat was added to the list of PK-Parameters
# Adds a user defined parameter named MyAuc that will calculate the value of AUC # between t=50 min and t=80min myAUC <- addUserDefinedPKParameter( name = "MyAUC", standardPKParameter = StandardPKParameter$AUC_tEnd ) myAUC$startTime <- 50 myAUC$endTime <- 80 # Adds a user defined parameter named MyCMax that will calculate the value of Cmax # between the 4th and 5th application myCMax <- addUserDefinedPKParameter( name = "MyCMax", standardPKParameter = StandardPKParameter$C_max ) myCMax$startApplicationIndex <- 4 myCMax$endApplicationIndex <- 5# Adds a user defined parameter named MyAuc that will calculate the value of AUC # between t=50 min and t=80min myAUC <- addUserDefinedPKParameter( name = "MyAUC", standardPKParameter = StandardPKParameter$AUC_tEnd ) myAUC$startTime <- 50 myAUC$endTime <- 80 # Adds a user defined parameter named MyCMax that will calculate the value of Cmax # between the 4th and 5th application myCMax <- addUserDefinedPKParameter( name = "MyCMax", standardPKParameter = StandardPKParameter$C_max ) myCMax$startApplicationIndex <- 4 myCMax$endApplicationIndex <- 5
Results of a sensitivity analysis run (either individual or population simulation)
rSharp::NetObject -> DotNetWrapper -> AgingData
individualIdsArray of individual ids (corresponding to the individualId column of the aging table)
parameterPathsArray of parameter paths (corresponding to the ParameterPath column of the aging table)
timesArray of time values (corresponding to the Time column of the aging table)
valuesArray of parameter values (corresponding to the Value column of the aging table)
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()AgingData$new()Initialize a new instance of the class
AgingData$new()
A new OSPSuite.R.Domain.AgingData object.
AgingData$print()Print the object to the console
AgingData$print(...)
...Rest arguments.
OSPSuite platformList all available dimensions in the OSPSuite platform
allAvailableDimensions()allAvailableDimensions()
Returns the names of all available dimensions defined in the OSPSuite
platform.
allAvailableDimensions()allAvailableDimensions()
Returns the name of all pk parameters defined in the system
allPKParameterNames()allPKParameterNames()
pkParameterNames <- allPKParameterNames()pkParameterNames <- allPKParameterNames()
Application representing one instance of an application in a Simulation
rSharp::NetObject -> DotNetWrapper -> Application
startTimeStart time of application instance (Read-Only)
infusionTimeInfusion time of application instance or null if undefined (Read-Only)
drugMassApplied drugmass of the application instance of null if undefined (Read-Only)
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DotNetWrapper$initialize()Application$print()Print the object to the console
Application$print(...)
...Rest arguments.
results.Calculates the pkAnalyses for all output values available in results.
calculatePKAnalyses(results)calculatePKAnalyses(results)
results |
Results of simulation. Typically the |
An instance of SimulationPKAnalyses class.
simPath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite") sim <- loadSimulation(simPath) addOutputs("Organism|VenousBlood|*|Aciclovir", sim) results <- runSimulations(sim)[[1]] pkAnalyses <- calculatePKAnalyses(results)simPath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite") sim <- loadSimulation(simPath) addOutputs("Organism|VenousBlood|*|Aciclovir", sim) results <- runSimulations(sim)[[1]] pkAnalyses <- calculatePKAnalyses(results)
DataCombined
Computes residuals between observed and simulated datasets by interpolating simulated values to observed time points and calculating the difference according to the specified scaling method.
calculateResiduals(dataCombined, scaling, xUnit = NULL, yUnit = NULL)calculateResiduals(dataCombined, scaling, xUnit = NULL, yUnit = NULL)
dataCombined |
A single instance of |
scaling |
A character specifying the scaling method for residual
calculation. Accepted values are |
xUnit, yUnit
|
Target units for |
The function performs the following steps to calculate residuals:
Data Validation and Pairing: For each group in the data, the function pairs observed datasets with simulated datasets. Any unpaired datasets (observed without corresponding simulated or vice versa) are removed.
Unit Harmonization: All datasets are converted to common units
(specified by xUnit and yUnit parameters) to ensure consistent
calculations.
Interpolation: For each observed-simulated pair, the function uses linear interpolation to estimate simulated values at the exact time points where observations exist:
With 2+ simulated points: Linear interpolation via stats::approx()
With 1 simulated point: Direct matching for identical x-values only
With 0 simulated points: All residuals set to NA
Residual Calculation: Residuals are computed based on the scaling method:
Linear scaling ("lin" / "linear"):
Logarithmic scaling ("log"):
Data points where the observed or predicted value is zero or negative
produce undefined logarithms. These residuals are set to NaN and a
warning is emitted reporting the number of such points. The affected
rows are excluded from the returned data frame.
Ratio scaling ("ratio"):
Residuals can only be computed when both observed and simulated data exist for the same group
Interpolation does not extrapolate beyond the range of simulated data (returns NA for observed points outside simulated time range)
NA and NaN residual values are automatically filtered from the output
When multiple observed/simulated datasets exist in a group, all possible pairs are evaluated
A tibble (data frame) containing paired observed-simulated data with calculated residuals. The following columns will be present:
Grouping identifier from the original DataCombined object
Name of the observed dataset
Name of the paired simulated dataset
X-axis values (typically time points) from observed data
Unit of x-values after harmonization
Dimension of x-values (e.g., "Time")
Observed y-values at each x-point
Simulated y-values interpolated to observed x-points
Calculated residuals (method depends on scaling parameter)
Unit of y-values after harmonization
Dimension of y-values (e.g., "Concentration")
Error values from observed data (if available)
Type of error (e.g., "SD", "SE")
Unit of error values
Lower limit of quantification (if available)
Returns NULL with a warning if no pairable datasets are found.
Other data-combined:
DataCombined,
addResidualColumn(),
convertUnits()
calculateResiduals(dataCombinedAciclovir, scaling = "linear")calculateResiduals(dataCombinedAciclovir, scaling = "linear")
Clears the memory used by all underlying objects
clearMemory(clearSimulationsCache = FALSE)clearMemory(clearSimulationsCache = FALSE)
clearSimulationsCache |
optional - Should the simulation cache also be
cleared? Default is |
The function aims at clearing the memory used by object references allocated during some workflows. The memory should typically be freed automatically when the system is under memory pressure or when the garbage collection is kicking in. However, it may be necessary sometimes to explicitly start the garbage collection process.
# This will clear the memory and also clear the simulations cache but leave # the environment intact. clearMemory(clearSimulationsCache = TRUE)# This will clear the memory and also clear the simulations cache but leave # the environment intact. clearMemory(clearSimulationsCache = TRUE)
simulation
Removes all intervals as well as all single time points from the output schema
defined in simulation
clearOutputIntervals(simulation)clearOutputIntervals(simulation)
simulation |
Instance of a simulation for which output intervals should be cleared |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Make sure we create a new simulation so that we do not impact other examples sim <- loadSimulation(simPath, addToCache = FALSE, loadFromCache = FALSE) clearOutputIntervals(sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Make sure we create a new simulation so that we do not impact other examples sim <- loadSimulation(simPath, addToCache = FALSE, loadFromCache = FALSE) clearOutputIntervals(sim)
simulation
Removes all selected output from the given simulation
clearOutputs(simulation)clearOutputs(simulation)
simulation |
Instance of a simulation for which output selection should be cleared. |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath, ) clearOutputs(sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath, ) clearOutputs(sim)
How should comparison of entities be performed
CompareByCompareBy
convertSnapshot() is deprecated and will be removed in a future release.
Use loadProjectFromSnapshot() to convert a snapshot to a project, and
exportProjectToSnapshot() to convert a project to a snapshot.
convertSnapshot(..., format, output = ".", runSimulations = FALSE)convertSnapshot(..., format, output = ".", runSimulations = FALSE)
... |
character strings, path to files or a directory containing files to convert |
format |
character string, target format either "snapshot" or "project". |
output |
character string, path to the output directory where to write the converted files |
runSimulations |
logical, whether to run simulations during conversion (default = FALSE). Only when converting from snapshot to project. |
DataCombined to common unitsWhen multiple (observed and/or simulated) datasets are present in a data frame, they are likely to have different units. This function helps to convert them to a common unit specified by the user.
This is especially helpful while plotting since the quantities from different datasets to be plotted on the X-and Y-axis need to have same units to be meaningfully compared.
convertUnits(dataCombined, xUnit = NULL, yUnit = NULL)convertUnits(dataCombined, xUnit = NULL, yUnit = NULL)
dataCombined |
A single instance of |
xUnit, yUnit
|
Target units for |
A data frame with measurement columns transformed to have common units.
In the returned tibble data frame, the following columns will always be present:
name - group - dataType - xValues - xDimension - xUnit - yValues - yErrorValues - yDimension - yUnit - yErrorType - yErrorUnit - molWeight
Importantly, the xUnit and yUnit columns will have unique entries.
Molecular weight is required for the conversion between certain
dimensions (Amount, Mass, Concentration (molar), and Concentration (mass)). Therefore, if molecular weight is missing for these dimension, the
unit conversion will fail.
Other data-combined:
DataCombined,
addResidualColumn(),
calculateResiduals()
# simulated data simFilePath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite") sim <- loadSimulation(simFilePath) simResults <- runSimulations(sim)[[1]] outputPath <- "Organism|PeripheralVenousBlood|Aciclovir|Plasma (Peripheral Venous Blood)" # observed data obsData <- lapply( c("ObsDataAciclovir_1.pkml", "ObsDataAciclovir_2.pkml", "ObsDataAciclovir_3.pkml"), function(x) loadDataSetFromPKML(system.file("extdata", x, package = "ospsuite")) ) names(obsData) <- lapply(obsData, function(x) x$name) # Create a new instance of `DataCombined` class myDataCombined <- DataCombined$new() # Add simulated results myDataCombined$addSimulationResults( simulationResults = simResults, quantitiesOrPaths = outputPath, groups = "Aciclovir PVB" ) # Add observed data set myDataCombined$addDataSets(obsData$`Vergin 1995.Iv`, groups = "Aciclovir PVB") convertUnits( myDataCombined, xUnit = ospUnits$Time$s, yUnit = ospUnits$`Concentration [mass]`$`µg/l` )# simulated data simFilePath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite") sim <- loadSimulation(simFilePath) simResults <- runSimulations(sim)[[1]] outputPath <- "Organism|PeripheralVenousBlood|Aciclovir|Plasma (Peripheral Venous Blood)" # observed data obsData <- lapply( c("ObsDataAciclovir_1.pkml", "ObsDataAciclovir_2.pkml", "ObsDataAciclovir_3.pkml"), function(x) loadDataSetFromPKML(system.file("extdata", x, package = "ospsuite")) ) names(obsData) <- lapply(obsData, function(x) x$name) # Create a new instance of `DataCombined` class myDataCombined <- DataCombined$new() # Add simulated results myDataCombined$addSimulationResults( simulationResults = simResults, quantitiesOrPaths = outputPath, groups = "Aciclovir PVB" ) # Add observed data set myDataCombined$addDataSets(obsData$`Vergin 1995.Iv`, groups = "Aciclovir PVB") convertUnits( myDataCombined, xUnit = ospUnits$Time$s, yUnit = ospUnits$`Concentration [mass]`$`µg/l` )
individualCharacteristics
Creates the parameter distributions based on the given individual individualCharacteristics
createDistributions(individualCharacteristics)createDistributions(individualCharacteristics)
individualCharacteristics |
Characteristics of the individual to create as an instance of |
An array of ParameterValue containing the value of each individual parameter
DataImporterConfiguration for an XLS sheetCreate a DataImporterConfiguration for an XLS sheet
createImporterConfigurationForFile(filePath, sheet = NULL)createImporterConfigurationForFile(filePath, sheet = NULL)
filePath |
Path to XLS file |
sheet |
optional - name of the sheet. If no sheet is specified, the first sheet of the XLS file is used. |
The function tries to parse the structure of the excel sheet and
creates a default configuration for this sheet. It is advised to check the
configuration and adjust if necessary before using with loadDataSetsFromExcel().
DataImporterConfiguration object for XLS file to be used in
loadDataSetsFromExcel().
xlsFilePath <- system.file("extdata", "CompiledDataSet.xlsx", package = "ospsuite") # When sheet is specified, it is automatically added to the configuration importerConfiguration <- createImporterConfigurationForFile( xlsFilePath, sheet = "TestSheet_1" ) dataSets <- loadDataSetsFromExcel( xlsFilePath = xlsFilePath, importerConfigurationOrPath = importerConfiguration, importAllSheets = FALSE )xlsFilePath <- system.file("extdata", "CompiledDataSet.xlsx", package = "ospsuite") # When sheet is specified, it is automatically added to the configuration importerConfiguration <- createImporterConfigurationForFile( xlsFilePath, sheet = "TestSheet_1" ) dataSets <- loadDataSetsFromExcel( xlsFilePath = xlsFilePath, importerConfigurationOrPath = importerConfiguration, importAllSheets = FALSE )
Creates a set of parameter values describing an individual using the PK-Sim Database
createIndividual(individualCharacteristics)createIndividual(individualCharacteristics)
individualCharacteristics |
Characteristics of the individual to create
as an instance of |
A list with three entries:
distributedParameters containing the actual parameter values modified by the create individual algorithm.
derivedParameters containing the parameter values modified indirectly by the algorithm. Those parameters are typically formula parameters.
seed containing the seed value used to generate random values
When updating a simulation with the value for a new individual, only
use the distributedParameters to ensure that you do not override formula
parameters.
Create the characteristics of an individual using the PK-Sim Database.
createIndividualCharacteristics( species, population = NULL, gender = NULL, weight = NULL, weightUnit = "kg", height = NULL, heightUnit = "cm", age = NULL, ageUnit = "year(s)", gestationalAge = 40, gestationalAgeUnit = "week(s)", moleculeOntogenies = NULL, seed = NULL )createIndividualCharacteristics( species, population = NULL, gender = NULL, weight = NULL, weightUnit = "kg", height = NULL, heightUnit = "cm", age = NULL, ageUnit = "year(s)", gestationalAge = 40, gestationalAgeUnit = "week(s)", moleculeOntogenies = NULL, seed = NULL )
species |
Species of the individual as defined in PK-Sim (see Species enum) |
population |
Population to use to create the individual. This is required only when the species is Human. (See HumanPopulation enum) |
gender |
Gender to use to create the individual. (See Gender enum) |
weight |
Weight of the created individual |
weightUnit |
Unit in which the weight value is defined. Default is kg |
height |
Height of the created individual (for human species only) |
heightUnit |
Unit in which the height value is defined. Default is cm |
age |
Age of the created individual (for human species only) |
ageUnit |
Unit in which the age value is defined. Default is year(s) |
gestationalAge |
Gestational age of the created individual (for human species only using the Preterm population). Default is 40 Weeks |
gestationalAgeUnit |
Unit in which the gestational age value is defined. Default is week(s) |
moleculeOntogenies |
Optional list of |
seed |
Optional seed parameter to use to generate start values for the created individual algorithm. |
An IndividualCharacteristics object.
Creates an population using the PK-Sim Database
createPopulation(populationCharacteristics)createPopulation(populationCharacteristics)
populationCharacteristics |
Characteristics of the population to create as an instance of |
An list with three entries:
population An instance of a population object.
derivedParameters containing the parameter values modified indirectly by the algorithm. Those parameters are typically formula parameters.
seed containing the seed value used to generate random values
Creates the population characteristics used to create a population
createPopulationCharacteristics( species, population = NULL, numberOfIndividuals, proportionOfFemales = 50, weightMin = NULL, weightMax = NULL, weightUnit = "kg", heightMin = NULL, heightMax = NULL, heightUnit = "cm", ageMin = NULL, ageMax = NULL, ageUnit = "year(s)", BMIMin = NULL, BMIMax = NULL, BMIUnit = "kg/m²", gestationalAgeMin = NULL, gestationalAgeMax = NULL, gestationalAgeUnit = "week(s)", moleculeOntogenies = NULL, seed = NULL )createPopulationCharacteristics( species, population = NULL, numberOfIndividuals, proportionOfFemales = 50, weightMin = NULL, weightMax = NULL, weightUnit = "kg", heightMin = NULL, heightMax = NULL, heightUnit = "cm", ageMin = NULL, ageMax = NULL, ageUnit = "year(s)", BMIMin = NULL, BMIMax = NULL, BMIUnit = "kg/m²", gestationalAgeMin = NULL, gestationalAgeMax = NULL, gestationalAgeUnit = "week(s)", moleculeOntogenies = NULL, seed = NULL )
species |
Species of the individual as defined in PK-Sim (see |
population |
Population to use to create the individual. This is required only when the species is Human. (See |
numberOfIndividuals |
Number of individuals in the population |
proportionOfFemales |
Proportions of females. Default is 50 (50%) |
weightMin |
min weight for the population (optional) |
weightMax |
max weight for the population (optional) |
weightUnit |
Unit in which the weight value is defined. Default is kg |
heightMin |
min height for the population (optional, for human species only) |
heightMax |
max height for the population (optional, for human species only) |
heightUnit |
Unit in which the height value is defined. Default is cm |
ageMin |
min age for the population (optional, for human species only) |
ageMax |
max age for the population (optional, for human species only) |
ageUnit |
Unit in which the age value is defined. Default is year(s) |
BMIMin |
min BMI for the population (optional, for human species only) |
BMIMax |
max BMI for the population (optional, for human species only) |
BMIUnit |
Unit in which the BMI value is defined. Default is kg/m2 |
gestationalAgeMin |
min gestational age for the population (optional, for human species only) |
gestationalAgeMax |
max gestational age for the population (optional, for human species only) |
gestationalAgeUnit |
Unit in which the gestational age value is defined. Default is kg/m2 |
moleculeOntogenies |
Optional list of |
seed |
Optional Seed parameter used to generate random values. This is only useful in order to reproduce the same population |
An instance of PopulationCharacteristics to be used in conjunction with createPopulation
SimulationBatch that can be used to efficiently vary parameters and initial values in a simulationCreates and returns an instance of a SimulationBatch that can be used to efficiently vary parameters and initial values in a simulation
createSimulationBatch( simulation, parametersOrPaths = NULL, moleculesOrPaths = NULL )createSimulationBatch( simulation, parametersOrPaths = NULL, moleculesOrPaths = NULL )
simulation |
Instance of a |
parametersOrPaths |
Parameter instances (element or vector) typically retrieved using
|
moleculesOrPaths |
Molecule instances (element or vector) typically retrieved using
|
SimulationBatch that can be used to vary parameter values or molecule initial values and run simulation in an optimized manner
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Create a simulation batch that will allow batch run for one parameter value simulationBatch <- createSimulationBatch(sim, "Organism|Liver|Volume") # Create a simulation batch that will allow batch run for multiple parameter # values and initial values simulationBatch <- createSimulationBatch( sim, c("Organism|Liver|Volume", "R1|k1"), c("Organism|Liver|A") )simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Create a simulation batch that will allow batch run for one parameter value simulationBatch <- createSimulationBatch(sim, "Organism|Liver|Volume") # Create a simulation batch that will allow batch run for multiple parameter # values and initial values simulationBatch <- createSimulationBatch( sim, c("Organism|Liver|Volume", "R1|k1"), c("Organism|Liver|A") )
Names of aggregation available for plotPopulationTimeProfile()
DataAggregationMethodsDataAggregationMethods
One column defined in a DataRepository
rSharp::NetObject -> DotNetWrapper -> DataColumn
valuesReturns the values defined in the column
nameReturns the name of the column (Read-Only)
unitThe base unit in which the values are defined (Read-Only)
displayUnitThe unit in which the values should be displayed
dimensionThe dimension of the values
molWeightMolecular weight of associated observed data in internal unit
In no molecular weight is defined, the value is NULL
LLOQLower Limit Of Quantification.
In no LLOQ is defined, the value is NULL
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DotNetWrapper$initialize()DataColumn$print()Print the object to the console
DataColumn$print(...)
...Rest arguments.
A class for storing simulated and/or observed in a single data frame, which can be further used in data wrangling or data visualization pipelines.
Additionally, it allows:
Grouping different simulated and/or observed datasets.
Transforming data with given offsets and scale factors.
namesA vector of unique names of datasets contained in the
DataCombined class instance.
groupMapA data frame specifying which datasets have been grouped
together and the name and the nature (observed or simulated?) of the
data. If a dataset was not assigned to any group, this is denoted by
NA in the data frame.
dataTransformationsA data frame with offset and scale factor values were specified by the user for each dataset.
DataCombined$addDataSets()Adds observed data.
DataCombined$addDataSets(dataSets, names = NULL, groups = NULL, silent = FALSE)
dataSetsAn instance (or a list of instances) of the DataSet
class.
namesA string or a list of strings assigning new names. These new
names can be either for renaming DataSet objects, or for renaming
quantities/paths in SimulationResults object. If an entity is not to be
renamed, this can be specified as NULL. E.g., in names = list("oldName1" = "newName1", "oldName2" = NULL)), dataset with name "oldName2" will not
be renamed. The list can either be named or unnamed. Names act as unique
identifiers for data sets in the DataCombined object and, therefore,
duplicate names are not allowed.
groupsA string or a list of strings specifying group name
corresponding to each data set. If an entry within the list is NULL, the
corresponding data set is not assigned to any group (and the corresponding
entry in the group column will be an NA). If provided, groups must
have the same length as dataSets and/or simulationResults$quantityPath.
If no grouping is specified for any of the dataset, the column group in
the data frame output will be all NA.
silentA binary flag showing if warnings should be triggered when
data sets are overwritten in the DataCombined object
DataCombined object containing observed data.
DataCombined$addSimulationResults()Add simulated data using instance of SimulationResults class.
DataCombined$addSimulationResults( simulationResults, quantitiesOrPaths = NULL, population = NULL, individualIds = NULL, names = NULL, groups = NULL, silent = FALSE )
simulationResultsObject of type SimulationResults produced by
calling runSimulations on a Simulation object.
quantitiesOrPathsQuantity 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.
populationpopulation used to calculate the simulationResults
(optional). This is used only to add the population covariates to the
resulting data table.
individualIdsnumeric 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.
namesA string or a list of strings assigning new names. These new
names can be either for renaming DataSet objects, or for renaming
quantities/paths in SimulationResults object. If an entity is not to be
renamed, this can be specified as NULL. E.g., in names = list("oldName1" = "newName1", "oldName2" = NULL)), dataset with name "oldName2" will not
be renamed. The list can either be named or unnamed. Names act as unique
identifiers for data sets in the DataCombined object and, therefore,
duplicate names are not allowed.
groupsA string or a list of strings specifying group name
corresponding to each data set. If an entry within the list is NULL, the
corresponding data set is not assigned to any group (and the corresponding
entry in the group column will be an NA). If provided, groups must
have the same length as dataSets and/or simulationResults$quantityPath.
If no grouping is specified for any of the dataset, the column group in
the data frame output will be all NA.
silentA binary flag showing if warnings should be triggered when
data sets are overwritten in the DataCombined object
DataCombined object containing simulated data.
DataCombined$setGroups()Adds grouping information to (observed and/or simulated) datasets.
DataCombined$setGroups(names, groups)
namesA list of dataset names which need to be grouped. Note that
if you have specified new names while adding datasets (using
$addDataSets() and $addSimulationResults() methods), you will need
to use these new names to specify group assignment. The same dataset
can't be assigned to two different groupings in the same
$setGroups() call. In other words, elements of names argument
should be unique.
groupsA list specifying which datasets belong to which group(s).
Please note that the order in which groups are specified should match
the order in which datasets were specified for names parameter. For
example, if data sets are named "x", "y", "z", and the desired
groupings for them are, respectively, "a", "b", this can be
specified as names = list("x", "y"), groups = list("a", "b").
Datasets for which no grouping is to be specified, can be left out of
the groups argument. The column group in the data frame output will
be NA for such datasets. If you wish to remove an existing grouping
assignment for a given dataset, you can specify it as following:
list("x" = NA) or list("x" = NULL). This will not change any of the
other groupings.
DataCombined object with grouped datasets.
DataCombined$setDataTypes()set the type of data (observed or simulated) for datasets.
DataCombined$setDataTypes(names, dataTypes)
namesa character vector of dataset names which dataTypes need to be changed.
dataTypesa character vector of dataTypes ("observed" or
"simulated") to be assigned to the datasets (in order of names.
DataCombined object with modified dataTypes datasets.
DataCombined$removeGroupAssignment()Remove existing groupings for (observed and/or simulated) datasets.
DataCombined$removeGroupAssignment(names)
namesA list of dataset names whose group assignment needs to be
removed. Note that if you have specified new names while adding
datasets (using $addDataSets() and $addSimulationResults()
methods), you will need to use these new names to specify group
assignment. The elements of names argument should be unique.
DataCombined object with updated group assignments.
DataCombined$setDataTransformations()Transform raw data with required offsets and scale factors.
DataCombined$setDataTransformations( forNames = NULL, xOffsets = 0, yOffsets = 0, xScaleFactors = 1, yScaleFactors = 1, reset = FALSE )
forNamesA list of names specifying which observed datasets and/or
paths in simulated dataset to transform with the specified
transformations. Default is NULL, i.e., the transformations, if any
specified, will be applied to all rows of the data frame.
xOffsets, yOffsets, xScaleFactors, yScaleFactorsEither a single
numeric value or a list of numeric values specifying offsets and
scale factors to apply to raw values. The default offset is 0, while
default scale factor is 1, i.e., the data will not be modified. If a
list is specified, it should be the same length as forNames argument.
resetIF TRUE, only data transformations that are specified will
be retained. Not specified transformations will be reset to their defaults.
Default behavior is FALSE, e.g., setting only xOffsets will not reset
xScaleFactors if those have been set previously.
A data frame with respective raw quantities transformed using specified offset and scale factor values.
For X and Y variables:
newValue = (rawValue + offset) * scaleFactor
For error term:
newErrorValue = rawErrorValue * scaleFactor
DataCombined$toDataFrame()A method to extract a tibble data frame of simulated and/or observed data (depending on instances of which classes have been added to the object).
Note that the order in which you enter different object doesn't matter because the returned data frame is arranged alphabetically by dataset name.
DataCombined$toDataFrame()
In the returned tibble data frame, the following columns will always be present:
name - group - dataType - xValues - xDimension - xUnit - yValues - yErrorValues - yDimension - yUnit - yErrorType - yErrorUnit - molWeight
DataCombined$print()Print the object to the console.
DataCombined$print()
DataCombined$clone()The objects of this class are cloneable with this method.
DataCombined$clone(deep = FALSE)
deepWhether to make a deep clone.
The molecular weight (in molWeight column) is in g/mol units.
Other data-combined:
addResidualColumn(),
calculateResiduals(),
convertUnits()
# simulated data simFilePath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite") sim <- loadSimulation(simFilePath) simResults <- runSimulations(sim)[[1]] outputPath <- "Organism|PeripheralVenousBlood|Aciclovir|Plasma (Peripheral Venous Blood)" # observed data obsData <- lapply( c("ObsDataAciclovir_1.pkml", "ObsDataAciclovir_2.pkml", "ObsDataAciclovir_3.pkml"), function(x) loadDataSetFromPKML(system.file("extdata", x, package = "ospsuite")) ) names(obsData) <- lapply(obsData, function(x) x$name) # Create a new instance of `DataCombined` class myDataCombined <- DataCombined$new() # Add simulated results myDataCombined$addSimulationResults( simulationResults = simResults, quantitiesOrPaths = outputPath, groups = "Aciclovir PVB" ) # Add observed data set myDataCombined$addDataSets(obsData$`Vergin 1995.Iv`, groups = "Aciclovir PVB") # Looking at group mappings myDataCombined$groupMap # Looking at the applied transformations myDataCombined$dataTransformations # Accessing the combined data frame myDataCombined$toDataFrame()# simulated data simFilePath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite") sim <- loadSimulation(simFilePath) simResults <- runSimulations(sim)[[1]] outputPath <- "Organism|PeripheralVenousBlood|Aciclovir|Plasma (Peripheral Venous Blood)" # observed data obsData <- lapply( c("ObsDataAciclovir_1.pkml", "ObsDataAciclovir_2.pkml", "ObsDataAciclovir_3.pkml"), function(x) loadDataSetFromPKML(system.file("extdata", x, package = "ospsuite")) ) names(obsData) <- lapply(obsData, function(x) x$name) # Create a new instance of `DataCombined` class myDataCombined <- DataCombined$new() # Add simulated results myDataCombined$addSimulationResults( simulationResults = simResults, quantitiesOrPaths = outputPath, groups = "Aciclovir PVB" ) # Add observed data set myDataCombined$addDataSets(obsData$`Vergin 1995.Iv`, groups = "Aciclovir PVB") # Looking at group mappings myDataCombined$groupMap # Looking at the applied transformations myDataCombined$dataTransformations # Accessing the combined data frame myDataCombined$toDataFrame()
Example DataCombined object for Aciclovir created from the code chunk below
and that is re-used throughout the package examples and documentation
# simulated data
simFilePath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite")
sim <- loadSimulation(simFilePath)
simResults <- runSimulations(sim)[[1]]
outputPath <- "Organism|PeripheralVenousBlood|Aciclovir|Plasma (Peripheral Venous Blood)"
# observed data
obsData <- lapply(
c("ObsDataAciclovir_1.pkml", "ObsDataAciclovir_2.pkml", "ObsDataAciclovir_3.pkml"),
function(x) loadDataSetFromPKML(system.file("extdata", x, package = "ospsuite"))
)
names(obsData) <- lapply(obsData, function(x) x$name)
# Create a new instance of `DataCombined` class
dataCombinedAciclovir <- DataCombined$new()
# Add simulated results
dataCombinedAciclovir$addSimulationResults(
simulationResults = simResults,
quantitiesOrPaths = outputPath,
groups = "Aciclovir PVB"
)
# Add observed data set
dataCombinedAciclovir$addDataSets(obsData$`Vergin 1995.Iv`, groups = "Aciclovir PVB")
dataCombinedAciclovirdataCombinedAciclovir
dataCombinedAciclovirA DataCombined object with 2 sets
Simulated Aciclovir data
Observed data from Vergin 1995.Iv
Working with DataCombined class
Supported types of the error
DataErrorTypeDataErrorType
Configuration of data import from excel or csv files. To be used with loadDataSetsFromExcel.
rSharp::NetObject -> DotNetWrapper -> DataImporterConfiguration
timeColumnName of the column for time values
timeUnitIf isTimeUnitFromColumn is FALSE, unit of the values
in time column If isTimeUnitFromColumn is TRUE, name of the column
with units of the values in time column.
isTimeUnitFromColumnIf TRUE, units of the values in time column
are defined in the column timeUnit. If FALSE, the unit is defined by
the value of timeUnit.
measurementColumnName of the column for measurement values
lloqColumnName of the column for LLOQ values
If the column name is not set (value NULL), LLOQ values
will be imported from the measurement column if values are written in the form '< xxx' (e.g., '<0.001').
Otherwise, the values will be imported from the specified column
measurementDimensionIf isMeasurementUnitFromColumn is FALSE,
dimension of the values in measurement column If
isMeasurementUnitFromColumn is TRUE, the dimension is guessed from
the unit defined in the column measurementUnit during import process
and $measurementDimension is NULL. When changing dimension, the
unit is set to the base unit of this dimension.
measurementUnitIf isMeasurementUnitFromColumn is FALSE, unit of the values in measurement column
If isMeasurementUnitFromColumn is TRUE, name of the column with units of the values in measurement column
isMeasurementUnitFromColumnIf TRUE, units of the values in measurement column
are defined in the column measurementUnit. If FALSE, the unit is defined by
the value of measurementUnit.
errorColumnName of the column for measurement error values
If no error column is defined, the value is NULL. Setting the value
to NULL removes an existing error column.
errorUnitIf isMeasurementUnitFromColumn is FALSE, unit of the values in the error column
If isMeasurementUnitFromColumn is TRUE, name of the column with units of the values in error column
If no error column is present, the value is NULL
errorTypeType of the measurement error values. See enum DataErrorType
for possible values
If no error column is present, the value is NULL
groupingColumnsColumn names by which the data will be grouped
sheetsNames of the sheets (list of strings) of the excel workbook for which the configuration will be applied.
namingPatternRegular expression used for naming of loaded data sets.
Words between curly brackets (e.g. {Group Id}) will be replaced by the value
in the corresponding column. Further keywords are {Source} for the file name
and {Sheet} for sheet name.
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DataImporterConfiguration$new()Initialize a new instance of the class
DataImporterConfiguration$new(netObject = NULL)
netObjectA NetObject with the reference to .NET DataImporterConfiguration object
If NULL (default), an empty configuration with columns "Time" and
"Measurement" is created.
A new DataImporterConfiguration object.
DataImporterConfiguration$saveConfiguration()Save configuration to a XML file that can be used in PK-Sim/MoBi
DataImporterConfiguration$saveConfiguration(filePath)
filePathPath (incl. file name) to the location where the configuration will be exported to.
DataImporterConfiguration$addGroupingColumn()Add a column for grouping the data sets
DataImporterConfiguration$addGroupingColumn(column)
columnName of the column
DataImporterConfiguration$removeGroupingColumn()Remove a column for grouping the data sets
DataImporterConfiguration$removeGroupingColumn(column)
columnName of the column
DataImporterConfiguration$print()Print the object to the console
DataImporterConfiguration$print(...)
...Rest arguments.
An object typically holding observed data
rSharp::NetObject -> DotNetWrapper -> DataRepository
nameThe name of the object.
baseGridReturns the base column for the data repository (typically time column).
columnsReturns all columns (including baseGrid) defined in the data repository.
allButBaseGridReturns all columns excluding baseGrid defined on the data repository.
metaDataReturns a named list of meta data defined for the data repository. where the name is the name of the metaData and the value is the meta data value.
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DataRepository$addColumn()Adds a column to the data repository
DataRepository$addColumn(column)
columnColumn to add
DataRepository$new()Initialize a new instance of the class
DataRepository$new(netObj = NULL)
netObjOptional NetObject to the pointer of the underlying DataRepository.
If it is not provided, a new instance will be created
A new DataRepository object.
DataRepository$print()Print the object to the console
DataRepository$print(...)
...Rest arguments.
DataRepository$addMetaData()Adds a new entry to meta data list or changes its value if the name is already present.
DataRepository$addMetaData(name, value)
nameName of new meta data list entry
valueValue of new meta data list entry
DataRepository$removeMetaData()Removes the meta data entry in the list if one is defined with this name
DataRepository$removeMetaData(name)
nameName of meta data entry to delete
A class for storage of numerical x- and y-value pairs and optional error for y-values.
rSharp::NetObject -> DotNetWrapper -> DataSet
nameThe name of the DataSet
dataRepositoryThe underlying DataRepository object
xDimensionDimension in which the xValues are defined
xUnitUnit in which the xValues are defined
xValuesValues stored in the xUnit. This field is read-only.
Use $setValues() to change the values.
yDimensionDimension in which the yValues are defined
yUnitUnit in which the yValues are defined
yValuesValues stored in the yUnit. This field is read-only.
Use $setValues() to change the values.
yErrorTypeType of the error - geometric or arithmetic.
When changing from arithmetic to geometric error, the values are
considered in as fraction (1 = 100%).
When changing from geometric to arithmetic, the values are set to the
same unit as yErrorUnit.
In case no yError is defined, the value is NULL and cannot be changed
yErrorUnitUnit in which the yErrorValues are defined. For
arithmetic error, the unit must be valid for yDimension. For
geometric error, the unit must be valid for Dimensionless.
In case no yError is defined, the value is NULL and cannot be changed
yErrorValuesValues of error stored in the yErrorUnit unit. This field is read-only.
Use $setValues() to change the values.
In case no yError is defined, the value is NULL and cannot be changed.
Use $setValues() to change the values.
molWeightMolecular weight of the yValues in g/mol
LLOQLower Limit Of Quantification. Value in yUnit associated with the yValues
metaDataReturns a named list of meta data defined for the data set.
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DataSet$new()Initialize a new instance of the class.
Either create a DataSet from a DataRepository (e.g. loaded from a PKML)
or an empty DataSet. In case of an empty DataSet, a name must be
provided.
DataSet$new(name = NULL, dataRepository = NULL)
nameName of the DataSet if created from scratch (no dataRepository)
provided. Ignored if dataRepository is not NULL.
dataRepositoryInstance of the DataRepository object to wrap.
If NULL, an empty DataRepository is created.
A new DataSet object.
DataSet$addMetaData()Adds a new entry to meta data list or changes its value if the name is already present.
DataSet$addMetaData(name, value)
nameName of new meta data list entry
valueValue of new meta data list entry
DataSet$removeMetaData()Removes the meta data entry in the list if one is defined with this name
DataSet$removeMetaData(name)
nameName of meta data entry to delete
DataSet$setValues()Sets the xValues, yValues, and (optionally) yErrorValues into the dataSet. Note: xValues, yValues and yErrorValues must have the same length
DataSet$setValues(xValues, yValues, yErrorValues = NULL)
xValuesxValues to use
yValuesyValues to use
yErrorValuesOptional error values associated with yValues
DataSet$print()Print the object to the console
DataSet$print(...)
...Rest arguments.
DataSet objects from a data.frame
Creates a list of DataSet objects from a data.frame
dataSetsFromDataFrame(data)dataSetsFromDataFrame(data)
data |
A |
Creates DataSet objects from a data.frame with the same structure
as returned by dataSetToDataFrame(). Each unique value in the name column
results in one DataSet object.
Any columns beyond the standard columns (name, xValues, yValues,
yErrorValues, xDimension, xUnit, yDimension, yUnit, yErrorType,
yErrorUnit, molWeight, lloq) will be added as meta data.
A named list of DataSet objects, named by the name column.
dataSet <- DataSet$new(name = "MyData") dataSet$setValues(xValues = c(1, 2, 3), yValues = c(10, 20, 30)) df <- dataSetToDataFrame(dataSet) dataSets <- dataSetsFromDataFrame(df)dataSet <- DataSet$new(name = "MyData") dataSet$setValues(xValues = c(1, 2, 3), yValues = c(10, 20, 30)) df <- dataSetToDataFrame(dataSet) dataSets <- dataSetsFromDataFrame(df)
DataSet objects to a data.frameConverts a list of DataSet objects to a data.frame
dataSetToDataFrame(dataSets) dataSetToTibble(dataSets, names = NULL)dataSetToDataFrame(dataSets) dataSetToTibble(dataSets, names = NULL)
dataSets |
A list of |
names |
Optional character vector of custom names to assign to the datasets. If provided, must have the same length as the number of DataSet objects. This allows renaming datasets, which is particularly useful when multiple datasets have the same original name. |
DataSet objects as data.frame with columns name, xValues, yValues,
yErrorValues, xDimension, xUnit, yDimension, yUnit, yErrorType, yErrorUnit,
molWeight, lloq, and a column for each meta data that is present in any
DataSet.
# Create datasets with duplicate names ds1 <- DataSet$new(name = "Obs") ds1$setValues(xValues = c(1, 2), yValues = c(10, 20)) ds2 <- DataSet$new(name = "Obs") ds2$setValues(xValues = c(3, 4), yValues = c(30, 40)) # Convert to tibble with custom names tibble_data <- dataSetToTibble(list(ds1, ds2), names = c("Study1", "Study2")) unique(tibble_data$name) # Returns c("Study1", "Study2")# Create datasets with duplicate names ds1 <- DataSet$new(name = "Obs") ds1$setValues(xValues = c(1, 2), yValues = c(10, 20)) ds2 <- DataSet$new(name = "Obs") ds2$setValues(xValues = c(3, 4), yValues = c(30, 40)) # Convert to tibble with custom names tibble_data <- dataSetToTibble(list(ds1, ds2), names = c("Study1", "Study2")) unique(tibble_data$name) # Returns c("Study1", "Study2")
R6 configuration class defining aesthetic properties of plots that can be
created with plotIndividualTimeProfile(), plotPopulationTimeProfile(),
plotObservedVsSimulated(), and plotResidualsVsTime().
To interactively explore various aesthetic properties and appearance of plots
with these properties, you can use the Shiny app from {tlf} package.
The following sections provide more details on how to customize it further.
Aesthetic mappings describe how groups are mapped to visual properties (color, shape, size, etc.) of the geometries included in the plot (e.g. point, line, ribbon, etc.).
The supported values for each property can be seen using {tlf} lists:
color, fill: tlf::ColorMaps
shape: tlf::Shapes
legend position: tlf::LegendPositions
alignments: tlf::Alignments
linetype: tlf::Linetypes
For example, all parameters related to color (titleColor,
yAxisLabelTicksColor, etc.) accept any of the palettes available in
tlf::ColorMaps (e.g. tlf::ColorMaps$ospDefault).
Note that these are named lists, and, therefore, if you want to assign a specific element from a list to an object's public field, you will have to extract that element first.
For example, if you want to specify that the legend position should be outside the plot to the left and at bottom, you will have to do the following:
myPlotConfiguration <- DefaultPlotConfiguration$new() myPlotConfiguration$legendPosition <- tlf::LegendPositions$outsideBottomLeft
Of course, the extracted element doesn't have to be a single value, and can also be an atomic vector. For example, if you want to assign a different line type to each group in a profile plot, you will have to assign a vector of line types.
myPlotConfiguration <- DefaultPlotConfiguration$new() myPlotConfiguration$linesLinetype <- names(tlf::Linetypes)
If there are more number of elements in the vector than the number of groups, the additional elements will be ignored.
The available units for x-and y-axes depend on the dimensions of these
quantities (ospsuite::ospDimensions). Supported units can be seen with
ospsuite::ospUnits.
A font is a particular set of glyphs (character shapes), differentiated from other fonts in the same family by additional properties such as stroke weight, slant, relative width, etc.
A font face (aka typeface) is the design of lettering, characterized by
variations in size, weight (e.g. bold), slope (e.g. italic), width (e.g.
condensed), and so on. The available font faces can seen using
tlf::FontFaces list.
A font family is a grouping of fonts defined by shared design styles.
The available font families will depend on which fonts have been installed on your computer. This information can be extracted by running the following code:
# install.packages("systemfonts")
library(systemfonts)
system_fonts()
Transformations for both x- and y-axes can be (independently) specified. The default is linear for both axes.
The available transformations can be seen in the tlf::Scaling list.
tlf::TickLabelTransforms lists of all available tick label transformations.
For example, selecting tlf::TickLabelTransforms$identity will display tick
labels as they are, while selecting tlf::TickLabelTransforms$log will
display tick labels in logarithmic scale format.
By default, the plots will be shown in plot pane of your IDE, but the plots
can also be saved to a file using the ggplot2::ggsave() function.
myPlot <- plotIndividualTimeProfile(myDataComb, myPC) ggplot2::ggsave(filename = "plot_1.png", plot = myPlot)
xUnit, yUnitUnits for quantities plotted on x- and y-axes, respectively.
title, subtitle, caption, xLabel, yLabel, legendTitle, watermarkA character string providing plot annotations for plot title, subtitle, caption, x-axis label, y-axis label, plot legend, watermark, respectively.
titleColor, titleSize, titleFontFace, titleFontFamily, titleAngle, titleAlign, titleMarginAesthetic properties for the plot title.
subtitleColor, subtitleSize, subtitleFontFace, subtitleFontFamily, subtitleAngle, subtitleAlign, subtitleMarginAesthetic properties for the plot subtitle.
captionColor, captionSize, captionFontFace, captionFontFamily, captionAngle, captionAlign, captionMarginAesthetic properties for the plot caption.
xLabelColor, xLabelSize, xLabelFontFace, xLabelFontFamily, xLabelAngle, xLabelAlign, xLabelMarginAesthetic properties for the plot xLabel.
yLabelColor, yLabelSize, yLabelFontFace, yLabelFontFamily, yLabelAngle, yLabelAlign, yLabelMarginAesthetic properties for the plot yLabel.
legendPositionA character string defining the legend position.
Available options can be seen using tlf::LegendPositions list.
legendTitleSize, legendTitleColor, legendTitleFontFamily, legendTitleFontFace, legendTitleAngle, legendTitleAlign, legendTitleMarginAesthetic properties for the legend title.
legendKeysSize, legendKeysColor, legendKeysFontFamily, legendKeysFontFace, legendKeysAngle, legendKeysAlign, legendKeysMarginAesthetic properties for the legend caption.
legendBackgroundColor, legendBackgroundAlpha, legendBorderColor, legendBorderType, legendBorderSizeAesthetic properties for the legend box
xAxisTicksLabels, xAxisLabelTicksSize, xAxisLabelTicksColor, xAxisLabelTicksFontFamily, xAxisLabelTicksFontFace, xAxisLabelTicksAngle, xAxisLabelTicksAlign, xAxisLabelTicksMargin, xAxisExpandAesthetic properties for the x-axis label.
yAxisTicksLabels, yAxisLabelTicksSize, yAxisLabelTicksColor, yAxisLabelTicksFontFamily, yAxisLabelTicksFontFace, yAxisLabelTicksAngle, yAxisLabelTicksAlign, yAxisLabelTicksMargin, yAxisExpandAesthetic properties for the y-axis label.
xAxisLimits, yAxisLimitsA numeric vector of axis limits for the x-and y-axis, respectively. This will preserve all data points but zoom in the plot.
xValuesLimits, yValuesLimitsA numeric vector of values limits for the x-and y-axis, respectively. This will filter out the data points outside the specified ranges before plotting.
xAxisTicks, yAxisTicksA numeric vector or a function defining where to position x-and y-axis ticks, respectively.
xAxisScale, yAxisScaleA character string defining axis scale.
Available options can be seen using tlf::Scaling list.
watermarkSize, watermarkColor, watermarkFontFamily, watermarkFontFace, watermarkAngle, watermarkAlign, watermarkMarginA character string specifying the aesthetic properties for the watermark.
plotBackgroundFill, plotBackgroundColor, plotBackgroundSize, plotBackgroundLinetypeA character string specifying the aesthetic properties for the plot background.
plotPanelBackgroundFill, plotPanelBackgroundColor, plotPanelBackgroundSize, plotPanelBackgroundLinetypeA character string specifying the aesthetic properties for the plot panel (inside of plot) background.
xAxisColor, xAxisSize, xAxisLinetypeA character string specifying the aesthetic properties for the x-axis.
yAxisColor, yAxisSize, yAxisLinetypeA character string specifying the aesthetic properties for the y-axis.
xGridColor, xGridSize, xGridLinetypeA character string specifying the aesthetic properties for the x-axis grid.
yGridColor, yGridSize, yGridLinetypeA character string specifying the aesthetic properties for the y-axis grid.
linesColor, linesSize, linesLinetype, linesAlphaA selection key or values for choice of color, fill, shape, size, linetype, alpha, respectively, for lines.
pointsColor, pointsShape, pointsSize, pointsAlphaA selection key or values for choice of color, fill, shape, size, linetype, alpha, respectively, for points.
ribbonsFill, ribbonsSize, ribbonsLinetype, ribbonsAlphaA selection key or values for choice of color, fill, shape, size, linetype, alpha, respectively, for ribbons.
errorbarsSize, errorbarsLinetype, errorbarsAlpha, errorbarsCapSizeA selection key or values for choice of color, fill, shape, size, linetype, alpha, cap width/height, respectively, for error bars.
displayLLOQA Boolean controlling display Lower Limit of Quantification lines. Default to True.
lloqDirectionA string controlling how the LLOQ lines are plotted. Can be "vertical", "horizontal" or "both". Default to NULL to respect specific plot configurations.
foldLinesLegendA Boolean controlling the drawing of the fold lines in the legend. Default to False.
foldLinesLegendDiagonalA Boolean controlling whether the fold lines legend should be horizontal or diagonal lines.
DefaultPlotConfiguration$clone()The objects of this class are cloneable with this method.
DefaultPlotConfiguration$clone(deep = FALSE)
deepWhether to make a deep clone.
Other plotting:
plotIndividualTimeProfile(),
plotObservedVsSimulated(),
plotPopulationTimeProfile(),
plotResidualsVsSimulated(),
plotResidualsVsTime()
# Create a new instance of this class myPlotConfiguration <- DefaultPlotConfiguration$new() # Change defaults myPlotConfiguration$title <- "My Plot Title" myPlotConfiguration$pointsSize <- 2.5 myPlotConfiguration$legendTitle <- "My Legend Title" # Checking new values myPlotConfiguration$pointsSize # To check all default values, you can print the object myPlotConfiguration# Create a new instance of this class myPlotConfiguration <- DefaultPlotConfiguration$new() # Change defaults myPlotConfiguration$title <- "My Plot Title" myPlotConfiguration$pointsSize <- 2.5 myPlotConfiguration$legendTitle <- "My Legend Title" # Checking new values myPlotConfiguration$pointsSize # To check all default values, you can print the object myPlotConfiguration
.NET objectsWrapper class for .NET objects
rSharp::NetObject -> DotNetWrapper
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$print()rSharp::NetObject$set()DotNetWrapper$new()Initialize a new instance of the class
DotNetWrapper$new(netObject)
netObjectAn rSharp::NetObject object.
A new Molecule object.
sim <- loadSimulation(system.file("extdata", "simple.pkml", package = "ospsuite")) # looking at a reference to `.NET` simulation object sim$pointer # create a new instance of `DotNetWrapper` class using this reference DotNetWrapper$new(sim)sim <- loadSimulation(system.file("extdata", "simple.pkml", package = "ospsuite")) # looking at a reference to `.NET` simulation object sim$pointer # create a new instance of `DotNetWrapper` class using this reference DotNetWrapper$new(sim)
Abstract wrapper for an OSPSuite.Core Entity class
rSharp::NetObject -> DotNetWrapper -> ObjectBase -> Entity
pathThe path of the entity in the container hierarchy without the simulation name. (read-only)
fullPathSame as path, but with the simulation name. (read-only)
parentContainerReturns a new wrapper instance to the .NET parent container. Multiple call to this method
will always return the same instance. However two children of the same parent will return two different instances of Container
pointing to the same .NET container
individualIds. Each pkml file will contain the original simulation updated with parameters of the corresponding individual.Export simulation PKMLs for given individualIds. Each pkml file will contain the original simulation updated with parameters of the corresponding individual.
exportIndividualSimulations( population, individualIds, outputFolder, simulation )exportIndividualSimulations( population, individualIds, outputFolder, simulation )
population |
A population object typically loaded with |
individualIds |
Ids of individual (single value or array) to export |
outputFolder |
Folder where the individual simulations will be exported. File format will be |
simulation |
Simulation uses to generate PKML files |
An array containing the path of all exported simulations.
simPath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite") sim <- loadSimulation(simPath) popPath <- system.file("extdata", "pop.csv", package = "ospsuite") population <- loadPopulation(popPath) exportIndividualSimulations(population, c(1, 2), tempdir(), sim)simPath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite") sim <- loadSimulation(simPath) popPath <- system.file("extdata", "pop.csv", package = "ospsuite") population <- loadPopulation(popPath) exportIndividualSimulations(population, c(1, 2), tempdir(), sim)
Saves the pK-analyses to csv file
exportPKAnalysesToCSV(pkAnalyses, filePath)exportPKAnalysesToCSV(pkAnalyses, filePath)
pkAnalyses |
pK-Analyses to export (typically calculated using |
filePath |
Full path where the pK-Analyses will be saved. |
Saves the population to csv file
exportPopulationToCSV(population, filePath)exportPopulationToCSV(population, filePath)
population |
Population to export to csv (typically imported from file using |
filePath |
Full path where the population will be saved. |
csvPath <- system.file("extdata", "pop.csv", package = "ospsuite") # Load the population population <- loadPopulation(csvPath) # Exports the population exportPopulationToCSV(population, tempfile())csvPath <- system.file("extdata", "pop.csv", package = "ospsuite") # Load the population population <- loadPopulation(csvPath) # Exports the population exportPopulationToCSV(population, tempfile())
Converts one or more project files into snapshot files (.json) and writes
them to an output directory.
Only PK-Sim projects (.pksim5) are supported for now. Support for MoBi
projects is planned.
exportProjectToSnapshot(..., output = ".")exportProjectToSnapshot(..., output = ".")
... |
character strings, path to project files ( |
output |
character string, path to the output directory where to write the converted snapshot files. |
## Not run: exportProjectToSnapshot("path/to/project.pksim5", output = "path/to/output") ## End(Not run)## Not run: exportProjectToSnapshot("path/to/project.pksim5", output = "path/to/output") ## End(Not run)
Saves the simulation results to csv file
exportResultsToCSV(results, filePath)exportResultsToCSV(results, filePath)
results |
Results to export (typically calculated using |
filePath |
Full path where the results will be saved. |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath) # Add some outputs to the simulation addOutputs("Organism|**|*", sim) # Run the simulation results <- runSimulations(sim)[[1]] # Export the results to csv file exportResultsToCSV(results, tempfile())simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath) # Add some outputs to the simulation addOutputs("Organism|**|*", sim) # Run the simulation results <- runSimulations(sim)[[1]] # Export the results to csv file exportResultsToCSV(results, tempfile())
Saves the simulation analysis results to csv file
exportSensitivityAnalysisResultsToCSV(results, filePath)exportSensitivityAnalysisResultsToCSV(results, filePath)
results |
Results to export (typically calculated using |
filePath |
Full path where the results will be saved. |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath) # Create a new sensitivity object for the simulation sensitivity <- SensitivityAnalysis$new(sim) # Runs the sensitivity analysis results <- runSensitivityAnalysis(sensitivity) # Export the results to csv file exportSensitivityAnalysisResultsToCSV(results, tempfile())simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath) # Create a new sensitivity object for the simulation sensitivity <- SensitivityAnalysis$new(sim) # Runs the sensitivity analysis results <- runSensitivityAnalysis(sensitivity) # Export the results to csv file exportSensitivityAnalysisResultsToCSV(results, tempfile())
Export steady-state to Excel in the format that can be imported in MoBi.
exportSteadyStateToXLS( simulation, quantitiesPaths = NULL, resultsXLSPath = "", steadyStateTime = NULL, ignoreIfFormula = TRUE, lowerThreshold = 1e-15, simulationRunOptions = NULL )exportSteadyStateToXLS( simulation, quantitiesPaths = NULL, resultsXLSPath = "", steadyStateTime = NULL, ignoreIfFormula = TRUE, lowerThreshold = 1e-15, simulationRunOptions = NULL )
simulation |
A |
quantitiesPaths |
List of quantity paths (molecules and/or parameters)
for which the steady-state will be simulated. If |
resultsXLSPath |
Path to the xls-file where the results will be written
to. If the file does not exist, a new file is created. If no path is
provided, the file will be created in the same directory where the model
file is located. The name of the file will be |
steadyStateTime |
Simulation time (minutes). In |
ignoreIfFormula |
If |
lowerThreshold |
Numerical value (in default unit of the output).
Any steady-state values with absolute value below this threshold are considered
as numerical noise and replaced by 0 (i.e., values in the interval
|
simulationRunOptions |
Optional instance of a |
Simulates a given model to its steady-state and creates an Excel-file with the end values of molecules amounts in all containers and parameter values that have a right-hand-side (state variable parameters). The excel file contains two sheets - one for the molecules and one for the parameters.
An openxlsx workbook object.
A formula of the model (Typically related to a Quantity such as a parameter)
A table formula of the model (Typically related to a Quantity such as a parameter)
rSharp::NetObject -> DotNetWrapper -> ObjectBase -> Formula
isTableIs this a table formula (Read-Only)
isTableWithOffSetIs this a table formula with Offset (Read-Only)
isTableWithXArgumentIs this a table formula with xArgs (typically time, or pH) (Read-Only)
isConstantIs this a constant formula (Read-Only)
isExplicitIs this an explicit formula (Read-Only)
isDistributedIs this a distributed formula (Read-Only)
dimensionThe dimension in which the quantity is defined (Read-Only)
formulaStringReturns the formula as a string for an ExplicitFormula or NULL otherwise (Read-Only).
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DotNetWrapper$initialize()Formula$print()Print the object to the console
Formula$print(...)
...Rest arguments.
Formula$printFormula()Print the formula to the console without the name of the class
Formula$printFormula()
rSharp::NetObject -> DotNetWrapper -> ObjectBase -> Formula -> TableFormula
allPointsReturns all points defined in the table formula for a TableFormula or NULL otherwise (Read-Only).
useDerivedValuesIndicates whether table values should be derived during solving. the ODE system. Default value is TRUE
xDimensionThe dimension in which the x values are defined (Read-Only).
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DotNetWrapper$initialize()TableFormula$addPoints()Adds one or more points to a table
TableFormula$addPoints(xValues, yValues)
xValuesx values (single value or array) in base unit for XDimension
yValuesy values (single value or array) in base unit for Dimension
TableFormula$removePoint()Remove the point having the same x and y from the table
TableFormula$removePoint(xValue, yValue)
xValuexValue value in base unit for XDimension
yValueyValue value in base unit for Dimension
TableFormula$clearPoints()Remove all points from the table
TableFormula$clearPoints()
TableFormula$setPoints()Replace all points defined in the table with the new values given.
This is a convenience method for calling clearPoints and addPoints
TableFormula$setPoints(xValues, yValues)
xValuesx values (single value or array) in base unit for XDimension
yValuesy values (single value or array) in base unit for Dimension
TableFormula$print()Print the object to the console
TableFormula$print(...)
...Rest arguments.
TableFormula$valueAt()Returns the y defined for the x value in base unit. If not exact match is found, value will be interpolated between two existing points If the table contains no point, 0 is returned
TableFormula$valueAt(xValue)
xValuex value for in base unit for which the yValue should be returned
TableFormula$printFormula()Print the formula to the console
TableFormula$printFormula()
Retrieves the path of all containers defined in the container and all its children
getAllContainerPathsIn(container)getAllContainerPathsIn(container)
container |
A Container or Simulation used to find the parameters |
An array with one entry per container defined in the container
loadSimulation(), getContainer() and getAllContainersMatching() to retrieve objects of type Container or Simulation
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Returns the path of all molecules defined in the simulation moleculePaths <- getAllContainerPathsIn(sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Returns the path of all molecules defined in the simulation moleculePaths <- getAllContainerPathsIn(sim)
Retrieve all sub containers of a parent container (simulation or container instance) matching the given path criteria
getAllContainersMatching(paths, container)getAllContainersMatching(paths, container)
paths |
A vector of strings representing the paths relative to the |
container |
A Container or Simulation used to find the containers |
A list of containers matching the path criteria. The list is empty if no containers matching were found.
loadSimulation() and getContainer() to create objects of type Container or Simulation
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Return all `Intracellular` containers defined in all direct containers of the organism containers <- getAllContainersMatching("Organism|*|Intracellular", sim) # Return all `Intracellular` containers defined in all direct containers of the organism # and the container "Interstitial" under 'Organism|Brain' paths <- c("Organism|*|Intracellular", "Organism|Brain|Interstitial") containers <- getAllContainersMatching(paths, sim) # Returns all `Intracellular` containers defined in `Organism` and all its subcontainers containers <- getAllContainersMatching("Organism|**|Intracellular", sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Return all `Intracellular` containers defined in all direct containers of the organism containers <- getAllContainersMatching("Organism|*|Intracellular", sim) # Return all `Intracellular` containers defined in all direct containers of the organism # and the container "Interstitial" under 'Organism|Brain' paths <- c("Organism|*|Intracellular", "Organism|Brain|Interstitial") containers <- getAllContainersMatching(paths, sim) # Returns all `Intracellular` containers defined in `Organism` and all its subcontainers containers <- getAllContainersMatching("Organism|**|Intracellular", sim)
Retrieves the paths of all molecules defined in the container and all its children
getAllMoleculePathsIn(container)getAllMoleculePathsIn(container)
container |
A Container or Simulation used to find the parameters |
An array with one entry per molecule defined in the container
loadSimulation(), getContainer() and getAllContainersMatching() to retrieve objects of type Container or Simulation
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Returns the path of all molecules defined in the simulation moleculePaths <- getAllMoleculePathsIn(sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Returns the path of all molecules defined in the simulation moleculePaths <- getAllMoleculePathsIn(sim)
Retrieve all molecules of a container (simulation or container instance) matching the given path criteria
getAllMoleculesMatching(paths, container)getAllMoleculesMatching(paths, container)
paths |
A vector of strings representing the paths relative to the |
container |
A Container or Simulation used to find the molecules |
A list of molecules matching the path criteria. The list is empty if no molecules matching were found.
loadSimulation(), getContainer() and getAllContainersMatching() to retrieve objects of type Container or Simulation
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Return all `A` molecules defined in all direct containers of the organism molecules <- getAllMoleculesMatching("Organism|*|A", sim) # Return all `A` molecules defined in all direct containers of the organism # and the molecule `B`` of the container 'Liver' paths <- c("Organism|*|A", "Organism|Liver|B") molecules <- getAllMoleculesMatching(paths, sim) # Returns all `A` molecules defined in `Organism` and all its subcontainers molecules <- getAllMoleculesMatching("Organism|**|A", sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Return all `A` molecules defined in all direct containers of the organism molecules <- getAllMoleculesMatching("Organism|*|A", sim) # Return all `A` molecules defined in all direct containers of the organism # and the molecule `B`` of the container 'Liver' paths <- c("Organism|*|A", "Organism|Liver|B") molecules <- getAllMoleculesMatching(paths, sim) # Returns all `A` molecules defined in `Organism` and all its subcontainers molecules <- getAllMoleculesMatching("Organism|**|A", sim)
Retrieves the path of all observers defined in the container and all its children
getAllObserverPathsIn(container)getAllObserverPathsIn(container)
container |
A Container or Simulation used to find the observers |
An array with one entry per observer defined in the container
loadSimulation(), getContainer() and getAllContainersMatching() to retrieve objects of type Container or Simulation
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Returns the path of all quantities defined in the simulation observerPaths <- getAllObserverPathsIn(sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Returns the path of all quantities defined in the simulation observerPaths <- getAllObserverPathsIn(sim)
Retrieves the path of all parameters defined in the container and all its children
getAllParameterPathsIn(container)getAllParameterPathsIn(container)
container |
A Container or Simulation used to find the parameters |
An array with one entry per parameter defined in the container
loadSimulation(), getContainer() and getAllContainersMatching() to retrieve objects of type Container or Simulation
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Returns the path of all quantities defined in the simulation parameterPaths <- getAllParameterPathsIn(sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Returns the path of all quantities defined in the simulation parameterPaths <- getAllParameterPathsIn(sim)
Retrieve all parameters of the given simulation matching the given path criteria and also potential candidate for sensitivity variation
getAllParametersForSensitivityAnalysisMatching(paths, simulation)getAllParametersForSensitivityAnalysisMatching(paths, simulation)
paths |
A vector of strings representing the path of the parameters (potentially using wildcards) |
simulation |
Simulation used to find the parameters |
A list of parameters matching the path criteria and also candidates for a sensitivity analysis. The list is empty if no parameters matching were found.
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Return all `Volume` parameters defined in all direct containers of the organism params <- getAllParametersForSensitivityAnalysisMatching("Organism|*|Volume", sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Return all `Volume` parameters defined in all direct containers of the organism params <- getAllParametersForSensitivityAnalysisMatching("Organism|*|Volume", sim)
Retrieve all parameters of a container (simulation or container instance) matching the given path criteria
getAllParametersMatching(paths, container)getAllParametersMatching(paths, container)
paths |
A vector of strings representing the paths relative to the |
container |
A Container or Simulation used to find the parameters |
A list of parameters matching the path criteria. The list is empty if no parameters matching were found.
loadSimulation(), getContainer() and getAllContainersMatching() to retrieve objects of type Container or Simulation
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Return all `Volume` parameters defined in all direct containers of the organism params <- getAllParametersMatching("Organism|*|Volume", sim) # Return all `Volume` parameters defined in all direct containers of the organism # and the parameter 'Weight (tissue)' of the container 'Liver' paths <- c("Organism|*|Volume", "Organism|Liver|Weight (tissue)") params <- getAllParametersMatching(paths, sim) # Returns all `Volume` parameters defined in `Organism` and all its subcontainers params <- getAllParametersMatching("Organism|**|Volume", sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Return all `Volume` parameters defined in all direct containers of the organism params <- getAllParametersMatching("Organism|*|Volume", sim) # Return all `Volume` parameters defined in all direct containers of the organism # and the parameter 'Weight (tissue)' of the container 'Liver' paths <- c("Organism|*|Volume", "Organism|Liver|Weight (tissue)") params <- getAllParametersMatching(paths, sim) # Returns all `Volume` parameters defined in `Organism` and all its subcontainers params <- getAllParametersMatching("Organism|**|Volume", sim)
Retrieve all quantities of a container (simulation or container instance) matching the given path criteria
getAllQuantitiesMatching(paths, container)getAllQuantitiesMatching(paths, container)
paths |
A vector of strings relative to the |
container |
A Container or Simulation used to find the parameters |
A list of quantities matching the path criteria. The list is empty if no quantity matching were found.
loadSimulation(), getContainer() and
getAllContainersMatching() to retrieve objects of type Container or
Simulation
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Return all `Volume` quantities defined in all direct containers of the organism quantities <- getAllQuantitiesMatching("Organism|*|Volume", sim) # Return all `Volume` quantities defined in all direct containers of the organism # and the parameter 'Weight (tissue)' of the container 'Liver' paths <- c("Organism|*|Volume", "Organism|Liver|Weight (tissue)") quantities <- getAllQuantitiesMatching(paths, sim) # Returns all `Volume` quantities defined in `Organism` and all its subcontainers quantities <- getAllQuantitiesMatching("Organism|**|Volume", sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Return all `Volume` quantities defined in all direct containers of the organism quantities <- getAllQuantitiesMatching("Organism|*|Volume", sim) # Return all `Volume` quantities defined in all direct containers of the organism # and the parameter 'Weight (tissue)' of the container 'Liver' paths <- c("Organism|*|Volume", "Organism|Liver|Weight (tissue)") quantities <- getAllQuantitiesMatching(paths, sim) # Returns all `Volume` quantities defined in `Organism` and all its subcontainers quantities <- getAllQuantitiesMatching("Organism|**|Volume", sim)
Retrieves the path of all quantities defined in the container and all its children
getAllQuantityPathsIn(container)getAllQuantityPathsIn(container)
container |
A Container or Simulation used to find the parameters |
An array with one entry per quantity defined in the container
loadSimulation(), getContainer() and
getAllContainersMatching() to retrieve objects of type Container or
Simulation
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Returns the path of all quantities defined in the simulation quantityPaths <- getAllQuantityPathsIn(sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Returns the path of all quantities defined in the simulation quantityPaths <- getAllQuantityPathsIn(sim)
Get the paths of all state variable parameters of the simulation
getAllStateVariableParametersPaths(simulation)getAllStateVariableParametersPaths(simulation)
simulation |
|
List of paths of all state variable parameters.
A list of paths
Get the paths of all state variable quantities of the simulation
getAllStateVariablesPaths(simulation)getAllStateVariablesPaths(simulation)
simulation |
|
List of paths of all molecules in all compartments and all parameters that are state variables.
A list of paths
Get base unit of a dimension
getBaseUnit(quantityOrDimension)getBaseUnit(quantityOrDimension)
quantityOrDimension |
Instance of a quantity from which the dimension will be retrieved or name of dimension |
String name of the base unit.
Retrieve a single container by path under the given container
getContainer(path, container, stopIfNotFound = TRUE)getContainer(path, container, stopIfNotFound = TRUE)
path |
A string representing the path relative to the |
container |
A Container or Simulation used to find the containers |
stopIfNotFound |
Boolean. If |
The Container with the given path. If the container for the path
does not exist, an error is thrown if stopIfNotFound is TRUE (default),
otherwise NULL
loadSimulation() and getContainer() to create objects of type Container or Simulation
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) container <- getContainer("Organism|Liver", sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) container <- getContainer("Organism|Liver", sim)
Get dimension by name
getDimensionByName(name)getDimensionByName(name)
name |
Name of dimension that should be retrieved |
Returns the an instance of the dimension with the given name if found or NULL
otherwise.
getDimensionByName("Time")getDimensionByName("Time")
Get dimension for a given unit
getDimensionForUnit(unit)getDimensionForUnit(unit)
unit |
Unit used to find the corresponding dimension. |
Returns the name of dimension that can be used to support the given unit or
NULL if the dimension cannot be found.
getDimensionForUnit("mg")getDimensionForUnit("mg")
Retrieve a single molecule by path in the given container
getMolecule(path, container, stopIfNotFound = TRUE)getMolecule(path, container, stopIfNotFound = TRUE)
path |
A string representing the path relative to the |
container |
A Container or Simulation used to find the molecules |
stopIfNotFound |
Boolean. If |
The Molecule with the given path. If the molecule for the path
does not exist, an error is thrown if stopIfNotFound is TRUE (default),
otherwise NULL
loadSimulation(), getContainer() and getAllContainersMatching() to retrieve objects of type Container or Simulation
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) molecule <- getMolecule("Organism|Liver|A", sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) molecule <- getMolecule("Organism|Liver|A", sim)
Returns the molecular weight of the molecule for a given quantity.
If no unit is provided, the value is returned in the base unit (kg/\u00b5mol).
getMolWeightFor(quantity, unit = NULL, stopIfNotFound = FALSE)getMolWeightFor(quantity, unit = NULL, stopIfNotFound = FALSE)
quantity |
A |
unit |
Optional. Target unit for the molecular weight. Defaults to |
stopIfNotFound |
Logical. If |
The molecular weight in the specified unit or NA if not found.
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) parameterPath <- "Organism|Lumen|Stomach|Dapagliflozin" quantity <- getQuantity(parameterPath, container = sim) getMolWeightFor(quantity, unit = "g/mol")simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) parameterPath <- "Organism|Lumen|Stomach|Dapagliflozin" quantity <- getQuantity(parameterPath, container = sim) getMolWeightFor(quantity, unit = "g/mol")
Get the value of a global ospsuite-R setting.
getOSPSuiteSetting(settingName)getOSPSuiteSetting(settingName)
settingName |
String name of the setting |
Value of the setting stored in ospsuiteEnv. If the setting does not exist, an error is thrown.
getOSPSuiteSetting("suiteVersion") getOSPSuiteSetting("sensitivityAnalysisConfig")$totalSensitivityThresholdgetOSPSuiteSetting("suiteVersion") getOSPSuiteSetting("sensitivityAnalysisConfig")$totalSensitivityThreshold
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.
getOutputValues( simulationResults, quantitiesOrPaths = NULL, population = NULL, individualIds = NULL, stopIfNotFound = TRUE, addMetaData = TRUE )getOutputValues( simulationResults, quantitiesOrPaths = NULL, population = NULL, individualIds = NULL, stopIfNotFound = TRUE, addMetaData = TRUE )
simulationResults |
Object of type |
quantitiesOrPaths |
Quantity instances (element or vector) typically
retrieved using |
population |
population used to calculate the |
individualIds |
|
stopIfNotFound |
If |
addMetaData |
If |
Returns the simulated values for the selected outputs (e.g molecules or parameters).
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Running an individual simulation # results is an instance of `SimulationResults` results <- runSimulations(sim)[[1]] getOutputValues(results)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Running an individual simulation # results is an instance of `SimulationResults` results <- runSimulations(sim)[[1]] getOutputValues(results)
Retrieve a single parameter by path in the given container
getParameter(path, container, stopIfNotFound = TRUE)getParameter(path, container, stopIfNotFound = TRUE)
path |
A string representing the path relative to the |
container |
A Container or Simulation used to find the parameters |
stopIfNotFound |
Boolean. If |
The Parameter with the given path. If the parameter for the path
does not exist, an error is thrown if stopIfNotFound is TRUE (default),
otherwise NULL
loadSimulation(), getContainer() and getAllContainersMatching() to retrieve objects of type Container or Simulation
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) param <- getParameter("Organism|Liver|Volume", sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) param <- getParameter("Organism|Liver|Volume", sim)
Retrieves the display path of the parameters defined by paths in the simulation
getParameterDisplayPaths(paths, simulation)getParameterDisplayPaths(paths, simulation)
paths |
A single string or array of paths path relative to the |
simulation |
A simulation used to find the entities |
a display path for each parameter in paths
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) displayPath <- getParameterDisplayPaths("Organism|Liver|Volume", sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) displayPath <- getParameterDisplayPaths("Organism|Liver|Volume", sim)
Retrieve a single quantity by path in the given container
getQuantity(path, container, stopIfNotFound = TRUE)getQuantity(path, container, stopIfNotFound = TRUE)
path |
A string representing the path relative to the |
container |
A Container or Simulation used to find the parameters |
stopIfNotFound |
Boolean. If |
The Quantity with the given path. If the quantity for the path
does not exist, an error is thrown if stopIfNotFound is TRUE (default),
otherwise NULL
loadSimulation(), getContainer() and
getAllContainersMatching() to retrieve objects of type Container or
Simulation
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) quantity <- getQuantity("Organism|Liver|Volume", sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) quantity <- getQuantity("Organism|Liver|Volume", sim)
Get the values of quantities in the simulation by path
getQuantityValuesByPath( quantityPaths, simulation, units = NULL, stopIfNotFound = TRUE )getQuantityValuesByPath( quantityPaths, simulation, units = NULL, stopIfNotFound = TRUE )
quantityPaths |
A single or a list of absolute quantity paths |
simulation |
Simulation containing the quantities |
units |
A string or a list of strings defining the units of returned
values. If |
stopIfNotFound |
Boolean. If |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) getQuantityValuesByPath( list("Organism|Liver|Volume", "Organism|Liver|A"), sim, list("ml", NULL) )simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) getQuantityValuesByPath( list("Organism|Liver|Volume", "Organism|Liver|A"), sim, list("ml", NULL) )
Given a simulation file path or an instance of a simulation, traverses the simulation structure and returns a tree like structure allowing for intuitive navigation in the simulation tree.
getSimulationTree(simulationOrFilePath, quantityType = "Quantity")getSimulationTree(simulationOrFilePath, quantityType = "Quantity")
simulationOrFilePath |
Full path of the simulation to load or instance of a simulation. |
quantityType |
A vector of strings that specify the types of the entities to be included in the tree. The types can be any combination of "Quantity", "Molecule", "Parameter" and "Observer". |
A list with a branched structure representing the path tree of entities in
the simulation file that fall under the types specified in quantityType. At
the end of each branch is a string called 'path' that is the path of the
quantity represented by the branch.
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) tree <- getSimulationTree(sim) liver_volume_path <- tree$Organism$Liver$Volume$pathsimPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) tree <- getSimulationTree(sim) liver_volume_path <- tree$Organism$Liver$Volume$path
simulation for given moleculeName.
These parameters are typically located directly under the container named after the moleculeName.
For the list of standard parametersReturns a list containing all standard global parameters defined in a simulation for given moleculeName.
These parameters are typically located directly under the container named after the moleculeName.
For the list of standard parameters
getStandardMoleculeParameters(moleculeName, simulation)getStandardMoleculeParameters(moleculeName, simulation)
moleculeName |
Name of molecule (Enzyme, Transporter etc..) for which global parameters should be returned |
simulation |
Simulation to query for molecule parameters |
A list of all standard global parameters defined for moleculeName if the molecule exists in the simulation.
Otherwise an empty list is returned
simPath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite") sim1 <- loadSimulation(simPath) parameters <- getStandardMoleculeParameters("CYP3A4", sim1)simPath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite") sim1 <- loadSimulation(simPath) parameters <- getStandardMoleculeParameters("CYP3A4", sim1)
Get the steady-state values of species and state variable parameters.
getSteadyState( simulations, quantitiesPaths = NULL, steadyStateTime = NULL, ignoreIfFormula = TRUE, lowerThreshold = 1e-15, simulationRunOptions = NULL )getSteadyState( simulations, quantitiesPaths = NULL, steadyStateTime = NULL, ignoreIfFormula = TRUE, lowerThreshold = 1e-15, simulationRunOptions = NULL )
simulations |
|
quantitiesPaths |
List of quantity paths (molecules and/or parameters)
for which the steady-state will be simulated. If |
steadyStateTime |
Simulation time (minutes). In |
ignoreIfFormula |
If |
lowerThreshold |
Numerical value (in default unit of the output).
Any steady-state values with absolute value below this threshold are considered
as numerical noise and replaced by 0 (i.e., values in the interval
|
simulationRunOptions |
Optional instance of a |
The steady-state is considered to be the last values of the molecules amounts and state variable parameters in the simulation with sufficiently long simulation time, i.e., where the rates of the processes do not (significantly) change. The steady-state is NOT analytically calculated or estimated in any other way than simulating for the given time.
A named list, where the names are the IDs of the simulations and the
entries are lists containing paths and their values at the end of the
simulation.
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) steadyState <- getSteadyState(simulations = sim) # Set initial values for steady-state simulations setQuantityValuesByPath( quantityPaths = steadyState[[sim$id]]$paths, values = steadyState[[sim$id]]$values, simulation = sim )simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) steadyState <- getSteadyState(simulations = sim) # Set initial values for steady-state simulations setQuantityValuesByPath( quantityPaths = steadyState[[sim$id]]$paths, values = steadyState[[sim$id]]$values, simulation = sim )
Get units for a given dimension
getUnitsForDimension(dimension)getUnitsForDimension(dimension)
dimension |
Name of dimension for which units should be returned |
Returns a vector containing all units defined in the dimension
getUnitsForDimension("Mass")getUnitsForDimension("Mass")
Dimension existence
hasDimension(dimension)hasDimension(dimension)
dimension |
String name of the dimension. |
Returns TRUE if the provided dimension is supported otherwise FALSE
Unit existence
hasUnit(unit, dimension)hasUnit(unit, dimension)
unit |
String name of the unit |
dimension |
String name of the dimension. |
Check if the unit is valid for the dimension.
Default human population defined in PK-Sim
HumanPopulationHumanPopulation
Loads the pK-analyses from csv file
importPKAnalysesFromCSV(filePath, simulation)importPKAnalysesFromCSV(filePath, simulation)
filePath |
Full path of the file containing the pK-Analyses to load. |
simulation |
Instance of the simulation for which the pk-Analyses were calculated. This is required to verify that the file matches the simulation. |
Imports the simulation results from one or more csv files
importResultsFromCSV(simulation, filePaths)importResultsFromCSV(simulation, filePaths)
simulation |
Instance of a simulation used to calculate the results |
filePaths |
Full path of result files to import. Typically only one file is provided but a list of files is sometimes available when the simulation was parallelized and computed on different machines |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") resultPath <- system.file("extdata", "res.csv", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath) # Run the simulation results <- importResultsFromCSV(sim, resultPath)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") resultPath <- system.file("extdata", "res.csv", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath) # Run the simulation results <- importResultsFromCSV(sim, resultPath)
Imports the simulation analysis results from one or more csv files
importSensitivityAnalysisResultsFromCSV(simulation, filePaths)importSensitivityAnalysisResultsFromCSV(simulation, filePaths)
simulation |
Instance of a simulation for which the sensitivity analysis was performed |
filePaths |
Full path of sensitivity analysis result files to import. Typically only one file is provided but a list of files is sometimes available when the sensitivity analysis run was parallelized and computed on different machines |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") resultPath <- system.file("extdata", "sa.csv", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath) # Run the simulation results <- importSensitivityAnalysisResultsFromCSV(sim, resultPath)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") resultPath <- system.file("extdata", "sa.csv", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath) # Run the simulation results <- importSensitivityAnalysisResultsFromCSV(sim, resultPath)
Characteristics of an individual describing its origin
rSharp::NetObject -> DotNetWrapper -> IndividualCharacteristics
speciesSpecifies the species of the individual. It should be a species available in PK-Sim (see Species)
populationFor a Human species, the population of interest. It should be a population available in PK-Sim (see HumanPopulation)
genderGender of the individual. It should be defined for the species in PK-Sim (see Gender)
ageAge of the individual as in instance of a SnapshotParameter (optional)
gestationalAgeGestational Age of the individual as in instance of a SnapshotParameter (optional)
weightWeight of the individual as in instance of a SnapshotParameter (optional)
heightHeight of the individual as in instance of a SnapshotParameter (optional)
allMoleculeOntogeniesAll molecule ontogenies defined for this individual characteristics.
seedSeed used to generate the population
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()IndividualCharacteristics$new()Initialize a new instance of the class
IndividualCharacteristics$new()
A new IndividualCharacteristics object.
IndividualCharacteristics$print()Print the object to the console
IndividualCharacteristics$print(...)
...Rest arguments.
IndividualCharacteristics$addMoleculeOntogeny()Add a molecule ontogeny MoleculeOntogeny to the individual characteristics
IndividualCharacteristics$addMoleculeOntogeny(moleculeOntogeny)
moleculeOntogenyMolecule ontogeny to add
PKSim.R dll that will enable create individual and create population workflows.Loads the PKSim.R dll that will enable create individual and create population workflows.
initPKSim()initPKSim()
PKSim dlls are included in the package.
Is the value defined by an explicit formula
isExplicitFormulaByPath(path, simulation, stopIfNotFound = TRUE)isExplicitFormulaByPath(path, simulation, stopIfNotFound = TRUE)
path |
Path to the quantity |
simulation |
A |
stopIfNotFound |
Boolean. If |
TRUE if the value is an explicit formula, FALSE otherwise.
Also returns FALSE if no quantity with the given path is found and
stopInfNotFound is set to FALSE.
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) isExplicitFormulaByPath("Organism|Liver|Volume", sim) # FALSEsimPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) isExplicitFormulaByPath("Organism|Liver|Volume", sim) # FALSE
Check if unit is supported in the OSPSuite platform
isSupportedUnit(unit)isSupportedUnit(unit)
unit |
String name of the unit |
Returns TRUE if the provided unit is supported in the OSPSuite platform, otherwise FALSE
Logical: TRUE if the unit is supported, FALSE otherwise.
isSupportedUnit("kg") isSupportedUnit("invalid_unit")isSupportedUnit("kg") isSupportedUnit("invalid_unit")
Loads aging data (typically generated from PK-Sim) i
loadAgingDataFromCSV(filePath)loadAgingDataFromCSV(filePath)
filePath |
Full path containing an aging data table. |
csvPath <- system.file("extdata", "aging_data.csv", package = "ospsuite") agingData <- loadAgingDataFromCSV(csvPath)csvPath <- system.file("extdata", "aging_data.csv", package = "ospsuite") agingData <- loadAgingDataFromCSV(csvPath)
DataImporterConfiguration from XML file.Load DataImporterConfiguration from XML file.
loadDataImporterConfiguration(configurationFilePath)loadDataImporterConfiguration(configurationFilePath)
configurationFilePath |
Path to the XML file with stored configuration (e.g. created in PK-Sim or MoBi). |
A new DataImporterConfiguration object to be used with
loadDataSetsFromExcel().
configurationFilePath <- system.file( "extdata", "dataImporterConfiguration.xml", package = "ospsuite" ) importerConfiguration <- loadDataImporterConfiguration(configurationFilePath) # Specifying which sheet to load importerConfiguration$sheets <- "TestSheet_1" xlsFilePath <- system.file("extdata", "CompiledDataSet.xlsx", package = "ospsuite") dataSets <- loadDataSetsFromExcel( xlsFilePath = xlsFilePath, importerConfigurationOrPath = importerConfiguration, importAllSheets = FALSE )configurationFilePath <- system.file( "extdata", "dataImporterConfiguration.xml", package = "ospsuite" ) importerConfiguration <- loadDataImporterConfiguration(configurationFilePath) # Specifying which sheet to load importerConfiguration$sheets <- "TestSheet_1" xlsFilePath <- system.file("extdata", "CompiledDataSet.xlsx", package = "ospsuite") dataSets <- loadDataSetsFromExcel( xlsFilePath = xlsFilePath, importerConfigurationOrPath = importerConfiguration, importAllSheets = FALSE )
DataSet from it.
The pkml files are typically exported from PK-Sim or MoBi.Loads data (typically observed data) from a PKML file and creates a DataSet from it.
The pkml files are typically exported from PK-Sim or MoBi.
loadDataSetFromPKML(filePath)loadDataSetFromPKML(filePath)
filePath |
Full path of pkml file containing the observed data to load |
filePath <- system.file("extdata", "ObsDataAciclovir_1.pkml", package = "ospsuite") obsData <- loadDataSetFromPKML(filePath)filePath <- system.file("extdata", "ObsDataAciclovir_1.pkml", package = "ospsuite") obsData <- loadDataSetFromPKML(filePath)
Load data sets from excel
loadDataSetsFromExcel( xlsFilePath, importerConfigurationOrPath, importAllSheets = FALSE, sheets = NULL )loadDataSetsFromExcel( xlsFilePath, importerConfigurationOrPath, importAllSheets = FALSE, sheets = NULL )
Load observed data from an excel file using an importer configuration
A named set of DataSet objects. The naming is defined by the property
importerConfiguration$namingPattern.
xlsFilePath <- system.file( "extdata", "CompiledDataSet.xlsx", package = "ospsuite" ) # When sheet is specified, it is automatically added to the configuration importerConfiguration <- createImporterConfigurationForFile( xlsFilePath, sheet = "TestSheet_1" ) dataSets <- loadDataSetsFromExcel( xlsFilePath = xlsFilePath, importerConfigurationOrPath = importerConfiguration ) # Load specific sheets using the sheets parameter dataSets <- loadDataSetsFromExcel( xlsFilePath = xlsFilePath, importerConfigurationOrPath = importerConfiguration, sheets = c("TestSheet_1", "TestSheet_2") ) ## Not run: # Load all sheets by setting sheets to NULL and no sheets in configuration importerConfiguration <- createImporterConfigurationForFile(xlsFilePath) dataSets <- loadDataSetsFromExcel( xlsFilePath = xlsFilePath, importerConfigurationOrPath = importerConfiguration, sheets = NULL ) ## End(Not run)xlsFilePath <- system.file( "extdata", "CompiledDataSet.xlsx", package = "ospsuite" ) # When sheet is specified, it is automatically added to the configuration importerConfiguration <- createImporterConfigurationForFile( xlsFilePath, sheet = "TestSheet_1" ) dataSets <- loadDataSetsFromExcel( xlsFilePath = xlsFilePath, importerConfigurationOrPath = importerConfiguration ) # Load specific sheets using the sheets parameter dataSets <- loadDataSetsFromExcel( xlsFilePath = xlsFilePath, importerConfigurationOrPath = importerConfiguration, sheets = c("TestSheet_1", "TestSheet_2") ) ## Not run: # Load all sheets by setting sheets to NULL and no sheets in configuration importerConfiguration <- createImporterConfigurationForFile(xlsFilePath) dataSets <- loadDataSetsFromExcel( xlsFilePath = xlsFilePath, importerConfigurationOrPath = importerConfiguration, sheets = NULL ) ## End(Not run)
Loads a population from a csv file and returns the population.
loadPopulation(csvPopulationFile)loadPopulation(csvPopulationFile)
csvPopulationFile |
Full path of csv population file to load. |
csvPath <- system.file("extdata", "pop.csv", package = "ospsuite") population <- loadPopulation(csvPath)csvPath <- system.file("extdata", "pop.csv", package = "ospsuite") population <- loadPopulation(csvPath)
Converts one or more snapshot files (.json) into project files and writes
them to an output directory.
Only PK-Sim projects (.pksim5) are supported for now. Support for MoBi
projects is planned.
loadProjectFromSnapshot(..., output = ".", runSimulations = FALSE)loadProjectFromSnapshot(..., output = ".", runSimulations = FALSE)
... |
character strings, path to snapshot files ( |
output |
character string, path to the output directory where to write the converted project files. |
runSimulations |
logical, whether to run the simulations during
conversion (default = |
## Not run: loadProjectFromSnapshot("path/to/snapshot.json", output = "path/to/output") ## End(Not run)## Not run: loadProjectFromSnapshot("path/to/snapshot.json", output = "path/to/output") ## End(Not run)
Loads a simulation from a pkml file and returns the simulation. If the passed simulation file has been loaded before, the simulation is not loaded again but a cached object is returned. This behavior can be overridden.
loadSimulation( filePath, loadFromCache = FALSE, addToCache = TRUE, resetIds = TRUE )loadSimulation( filePath, loadFromCache = FALSE, addToCache = TRUE, resetIds = TRUE )
filePath |
Full path of pkml simulation file to load. |
loadFromCache |
If |
addToCache |
If |
resetIds |
If |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Load sim1 for the first time sim1 <- loadSimulation(simPath) # sim2 will be loaded from cache and will represent the same object as sim1 sim2 <- loadSimulation(simPath, loadFromCache = TRUE) parameter1 <- getParameter(toPathString(c("Organism", "Liver", "Volume")), sim1) parameter2 <- getParameter(toPathString(c("Organism", "Liver", "Volume")), sim2) # parameter1 and parameter2 belong to the same simulation object, so changing # one of the them will also change another setParameterValues(parameters = parameter2, values = 0) parameter1$value == parameter2$value # TRUE # sim3 will not be loaded from cache sim3 <- loadSimulation(simPath, loadFromCache = FALSE) # parameter3 belong to different simulation object than parameter1 and parameter2 parameter3 <- getParameter(toPathString(c("Organism", "Liver", "Volume")), sim3) setParameterValues(parameters = parameter3, values = 1) parameter2$value == parameter3$value # FALSE#'simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Load sim1 for the first time sim1 <- loadSimulation(simPath) # sim2 will be loaded from cache and will represent the same object as sim1 sim2 <- loadSimulation(simPath, loadFromCache = TRUE) parameter1 <- getParameter(toPathString(c("Organism", "Liver", "Volume")), sim1) parameter2 <- getParameter(toPathString(c("Organism", "Liver", "Volume")), sim2) # parameter1 and parameter2 belong to the same simulation object, so changing # one of the them will also change another setParameterValues(parameters = parameter2, values = 0) parameter1$value == parameter2$value # TRUE # sim3 will not be loaded from cache sim3 <- loadSimulation(simPath, loadFromCache = FALSE) # parameter3 belong to different simulation object than parameter1 and parameter2 parameter3 <- getParameter(toPathString(c("Organism", "Liver", "Volume")), sim3) setParameterValues(parameters = parameter3, values = 1) parameter2$value == parameter3$value # FALSE#'
messages list from ospsuite.utilsList of functions and strings used to signal error messages
Extends the messages list from ospsuite.utils
messagesmessages
Use when retrieving individual values using the createIndividualAlgorithm. This class is a simple pair (MoleculeName, Ontogeny) allowing the user to retrieve potential ontogeny values.
moleculeName of the molecule in the model
ontogenyName of the ontogeny to use for the molecule
MoleculeOntogeny$new()Initialize a new instance of the class
MoleculeOntogeny$new(molecule, ontogeny)
moleculemolecule name
ontogenyontogeny to use for the Molecule (one of StandardOntogeny)
A new MoleculeOntogeny object.
MoleculeOntogeny$print()Print the object to the console
MoleculeOntogeny$print(...)
...Rest arguments.
MoleculeOntogeny$printMoleculeOntogeny()Print the MoleculeOntogeny on one line
MoleculeOntogeny$printMoleculeOntogeny()
Standard molecule parameter names typically available in an endogenous molecule (enzyme, transporter etc...) coming from PK-Sim
MoleculeParameterMoleculeParameter
Supported dimensions defined as a named list
ospDimensionsospDimensions
ospDimensions$Mass => "Mass"
Deprecated functions
pkAnalysesAsDataFrame(...) populationAsDataFrame(...)pkAnalysesAsDataFrame(...) populationAsDataFrame(...)
... |
Arguments to the deprecated function. |
pkAnalysesAsDataFrame is now pkAnalysesToDataFrame.
populationAsDataFrame is now populationToDataFrame.
getOSPSuiteSetting()
Names of the settings stored in ospsuiteEnv. Can be used with getOSPSuiteSetting()
ospsuiteSettingNamesospsuiteSettingNames
ospUnits$Mass$kg => "kg"
ospUnitsospUnits
Output schema associated with a given simulation
rSharp::NetObject -> DotNetWrapper -> OutputSchema
intervalsAll intervals defined in the schema (Read-Only)
timePointsAll single time points defined in the schema (Read-Only)
endTimeReturns the end time of the simulation in kernel unit (Read-Only)
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DotNetWrapper$initialize()OutputSchema$clear()Clears all intervals and time points
OutputSchema$clear()
OutputSchema$addInterval()Adds an interval to the schema
OutputSchema$addInterval(interval)
intervalInterval to add
OutputSchema$removeInterval()Removes the interval from the schema
OutputSchema$removeInterval(interval)
intervalInterval to remove
OutputSchema$addTimePoints()Adds the time points to the schema. Note that time points and intervals exists concurrently. Use time points only if you need to ensure that specific time are used.
OutputSchema$addTimePoints(timePoints)
timePointsTime points to add to the schema
OutputSchema$print()Print the object to the console
OutputSchema$print(...)
...Rest arguments.
List of selected quantities selected as output for a given simulation
rSharp::NetObject -> DotNetWrapper -> OutputSelections
allOutputsReturns all outputs defined in the selection
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DotNetWrapper$initialize()OutputSelections$clear()Removes all selected output from the selection
OutputSelections$clear()
OutputSelections$addQuantity()Adds a quantity as selected
OutputSelections$addQuantity(quantity)
quantityQuantity to add to the selection
OutputSelections$removeQuantity()Removes a quantity from the selection
OutputSelections$removeQuantity(quantity)
quantityQuantity to remove from the selection
OutputSelections$print()Print the object to the console
OutputSelections$print(...)
...Rest arguments.
A model parameter
Derived from Quantity, please see base class documentation.
rSharp::NetObject -> DotNetWrapper -> ObjectBase -> Entity -> Quantity -> Parameter
isStateVariableReturns TRUE is the parameter has a RHS otherwise FALSE.
Setting the value to FALSE will delete the RHS Formula.
Setting it to TRUE is not currently supported and will throw an error.
rhsFormulaAn instance of a Formula object representing the RHS Formula (Read-Only)
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()Quantity$getPrintValue()Quantity$hasUnit()Quantity$printQuantityValue()Quantity$printValue()Quantity$reset()Quantity$setValue()Parameter$new()Initialize a new instance of the class
Parameter$new(netObject)
netObjectAn rSharp::NetObject object.
A new Parameter object.
Parameter$print()Print the object to the console
Parameter$print(...)
...Rest arguments.
A parameter range typically used in the definition of PopulationCharacteristics covariates (Height, Weight etc...)
rSharp::NetObject -> DotNetWrapper -> ParameterRange
minMinimum value for the parameter range
maxMaximum value for the parameter range
unitUnit in which the value is defined
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()ParameterRange$new()Initialize a new instance of the class
ParameterRange$new(netObject = NULL, min = NULL, max = NULL, unit = NULL)
netObjectOptional NetObject of ParameterRange. If not defined, a new instance will be created
minOptional minimum value for the range
maxOptional minimum value for the range
unitOptional unit of the specified min and max
A new ParameterRange object.
ParameterRange$print()Print the object to the console
ParameterRange$print(...)
...Rest arguments.
ParameterRange$printValue()Print the parameter in one line
ParameterRange$printValue(caption)
captionCaption to display before the value of the parameter
ParameterRange$getPrintValue()Return a string for printing the parameter in one line
ParameterRange$getPrintValue()
A string for printing the parameter in one line
Convert the pk-Analysis to data frame
pkAnalysesToDataFrame(pkAnalyses) pkAnalysesToTibble(pkAnalyses)pkAnalysesToDataFrame(pkAnalyses) pkAnalysesToTibble(pkAnalyses)
pkAnalyses |
pK-Analyses to convert to data frame (typically calculated
using |
Standard PK Parameters defined in the OSPSuite
rSharp::NetObject -> DotNetWrapper -> PKParameter
nameName of the PK-Parameter
displayNameDisplay Name of the PK-Parameter. If not set, Name will be used
dimensionDimension instance used by the PK-Parameter (Read-Only)
unitUnit of the PK-Parameter (Read-Only)
displayUnitDisplay Unit used for the PK-Parameter
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DotNetWrapper$initialize()PKParameter$print()Print the object to the console
PKParameter$print(...)
...Rest arguments.
Returns an instance of a PK-Parameter by name or NULL if the parameter by name is not found
pkParameterByName(name, stopIfNotFound = TRUE)pkParameterByName(name, stopIfNotFound = TRUE)
name |
Name of PK-Parameter to update |
stopIfNotFound |
Boolean. If |
pkParameter <- pkParameterByName(name = "t_max")pkParameter <- pkParameterByName(name = "t_max")
Sensitivity of a PK Parameter for one output for a given parameter
rSharp::NetObject -> DotNetWrapper -> PKParameterSensitivity
parameterNameUnique name of parameter in sensitivity analysis
pkParameterNameName of PK Output (Cmax, Tmax etc...)
outputPathPath of underlying quantity for which pk-analyses were performed
valueValue of sensitivity
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DotNetWrapper$initialize()PKParameterSensitivity$print()Print the object to the console
PKParameterSensitivity$print(...)
...Rest arguments.
plotIndividualTimeProfile( dataCombined, defaultPlotConfiguration = NULL, showLegendPerDataset = FALSE )plotIndividualTimeProfile( dataCombined, defaultPlotConfiguration = NULL, showLegendPerDataset = FALSE )
dataCombined |
A single instance of |
defaultPlotConfiguration |
A |
showLegendPerDataset |
Logical flag to display separate legend entries
for observed and simulated datasets, if available. This is experimental and
may not work reliably when both observed and simulated datasets > 1. Defaults
to |
Other plotting:
DefaultPlotConfiguration,
plotObservedVsSimulated(),
plotPopulationTimeProfile(),
plotResidualsVsSimulated(),
plotResidualsVsTime()
# Create a new instance of `DefaultPlotConfiguration` class myPlotConfiguration <- DefaultPlotConfiguration$new() myPlotConfiguration$title <- "My Plot Title" myPlotConfiguration$subtitle <- "My Plot Subtitle" myPlotConfiguration$caption <- "My Sources" # plot plotIndividualTimeProfile(dataCombinedAciclovir, myPlotConfiguration)# Create a new instance of `DefaultPlotConfiguration` class myPlotConfiguration <- DefaultPlotConfiguration$new() myPlotConfiguration$title <- "My Plot Title" myPlotConfiguration$subtitle <- "My Plot Subtitle" myPlotConfiguration$caption <- "My Sources" # plot plotIndividualTimeProfile(dataCombinedAciclovir, myPlotConfiguration)
plotObservedVsSimulated( dataCombined, defaultPlotConfiguration = NULL, foldDistance = NULL )plotObservedVsSimulated( dataCombined, defaultPlotConfiguration = NULL, foldDistance = NULL )
dataCombined |
A single instance of |
defaultPlotConfiguration |
A |
foldDistance |
A vector for plotting lines at required fold distances
around the identity line ( |
Other plotting:
DefaultPlotConfiguration,
plotIndividualTimeProfile(),
plotPopulationTimeProfile(),
plotResidualsVsSimulated(),
plotResidualsVsTime()
# Create a new instance of `DefaultPlotConfiguration` class myPlotConfiguration <- DefaultPlotConfiguration$new() myPlotConfiguration$title <- "My Plot Title" myPlotConfiguration$subtitle <- "My Plot Subtitle" myPlotConfiguration$caption <- "My Sources" # plot plotObservedVsSimulated(dataCombinedAciclovir, myPlotConfiguration)# Create a new instance of `DefaultPlotConfiguration` class myPlotConfiguration <- DefaultPlotConfiguration$new() myPlotConfiguration$title <- "My Plot Title" myPlotConfiguration$subtitle <- "My Plot Subtitle" myPlotConfiguration$caption <- "My Sources" # plot plotObservedVsSimulated(dataCombinedAciclovir, myPlotConfiguration)
plotPopulationTimeProfile( dataCombined, defaultPlotConfiguration = NULL, aggregation = "quantiles", quantiles = c(0.05, 0.5, 0.95), showLegendPerDataset = FALSE, ... )plotPopulationTimeProfile( dataCombined, defaultPlotConfiguration = NULL, aggregation = "quantiles", quantiles = c(0.05, 0.5, 0.95), showLegendPerDataset = FALSE, ... )
dataCombined |
A single instance of |
defaultPlotConfiguration |
A |
aggregation |
The type of the aggregation of individual data. One of
|
quantiles |
A numerical vector with quantile values (Default: |
showLegendPerDataset |
Logical flag to display separate legend entries
for observed and simulated datasets, if available. This is experimental and
may not work reliably when both observed and simulated datasets > 1. Defaults
to |
... |
additionnal arguments to pass to |
The simulated values will be aggregated across individuals for each time point.
For aggregation = quantiles (default), the quantile values defined in the
argument quantiles will be used. In the profile plot, the middle value
will be used to draw a line, while the lower and upper values will be used
as the lower und upper ranges. For aggregation = arithmetic, arithmetic
mean with arithmetic standard deviation (SD) will be plotted. Use the
optional parameter nsd to change the number of SD to plot above and below
the mean. For aggregation = geometric, geometric mean with geometric
standard deviation (SD) will be plotted. Use the optional parameter nsd to
change the number of SD to plot above and below the mean.
Other plotting:
DefaultPlotConfiguration,
plotIndividualTimeProfile(),
plotObservedVsSimulated(),
plotResidualsVsSimulated(),
plotResidualsVsTime()
simFilePath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite") sim <- loadSimulation(simFilePath) populationResults <- importResultsFromCSV( simulation = sim, filePaths = system.file("extdata", "SimResults.csv", package = "ospsuite") ) # Create a new instance of `DataCombined` class myDataComb <- DataCombined$new() myDataComb$addSimulationResults(populationResults) # plot plotPopulationTimeProfile(myDataComb) # plot with other quantiles plotPopulationTimeProfile(myDataComb, quantiles = c(0.1, 0.5, 0.9)) # plot with arithmetic mean plotPopulationTimeProfile(myDataComb, aggregation = "arithmetic" )simFilePath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite") sim <- loadSimulation(simFilePath) populationResults <- importResultsFromCSV( simulation = sim, filePaths = system.file("extdata", "SimResults.csv", package = "ospsuite") ) # Create a new instance of `DataCombined` class myDataComb <- DataCombined$new() myDataComb$addSimulationResults(populationResults) # plot plotPopulationTimeProfile(myDataComb) # plot with other quantiles plotPopulationTimeProfile(myDataComb, quantiles = c(0.1, 0.5, 0.9)) # plot with arithmetic mean plotPopulationTimeProfile(myDataComb, aggregation = "arithmetic" )
Plots predicted vs observed data, grouped by "group".
This function visualizes the relationship between predicted and observed values, allowing for easy identification of discrepancies.
plotPredictedVsObserved( plotData, metaData = NULL, mapping = ggplot2::aes(), yUnit = NULL, xyScale = "log", predictedAxis = "y", comparisonLineVector = ospsuite.plots::getFoldDistanceList(folds = c(2)), showLegendPerDataset = "all", ... )plotPredictedVsObserved( plotData, metaData = NULL, mapping = ggplot2::aes(), yUnit = NULL, xyScale = "log", predictedAxis = "y", comparisonLineVector = ospsuite.plots::getFoldDistanceList(folds = c(2)), showLegendPerDataset = "all", ... )
plotData |
An object of class
|
metaData |
A list containing metadata for the plot. If NULL, a default list is constructed from the data. Expected structure includes information about dimensions and units for both x and y axes. |
mapping |
A ggplot2 aesthetic mapping object. Default is
|
yUnit |
A character string specifying the target unit for the x and
y-axis. If |
xyScale |
A character string specifying the scale for the x and y-axis.
Default is |
predictedAxis |
A character string specifying which axis to use for
predicted values. Options are |
comparisonLineVector |
A named list generated by the function
|
showLegendPerDataset |
Controls display of separate legend entries for individual datasets. One of:
User-provided |
... |
Arguments passed on to
|
A ggplot2 plot object representing predicted vs observed values,
including aesthetics for the x and y axes, or NULL if the data contains
no plottable entries.
Other plot functions based on ospsuite.plots:
plotQuantileQuantilePlot(),
plotResidualsAsHistogram(),
plotResidualsVsCovariate(),
plotTimeProfile()
# Generate a predicted vs observed plot plotPredictedVsObserved(dataCombinedAciclovir) # Generate an observed vs predicted plot (swap axes) plotPredictedVsObserved(dataCombinedAciclovir, predictedAxis = "x") # Show individual dataset names in legend plotPredictedVsObserved(dataCombinedAciclovir, showLegendPerDataset = "observed")# Generate a predicted vs observed plot plotPredictedVsObserved(dataCombinedAciclovir) # Generate an observed vs predicted plot (swap axes) plotPredictedVsObserved(dataCombinedAciclovir, predictedAxis = "x") # Show individual dataset names in legend plotPredictedVsObserved(dataCombinedAciclovir, showLegendPerDataset = "observed")
Plots a Quantile-Quantile plot, grouped by "group".
This function visualizes the distribution of predicted vs observed values using a Q-Q plot.
plotQuantileQuantilePlot( plotData, metaData = NULL, mapping = ggplot2::aes(), xUnit = NULL, yUnit = NULL, residualScale = "log", ... )plotQuantileQuantilePlot( plotData, metaData = NULL, mapping = ggplot2::aes(), xUnit = NULL, yUnit = NULL, residualScale = "log", ... )
plotData |
An object of class
|
metaData |
A list containing metadata for the plot. If NULL, a default list is constructed from the data. Expected structure includes information about dimensions and units for both x and y axes. |
mapping |
A ggplot2 aesthetic mapping object. Default is
|
xUnit |
A character string specifying the target unit for the x-axis. If
|
yUnit |
A character string specifying the target unit for the simulated
and observed y-values used for residual calculation. If |
residualScale |
Either "linear", "log", or "ratio" method for computing
residuals. Default is |
... |
Arguments passed on to
|
A ggplot2 plot object representing the Q-Q plot, or NULL if
the data contains no plottable entries.
Other plot functions based on ospsuite.plots:
plotPredictedVsObserved(),
plotResidualsAsHistogram(),
plotResidualsVsCovariate(),
plotTimeProfile()
# Generate a Q-Q plot with default settings plotQuantileQuantilePlot(dataCombinedAciclovir) # Generate a Q-Q plot with linear scale plotQuantileQuantilePlot(dataCombinedAciclovir, residualScale = "linear")# Generate a Q-Q plot with default settings plotQuantileQuantilePlot(dataCombinedAciclovir) # Generate a Q-Q plot with linear scale plotQuantileQuantilePlot(dataCombinedAciclovir, residualScale = "linear")
Plots residuals as a histogram, grouped by "group".
This function generates a histogram of the residuals, providing a visual representation of their distribution.
plotResidualsAsHistogram( plotData, metaData = NULL, mapping = ggplot2::aes(), yUnit = NULL, distribution = "normal", residualScale = "log", ... )plotResidualsAsHistogram( plotData, metaData = NULL, mapping = ggplot2::aes(), yUnit = NULL, distribution = "normal", residualScale = "log", ... )
plotData |
An object of class
|
metaData |
A list containing metadata for the plot. If NULL, a default list is constructed from the data. Expected structure includes information about dimensions and units for both x and y axes. |
mapping |
A ggplot2 aesthetic mapping object. Default is
|
yUnit |
A character string specifying the target unit for the simulated
and observed y-values used for residual calculation. If |
distribution |
parameter passed to |
residualScale |
Either "linear", "log", or "ratio" method for computing
residuals. Default is |
... |
Arguments passed on to
|
A ggplot2 plot object representing the histogram of residuals,
or NULL if the data contains no plottable entries.
Other plot functions based on ospsuite.plots:
plotPredictedVsObserved(),
plotQuantileQuantilePlot(),
plotResidualsVsCovariate(),
plotTimeProfile()
# Generate a histogram of residuals with default settings plotResidualsAsHistogram(dataCombinedAciclovir) # Generate a histogram with linear scale plotResidualsAsHistogram(dataCombinedAciclovir, residualScale = "linear")# Generate a histogram of residuals with default settings plotResidualsAsHistogram(dataCombinedAciclovir) # Generate a histogram with linear scale plotResidualsAsHistogram(dataCombinedAciclovir, residualScale = "linear")
Plots residuals vs a covariate (time, observed, or predicted values), grouped by "group".
This function visualizes the residuals against time, observed, or predicted (simulated) values, helping to assess model performance.
plotResidualsVsCovariate( plotData, metaData = NULL, mapping = ggplot2::aes(), xUnit = NULL, yUnit = NULL, residualScale = "log", xAxis = "observed", showLegendPerDataset = "all", ... )plotResidualsVsCovariate( plotData, metaData = NULL, mapping = ggplot2::aes(), xUnit = NULL, yUnit = NULL, residualScale = "log", xAxis = "observed", showLegendPerDataset = "all", ... )
plotData |
An object of class
|
metaData |
A list containing metadata for the plot. If NULL, a default list is constructed from the data. Expected structure includes information about dimensions and units for both x and y axes. |
mapping |
A ggplot2 aesthetic mapping object. Default is
|
xUnit |
A character string specifying the target unit for the time
values. (only relevant if |
yUnit |
A character string specifying the target unit for the simulated
and observed y-values used for residual calculation and (if |
residualScale |
Either "linear", "log", or "ratio" method for computing
residuals. Default is |
xAxis |
A character string specifying what to display on the x-axis.
Options are |
showLegendPerDataset |
Controls display of separate legend entries for individual datasets. One of:
User-provided |
... |
Arguments passed on to
|
Residuals are calculated by pairing observed and simulated data at matching time points within the same group. Only datasets that can be paired (i.e., have corresponding observed and simulated values) are included in the residual plot. The function automatically removes unpaired datasets with a warning, converts units to ensure consistent comparisons, and computes residuals as the difference between observed and predicted values.
The residualScale parameter controls how residuals are displayed:
linear: Absolute residuals (Observed - Predicted). Values centered around
zero indicate good model fit. Useful for normally distributed errors.
log: Log-transformed residuals, calculated as log(Observed / Predicted).
Values centered around zero indicate good fit. Preferred for log-normally
distributed data or when errors are proportional to magnitude.
ratio: Ratio of observed to predicted (Observed / Predicted). Values
centered around 1.0 indicate good fit. Useful for understanding relative
prediction error.
A ggplot2 plot object representing residuals vs time, observed, or
predicted values, or NULL if the data contains no plottable entries.
Other plot functions based on ospsuite.plots:
plotPredictedVsObserved(),
plotQuantileQuantilePlot(),
plotResidualsAsHistogram(),
plotTimeProfile()
# Generate a residuals vs observed plot for the provided data plotResidualsVsCovariate( dataCombinedAciclovir, xUnit = ospUnits$Time$h, yUnit = ospUnits$`Concentration [mass]`$`µg/l`, xAxis = "time", residualScale = 'linear' ) # Generate a residuals vs predicted plot plotResidualsVsCovariate(dataCombinedAciclovir, xAxis = "predicted") # Generate a residuals vs time plot plotResidualsVsCovariate(dataCombinedAciclovir, xAxis = "time") # Show individual dataset names in legend plotResidualsVsCovariate(dataCombinedAciclovir, showLegendPerDataset = "observed")# Generate a residuals vs observed plot for the provided data plotResidualsVsCovariate( dataCombinedAciclovir, xUnit = ospUnits$Time$h, yUnit = ospUnits$`Concentration [mass]`$`µg/l`, xAxis = "time", residualScale = 'linear' ) # Generate a residuals vs predicted plot plotResidualsVsCovariate(dataCombinedAciclovir, xAxis = "predicted") # Generate a residuals vs time plot plotResidualsVsCovariate(dataCombinedAciclovir, xAxis = "time") # Show individual dataset names in legend plotResidualsVsCovariate(dataCombinedAciclovir, showLegendPerDataset = "observed")
plotResidualsVsSimulated( dataCombined, defaultPlotConfiguration = NULL, scaling = "lin" )plotResidualsVsSimulated( dataCombined, defaultPlotConfiguration = NULL, scaling = "lin" )
dataCombined |
A single instance of |
defaultPlotConfiguration |
A |
scaling |
A character of length one specifying the scale type for residual. can be lin or log. |
Other plotting:
DefaultPlotConfiguration,
plotIndividualTimeProfile(),
plotObservedVsSimulated(),
plotPopulationTimeProfile(),
plotResidualsVsTime()
# Create a new instance of `DefaultPlotConfiguration` class myPlotConfiguration <- DefaultPlotConfiguration$new() myPlotConfiguration$title <- "My Plot Title" myPlotConfiguration$subtitle <- "My Plot Subtitle" myPlotConfiguration$caption <- "My Sources" # plot plotResidualsVsSimulated(dataCombinedAciclovir, scaling = "log", defaultPlotConfiguration = myPlotConfiguration )# Create a new instance of `DefaultPlotConfiguration` class myPlotConfiguration <- DefaultPlotConfiguration$new() myPlotConfiguration$title <- "My Plot Title" myPlotConfiguration$subtitle <- "My Plot Subtitle" myPlotConfiguration$caption <- "My Sources" # plot plotResidualsVsSimulated(dataCombinedAciclovir, scaling = "log", defaultPlotConfiguration = myPlotConfiguration )
plotResidualsVsTime( dataCombined, defaultPlotConfiguration = NULL, scaling = "lin" )plotResidualsVsTime( dataCombined, defaultPlotConfiguration = NULL, scaling = "lin" )
dataCombined |
A single instance of |
defaultPlotConfiguration |
A |
scaling |
A character of length one specifying the scale type for residual. can be lin or log. |
Other plotting:
DefaultPlotConfiguration,
plotIndividualTimeProfile(),
plotObservedVsSimulated(),
plotPopulationTimeProfile(),
plotResidualsVsSimulated()
# Create a new instance of `DefaultPlotConfiguration` class myPlotConfiguration <- DefaultPlotConfiguration$new() myPlotConfiguration$title <- "My Plot Title" myPlotConfiguration$subtitle <- "My Plot Subtitle" myPlotConfiguration$caption <- "My Sources" # plot plotResidualsVsTime( dataCombinedAciclovir, scaling = "lin", defaultPlotConfiguration = myPlotConfiguration )# Create a new instance of `DefaultPlotConfiguration` class myPlotConfiguration <- DefaultPlotConfiguration$new() myPlotConfiguration$title <- "My Plot Title" myPlotConfiguration$subtitle <- "My Plot Subtitle" myPlotConfiguration$caption <- "My Sources" # plot plotResidualsVsTime( dataCombinedAciclovir, scaling = "lin", defaultPlotConfiguration = myPlotConfiguration )
Creates a time profile plot for given data.
This function generates a time profile plot using ggplot2, where the data is grouped by a column named "group".
plotTimeProfile( plotData, metaData = NULL, mapping = ggplot2::aes(), observedMapping = NULL, xUnit = NULL, yUnit = NULL, y2Unit = NULL, aggregation = "quantiles", quantiles = ospsuite.plots::getOspsuite.plots.option(ospsuite.plots::OptionKeys$defaultPercentiles), nsd = 1, showLegendPerDataset = "all", ... )plotTimeProfile( plotData, metaData = NULL, mapping = ggplot2::aes(), observedMapping = NULL, xUnit = NULL, yUnit = NULL, y2Unit = NULL, aggregation = "quantiles", quantiles = ospsuite.plots::getOspsuite.plots.option(ospsuite.plots::OptionKeys$defaultPercentiles), nsd = 1, showLegendPerDataset = "all", ... )
plotData |
An object of class
|
metaData |
A list containing metadata for the plot. If NULL, a default list is constructed from the data. Expected structure includes information about dimensions and units for both x and y axes. |
mapping |
A ggplot2 aesthetic mapping object. Default is
|
observedMapping |
A ggplot2 aesthetic mapping for observed data. Default is NULL. Then a copy of mapping without line typical aesthetics like linetype and linewidth is used. |
xUnit |
A character string specifying the target unit for the x-axis. If
|
yUnit |
A character string specifying the target unit for the primary
y-axis. If |
y2Unit |
A character string specifying the target unit for the secondary
y-axis (only applicable when data contains two y-dimensions). If |
aggregation |
The type of the aggregation of simulated data. One of
|
quantiles |
A numerical vector with quantile values (Default: |
nsd |
Optional parameter specifying the number of standard deviations to
plot above and below the mean (used for error bars when aggregation is
"arithmetic" or "geometric"). Ignored if |
showLegendPerDataset |
Controls display of separate legend entries for individual datasets. One of:
User-provided |
... |
Arguments passed on to
|
When using a DataCombined object, the function automatically converts mixed
units to a common unit. The target unit is determined by the most frequently
occurring unit in the observed data (or simulated data if no observed data
exists). Concentration dimensions (Concentration (mass) and Concentration (molar)) are treated as compatible and can be converted between each other
if molecular weight is available.
The function automatically handles data containing different error type specifications:
If all data uses the same error type (ArithmeticStdDev or GeometricStdDev),
it is passed directly to the plotting function.
If data contains mixed error types, they are automatically converted to
yMin/yMax bounds:
ArithmeticStdDev: yMin = yValues - yErrorValues, yMax = yValues + yErrorValues
GeometricStdDev: yMin = yValues / yErrorValues, yMax = yValues * yErrorValues
For custom error types (not ArithmeticStdDev or GeometricStdDev), provide
error bounds directly in yMin and yMax columns.
A ggplot2 plot object representing the time profile, or NULL
if the data contains no plottable entries.
Other plot functions based on ospsuite.plots:
plotPredictedVsObserved(),
plotQuantileQuantilePlot(),
plotResidualsAsHistogram(),
plotResidualsVsCovariate()
# Generate a time profile plot for the provided data plotTimeProfile(dataCombinedAciclovir, xUnit = ospUnits$Time$h, yUnit = ospUnits$`Concentration [mass]`$`mg/l`) # Show individual dataset names for observed data only plotTimeProfile(dataCombinedAciclovir, showLegendPerDataset = "observed") # Show individual dataset names for simulated data only plotTimeProfile(dataCombinedAciclovir, showLegendPerDataset = "simulated") # Show individual dataset names for both observed and simulated plotTimeProfile(dataCombinedAciclovir, showLegendPerDataset = "all")# Generate a time profile plot for the provided data plotTimeProfile(dataCombinedAciclovir, xUnit = ospUnits$Time$h, yUnit = ospUnits$`Concentration [mass]`$`mg/l`) # Show individual dataset names for observed data only plotTimeProfile(dataCombinedAciclovir, showLegendPerDataset = "observed") # Show individual dataset names for simulated data only plotTimeProfile(dataCombinedAciclovir, showLegendPerDataset = "simulated") # Show individual dataset names for both observed and simulated plotTimeProfile(dataCombinedAciclovir, showLegendPerDataset = "all")
List of individuals used in a population simulation
rSharp::NetObject -> DotNetWrapper -> Population
countthe number of individual in the population
allCovariateNamesthe names of all covariates defined in the population
allParameterPathsthe paths of all parameters defined in the population
allIndividualIdsIds of individuals defined in the population
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DotNetWrapper$initialize()Population$has()Returns TRUE if the population has variability defined for parameterOrPath otherwise FALSE
Population$has(parameterOrPath)
parameterOrPathParameter instance of parameter path
Population$setParameterValues()Updates or adds the variability values in the population for parameterOrPath.
Population$setParameterValues(parameterOrPath, values)
parameterOrPathParameter instance of parameter path. If an entry already exists for this parameter by path, its values be overwritten, otherwise it will be created.
valuesdouble vector containing the value to set for the parameterOrPath
Population$getParameterValues()Returns the variability values defined in the population for parameterOrPath
Population$getParameterValues(parameterOrPath)
parameterOrPathParameter instance of parameter path
Population$getCovariateValues()Returns the values defined in the population for the covariate named covariateName
Population$getCovariateValues(covariateName)
covariateNameName of covariate for which values should be retrieved
Population$getCovariateValue()Returns the values defined in the population for the covariate named covariateName and individual with id individualId
Population$getCovariateValue(covariateName, individualId)
covariateNameName of covariate for which values should be retrieved
individualIdId of individual for which the value for covariate covariateName should be retrieved
Population$getParameterValuesForIndividual()Returns all values defined in the population the individual with id individualId
Population$getParameterValuesForIndividual(individualId)
individualIdId of individual for which all values should be returned
Population$remove()Removes the value of a parameter by path
Population$remove(parameterPath)
parameterPathPath of the parameter values to remove
Population$print()Print the object to the console
Population$print(...)
...Rest arguments.
Characteristics of a population used for population creation
rSharp::NetObject -> DotNetWrapper -> PopulationCharacteristics
numberOfIndividualsNumber of individuals in the population
proportionOfFemalesProportion of female in the population
speciesSpecifies the species of the individual. It should be a species available in PK-Sim (see Species)
populationFor a Human species, the population of interest. It should be a population available in PK-Sim (see HumanPopulation)
ageAge range of the population as in instance of a ParameterRange (optional)
gestationalAgeGestational Age range of the population as in instance of a ParameterRange (optional)
weightWeight range of the population as in instance of a ParameterRange (optional)
heightHeight range of the population as in instance of a ParameterRange (optional)
BMIBMI range of the population as in instance of a ParameterRange (optional)
allMoleculeOntogeniesAll molecule ontogenies defined for this population characteristics.
seedSeed used to generate the population
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()PopulationCharacteristics$new()Initialize a new instance of the class
PopulationCharacteristics$new()
A new PopulationCharacteristics object.
PopulationCharacteristics$print()Print the object to the console
PopulationCharacteristics$print(...)
...Rest arguments.
PopulationCharacteristics$addMoleculeOntogeny()Add a molecule ontogeny MoleculeOntogeny to the individual characteristics
PopulationCharacteristics$addMoleculeOntogeny(moleculeOntogeny)
moleculeOntogenyMolecule ontogeny to add
Population object from a data.frameCreates a Population object from a data.frame
populationFromDataFrame(dataFrame)populationFromDataFrame(dataFrame)
dataFrame |
A data.frame containing population data. Each column represents
a parameter path or covariate, with one row per individual. If no |
A Population object
csvPath <- system.file("extdata", "pop.csv", package = "ospsuite") population <- loadPopulation(csvPath) df <- populationToDataFrame(population) populationFromDf <- populationFromDataFrame(df)csvPath <- system.file("extdata", "pop.csv", package = "ospsuite") population <- loadPopulation(csvPath) df <- populationToDataFrame(population) populationFromDf <- populationFromDataFrame(df)
Creates a data.frame containing one column for each parameter defined in the population
populationToDataFrame(population) populationToTibble(population)populationToDataFrame(population) populationToTibble(population)
population |
Population to convert to data frame (typically imported from file using |
csvPath <- system.file("extdata", "pop.csv", package = "ospsuite") population <- loadPopulation(csvPath) df <- populationToDataFrame(population)csvPath <- system.file("extdata", "pop.csv", package = "ospsuite") population <- loadPopulation(csvPath) df <- populationToDataFrame(population)
Returns an array of parameter path with one entry for each parameter that is used in the simulation and can potentially be used for sensitivity analysis
potentialVariableParameterPathsFor(simulation)potentialVariableParameterPathsFor(simulation)
simulation |
Instance of a simulation for which variable parameters should be retrieved |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath) parameterPaths <- potentialVariableParameterPathsFor(sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath) parameterPaths <- potentialVariableParameterPathsFor(sim)
A quantity of the model (with unit, value) such as a Parameter or an Amount
rSharp::NetObject -> DotNetWrapper -> ObjectBase -> Entity -> Quantity
valueThe value of the quantity in unit
unitThe base unit in which the quantity value is defined (Read-Only)
displayUnitThe unit in which the quantity value is usually displayed (Read-Only)
dimensionThe dimension in which the quantity is defined (Read-Only)
allUnitsthe list of all supported units (Read-Only)
quantityTypeThe type of the quantity (Read-Only)
formulaAn instance of a Formula object used by this quantity (Read-Only)
isTableReturns TRUE if the formula used by this quantity is a table formula otherwise FALSE
isConstantReturns TRUE if the formula used by this quantity is a constant formula otherwise FALSE
isFormulaReturns TRUE if the formula used by this quantity is an explicit formula (e.g an equation) otherwise FALSE
isDistributedReturns TRUE if the quantity represents a quantity with an underlying distribution otherwise FALSE
formulaStringReturns the equation of the formula for a quantity using an explicit formula (e.g. isFormula == TRUE) or NULL for a quantity that does not use an explicit formula.
isFixedValueReturns TRUE if the formula was overridden by a constant value, otherwise FALSE
valueOriginThe value origin of the quantity (Read-Only)
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()Quantity$new()Initialize a new instance of the class
Quantity$new(netObject)
netObjectA NetObject object with the pointer to the .NET Quantity
A new Quantity object.
Quantity$print()Print the object to the console
Quantity$print(...)
...Rest arguments.
Quantity$printValue()Print the name of the quantity and its value
Quantity$printValue()
Quantity$printQuantityValue()Print the value (in scientific notation with 2 digits when needed) and unit of the quantity
Quantity$printQuantityValue(caption)
captionText to prepend to the value
Quantity$getPrintValue()Return a string for printing the value (in scientific notation with 2 digits when needed) and unit of the quantity
Quantity$getPrintValue()
A string for printing the quantity in one line
Quantity$setValue()Convert value from unit to the base unit and sets the value in base unit.
Quantity$setValue(value, unit = NULL)
valueValue to set. If unit is null, we assume that the value is in base unit
unitOptional unit in which the value is given.
Quantity$hasUnit()Returns TRUE if the quantity supports the given unit otherwise FALSE.
For the list of supported units, use allUnits
Quantity$hasUnit(unit)
unitUnit to check
Quantity$reset()Ensures that the quantity uses the value computed by its formula. It is a shortcut for self$isFixedValue <- false.
Quantity$reset()
pK-Parameter values for all individuals of a simulation (1 or more) calculated for a specific quantity with path quantityPath
rSharp::NetObject -> DotNetWrapper -> QuantityPKParameter
valuesAll values for quantityPath and name
quantityPathThe path of the quantity for which the values were calculated
nameThe name of the pK-Parameter (AUC, Cmax, Tmax etc...)
unitBase unit in which the pk parameter was calculated
dimensionDimension in which the pk parameter was calculated
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()QuantityPKParameter$new()Initialize a new instance of the class
QuantityPKParameter$new(netObject)
netObjectAn rSharp::NetObject object.
A new QuantityPKParameter object.
QuantityPKParameter$print()Print the object to the console
QuantityPKParameter$print(...)
...Rest arguments.
List of quantities selected as output for a given simulation
rSharp::NetObject -> DotNetWrapper -> QuantitySelection
pathPath of selected quantity
quantityTypeType of selected quantity
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DotNetWrapper$initialize()QuantitySelection$print()Print the object to the console
QuantitySelection$print(...)
...Rest arguments.
Removes all User-Defined PK-Parameters that may have been added to the system
removeAllUserDefinedPKParameters()removeAllUserDefinedPKParameters()
Removes a simulation from simulations cache.
removeSimulationFromCache(simulation)removeSimulationFromCache(simulation)
simulation |
Simulation to be removed from the cache |
TRUE if the simulation was cached and could be removed from cache. FALSE otherwise, usually indicating that the specific simulation was not cached.
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim1 <- loadSimulation(simPath) sim2 <- loadSimulation(simPath, loadFromCache = FALSE, addToCache = FALSE) removeSimulationFromCache(sim1) # returns TRUE removeSimulationFromCache(sim2) # returns FALSEsimPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim1 <- loadSimulation(simPath) sim2 <- loadSimulation(simPath, loadFromCache = FALSE, addToCache = FALSE) removeSimulationFromCache(sim1) # returns TRUE removeSimulationFromCache(sim2) # returns FALSE
Clears cache of loaded simulations
resetSimulationCache()resetSimulationCache()
Runs a sensitivity analysis
runSensitivityAnalysis( sensitivityAnalysis, sensitivityAnalysisRunOptions = NULL )runSensitivityAnalysis( sensitivityAnalysis, sensitivityAnalysisRunOptions = NULL )
sensitivityAnalysis |
Instance of a |
sensitivityAnalysisRunOptions |
Optional instance of a |
SimulationResults (one entry per Individual)
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Create a new sensitivity object for the simulation sensitivity <- SensitivityAnalysis$new(sim) # Runs the sensitivity analysis results <- runSensitivityAnalysis(sensitivity)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Create a new sensitivity object for the simulation sensitivity <- SensitivityAnalysis$new(sim) # Runs the sensitivity analysis results <- runSensitivityAnalysis(sensitivity)
Run simulation batches
runSimulationBatches( simulationBatches, simulationRunOptions = NULL, silentMode = FALSE, stopIfFails = FALSE )runSimulationBatches( simulationBatches, simulationRunOptions = NULL, silentMode = FALSE, stopIfFails = FALSE )
simulationBatches |
List of |
simulationRunOptions |
Optional instance of a |
silentMode |
If |
stopIfFails |
Whether to stop the execution if one of the simulations failed. Default is |
Runs a set of simulation batches. The simulation batches must be populated
with sets of parameter and start values with SimulationBatch$addRunValues()
prior to running. After the run, the list of parameter and start values is cleared.
Nested list of SimulationResults objects. The first level of the
fist are the IDs of the SimulationBatches, containing a list of
SimulationResults for each set of parameter/initial values. If a simulation
with a parameter/initial values set fails, the result for this run is NULL
## Not run: sim1 <- loadSimulation("sim1", loadFromCache = TRUE) sim2 <- loadSimulation("sim2", loadFromCache = TRUE) parameters <- c("Organism|Liver|Volume", "R1|k1") molecules <- "Organism|Liver|A" # Create two simulation batches. simulationBatch1 <- createSimulationBatch( simulation = sim1, parametersOrPaths = parameters, moleculesOrPaths = molecules ) simulationBatch2 <- createSimulationBatch( simulation = sim2, parametersOrPaths = parameters, moleculesOrPaths = molecules ) # Ids of run values ids <- c() ids[[1]] <- simulationBatch1$addRunValues(parameterValues = c(1, 2), initialValues = 1) ids[[2]] <- simulationBatch1$addRunValues(parameterValues = c(1.6, 2.4), initialValues = 3) ids[[3]] <- simulationBatch2$addRunValues(parameterValues = c(4, 2), initialValues = 4) ids[[4]] <- simulationBatch2$addRunValues(parameterValues = c(2.6, 4.4), initialValues = 5) res <- runSimulationBatches(simulationBatches = list(simulationBatch1, simulationBatch2)) ## End(Not run)## Not run: sim1 <- loadSimulation("sim1", loadFromCache = TRUE) sim2 <- loadSimulation("sim2", loadFromCache = TRUE) parameters <- c("Organism|Liver|Volume", "R1|k1") molecules <- "Organism|Liver|A" # Create two simulation batches. simulationBatch1 <- createSimulationBatch( simulation = sim1, parametersOrPaths = parameters, moleculesOrPaths = molecules ) simulationBatch2 <- createSimulationBatch( simulation = sim2, parametersOrPaths = parameters, moleculesOrPaths = molecules ) # Ids of run values ids <- c() ids[[1]] <- simulationBatch1$addRunValues(parameterValues = c(1, 2), initialValues = 1) ids[[2]] <- simulationBatch1$addRunValues(parameterValues = c(1.6, 2.4), initialValues = 3) ids[[3]] <- simulationBatch2$addRunValues(parameterValues = c(4, 2), initialValues = 4) ids[[4]] <- simulationBatch2$addRunValues(parameterValues = c(2.6, 4.4), initialValues = 5) res <- runSimulationBatches(simulationBatches = list(simulationBatch1, simulationBatch2)) ## End(Not run)
Runs multiple simulations concurrently.
runSimulations( simulations, population = NULL, agingData = NULL, simulationRunOptions = NULL, silentMode = FALSE, stopIfFails = FALSE )runSimulations( simulations, population = NULL, agingData = NULL, simulationRunOptions = NULL, silentMode = FALSE, stopIfFails = FALSE )
simulations |
One |
population |
Optional instance of a |
agingData |
Optional instance of |
simulationRunOptions |
Optional instance of a |
silentMode |
If |
stopIfFails |
Whether to stop the execution if one of the simulations failed. Default is |
For multiple simulations, only individual simulations are possible. For single simulation, either individual or population simulations can be performed.
A named list of SimulationResults objects with names being the IDs
of the respective simulations. If a simulation fails, the result for this
simulation is NULL
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Running an individual simulation # Results is a list with one object `SimulationResults` results <- runSimulations(sim) # Creating custom simulation run options simRunOptions <- SimulationRunOptions$new() simRunOptions$numberOfCores <- 3 simRunOptions$showProgress <- TRUE # Running a population simulation popPath <- system.file("extdata", "pop.csv", package = "ospsuite") population <- loadPopulation(popPath) results <- runSimulations(sim, population, simulationRunOptions = simRunOptions)[[1]] # Running multiple simulations in parallel sim2 <- loadSimulation(simPath) # Results is a list of `SimulationResults` results <- runSimulations(list(sim, sim2))simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Running an individual simulation # Results is a list with one object `SimulationResults` results <- runSimulations(sim) # Creating custom simulation run options simRunOptions <- SimulationRunOptions$new() simRunOptions$numberOfCores <- 3 simRunOptions$showProgress <- TRUE # Running a population simulation popPath <- system.file("extdata", "pop.csv", package = "ospsuite") population <- loadPopulation(popPath) results <- runSimulations(sim, population, simulationRunOptions = simRunOptions)[[1]] # Running multiple simulations in parallel sim2 <- loadSimulation(simPath) # Results is a list of `SimulationResults` results <- runSimulations(list(sim, sim2))
Run Simulations From Snapshot Files
runSimulationsFromSnapshot( ..., output = ".", RunForAllOutputs = FALSE, exportCSV = TRUE, exportPKML = FALSE, exportJSON = FALSE, exportXML = FALSE )runSimulationsFromSnapshot( ..., output = ".", RunForAllOutputs = FALSE, exportCSV = TRUE, exportPKML = FALSE, exportJSON = FALSE, exportXML = FALSE )
... |
character strings, path to snapshot files or a directory containing snapshot files |
output |
character string, path to the output directory where to write simulation results |
RunForAllOutputs |
logical, whether to run the simulation for all outputs or only OutputSelections (default = FALSE) |
exportCSV |
logical, whether to export the results as csv (default = TRUE) |
exportPKML |
logical, whether to export the results as pkml (default = FALSE) |
exportJSON |
logical, whether to export simulation results as json (default = FALSE) |
exportXML |
logical, whether to export the results as xml (default = FALSE) |
## Not run: runSimulationsFromSnapshot("path/to/my_snapshot.json", csv = TRUE, pkml = TRUE) ## End(Not run)## Not run: runSimulationsFromSnapshot("path/to/my_snapshot.json", csv = TRUE, pkml = TRUE) ## End(Not run)
DataSet to pkmlSave the DataSet to pkml
saveDataSetToPKML(dataSet, filePath)saveDataSetToPKML(dataSet, filePath)
dataSet |
The |
filePath |
Path where the pkml file will be created |
Save the DataSet to a pkml file that can be loaded by MoBi
## Not run: dataSet <- DataSet$new(name = "NewDataSet") dataSet$setValues(xValues = c(1, 2, 3, 4, 5), yValues = c(10, 20, 30, 40, 50)) dataSet$saveToPKML(filePath = "../ObsData.pkml") ## End(Not run)## Not run: dataSet <- DataSet$new(name = "NewDataSet") dataSet$setValues(xValues = c(1, 2, 3, 4, 5), yValues = c(10, 20, 30, 40, 50)) dataSet$saveToPKML(filePath = "../ObsData.pkml") ## End(Not run)
Saves a simulation to pkml file
saveSimulation(simulation, filePath)saveSimulation(simulation, filePath)
simulation |
Instance of a simulation to save. |
filePath |
Full path of where the simulation will be saved. |
Scale current values of parameters using a factor
scaleParameterValues(parameters, factor)scaleParameterValues(parameters, factor)
parameters |
A single or a list of |
factor |
A numeric value that will be used to scale all parameters |
getParameter() and getAllParametersMatching() to create objects of type Parameter
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) param <- getParameter("Organism|Liver|Volume", sim) scaleParameterValues(param, 1) params <- getAllParametersMatching("Organism|**|Volume", sim) scaleParameterValues(params, 1.5)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) param <- getParameter("Organism|Liver|Volume", sim) scaleParameterValues(param, 1) params <- getAllParametersMatching("Organism|**|Volume", sim) scaleParameterValues(params, 1.5)
Supports Sensitivity Analysis workflow to assess the impact of input parameters on the simulation outputs
rSharp::NetObject -> DotNetWrapper -> SensitivityAnalysis
simulationReference to the Simulation used to calculate or import the sensitivity analysis results (Read-Only).
numberOfStepsNumber of steps used for the variation of each parameter in one direction from the reference value.
The parameter is varied in both positive and negative directions, so the total number of variations per parameter
is 2 * numberOfSteps. For example, numberOfSteps = 2 with variationRange = 0.1 tests the parameter at
four points: 90%, 95%, 105%, and 110% of the reference value.
Default value can be retrieved with getOSPSuiteSetting("sensitivityAnalysisConfig")$numberOfSteps.
variationRangeRelative variation range applied to each parameter. This defines the total range of variation
from the reference value. For example, variationRange = 0.1 means ±10% variation.
Combined with numberOfSteps = 2, the parameter would be tested at 90%, 95%, 105%, and 110% of its reference value
(i.e., the variation range is divided into numberOfSteps equal intervals in each direction).
Default value can be retrieved with getOSPSuiteSetting("sensitivityAnalysisConfig")$variationRange.
parameterPathsList of parameters to use for sensitivity calculation. If empty, the sensitivity will be performed automatically on all constant parameters that are really in use in the simulation. Constant parameter means all parameters with a constant value or a formula parameter with a value that was overridden by the user
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()SensitivityAnalysis$new()Initialize a new instance of the class
SensitivityAnalysis$new( simulation, parameterPaths = NULL, numberOfSteps = ospsuiteEnv$sensitivityAnalysisConfig$numberOfSteps, variationRange = ospsuiteEnv$sensitivityAnalysisConfig$variationRange )
simulationSimulation for which a sensitivity analysis should be performed
parameterPathsVector of parameter paths to use for sensitivity calculation (optional). If undefined, the sensitivity will be performed automatically on all constant parameters of the simulation. Constant parameter means all parameters with a constant value or a formula parameter with a value that was overridden by the user
numberOfStepsNumber of steps used for the variation of each parameter in one direction
from the reference value (optional, default specified in getOSPSuiteSetting("sensitivityAnalysisConfig")).
The parameter is varied in both positive and negative directions, so the total number of variations
per parameter is 2 * numberOfSteps. For example, with numberOfSteps = 2 and variationRange = 0.1,
each parameter will be tested at four points: 90% (refValue * 0.9), 95% (refValue * 0.95),
105% (refValue * 1.05), and 110% (refValue * 1.1) of its reference value.
The total number of simulations is 2 * numberOfSteps * number_of_parameters.
variationRangeRelative variation range applied to each parameter (optional, default specified in getOSPSuiteSetting("sensitivityAnalysisConfig")).
This defines the total range of variation. For example, variationRange = 0.1 means ±10% variation.
The variation range is divided into numberOfSteps equal intervals in each direction (positive and negative).
A new SensitivityAnalysis object.
SensitivityAnalysis$addParameterPaths()Adds the parameterPaths to the list of parameter path to vary in the sensitivity analysis
SensitivityAnalysis$addParameterPaths(parameterPaths)
parameterPathsParameter paths to add (single or multiple values)
If no parameters were specified during creating of a SensitivityAnalysis (all constant parameters are considered),
calling addParameterPaths will make only the manually added parameters being varied.
SensitivityAnalysis$clearParameterPaths()Removes all parameter paths defined in the Sensitivity Analysis
SensitivityAnalysis$clearParameterPaths()
SensitivityAnalysis$print()Print the object to the console
SensitivityAnalysis$print(...)
...Rest arguments.
Results of a sensitivity analysis run (either individual or population simulation).
rSharp::NetObject -> DotNetWrapper -> SensitivityAnalysisResults
simulationReference to the Simulation used to calculate or
import the sensitivity analysis results (Read-Only).
countthe number of pk parameter sensitivity entries
allPKParameterNamesReturns the name of all PK-Parameters available in this results. This will be a subset of all potential PK-Parameters available in the system.
allQuantityPathsReturns the path of all outputs available in this results.
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()SensitivityAnalysisResults$new()Initialize a new instance of the class
SensitivityAnalysisResults$new(netObject, simulation)
netObjectA NetObject.
simulationReference to the simulation object used to calculated the results.
A new SensitivityAnalysisResults object.
SensitivityAnalysisResults$allPKParameterSensitivitiesFor()Returns the PKParameterSensitivity for a given pkParameter and output
participating to a total sensitivity greater or equal to
totalSensitivityThreshold.
SensitivityAnalysisResults$allPKParameterSensitivitiesFor(
pkParameterName,
outputPath,
totalSensitivityThreshold =
ospsuiteEnv$sensitivityAnalysisConfig$totalSensitivityThreshold
)
pkParameterNameName of pkParameter for which sensitivity should
be retrieved.
outputPathPath of the output for which the sensitivity should be retrieved
totalSensitivityThresholdThreshold used to filter out the most
sensitive parameter. A threshold of 0.9 means that only parameter
participating to a total of 90 percent of the sensitivity would be
returned. A value of 1 would return the sensitivity for all
parameters. For a detailed explanation of how this threshold is used,
see OSPS documentation.
The default value can be retrieved with
getOSPSuiteSetting("sensitivityAnalysisConfig")$totalSensitivityThreshold
and can be changed by setting
ospsuiteEnv$sensitivityAnalysisConfig$totalSensitivityThreshold <- newValue.
SensitivityAnalysisResults$pkParameterSensitivityValueFor()Returns the sensitivity value for a given pkParameter, output and model
parameter (either by path or by name). If the sensitivity result does not
exist, returns NaN.
SensitivityAnalysisResults$pkParameterSensitivityValueFor( pkParameterName, outputPath, parameterName = NULL, parameterPath = NULL )
pkParameterNameName of pkParameter for which sensitivity should
be retrieved.
outputPathPath of the output for which the sensitivity should be retrieved.
parameterNameName of the sensitivity parameter for which the sensitivity should be retrieved.
parameterPathPath of the sensitivity parameter for which the sensitivity should be retrieved. Wildcards (*) not accepted.
SensitivityAnalysisResults$print()Print the object to the console
SensitivityAnalysisResults$print(...)
...Rest arguments.
Options to be passed to the sensitivity analysis engine
rSharp::NetObject -> DotNetWrapper -> SensitivityAnalysisRunOptions
numberOfCores(Maximal) number of cores to be used. Per default set to getOSPSuiteSetting("numberOfCores").
showProgressSpecifies whether a progress bar should be shown during sensitivity analysis. If TRUE, a progress bar is shown in the console,
indicating the progress of the sensitivity analysis calculations. Default is getOSPSuiteSetting("showProgress").
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()SensitivityAnalysisRunOptions$new()Initialize a new instance of the class
SensitivityAnalysisRunOptions$new(numberOfCores = NULL, showProgress = NULL)
numberOfCoresNumber of cores to use for the simulation. Default value is getOSPSuiteSetting("numberOfCores")
showProgressShould a progress bar be displayed during sensitivity analysis. If TRUE, a progress bar is shown in the console,
indicating the progress of the sensitivity analysis calculations. Default value is getOSPSuiteSetting("showProgress")
A new SensitivityAnalysisRunOptions object.
SensitivityAnalysisRunOptions$print()Print the object to the console
SensitivityAnalysisRunOptions$print(...)
...Rest arguments.
Set molecule start values
setMoleculeInitialValues(molecules, values, units = NULL)setMoleculeInitialValues(molecules, values, units = NULL)
molecules |
A single or a list of |
values |
A numeric value that should be assigned to the molecule start value or a vector
of numeric values, if the start value of more than one molecule should be changed. Must have the same
length as |
units |
A string or a list of strings defining the units of the
|
getMolecule() and getAllMoleculesMatching() to retrieve objects of type Molecule
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) molecule <- getMolecule("Organism|Liver|A", sim) setMoleculeInitialValues(molecule, 1) molecules <- getAllMoleculesMatching("Organism|**|A", sim) setMoleculeInitialValues(molecules, c(2, 3), units = c("pmol", "mmol"))simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) molecule <- getMolecule("Organism|Liver|A", sim) setMoleculeInitialValues(molecule, 1) molecules <- getAllMoleculesMatching("Organism|**|A", sim) setMoleculeInitialValues(molecules, c(2, 3), units = c("pmol", "mmol"))
Set molecule scale divisors
setMoleculeScaleDivisors(molecules, values)setMoleculeScaleDivisors(molecules, values)
molecules |
A single or a list of |
values |
A numeric value that should be assigned to the molecule scale factor or a vector
of numeric values, if the scale factor of more than one molecule should be changed. Must have the same
length as |
getMolecule() and getAllMoleculesMatching() to retrieve objects of type Molecule
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) molecule <- getMolecule("Organism|Liver|A", sim) setMoleculeScaleDivisors(molecule, 0.001) molecules <- getAllMoleculesMatching("Organism|**|A", sim) setMoleculeScaleDivisors(molecules, c(0.002, 0.003))simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) molecule <- getMolecule("Organism|Liver|A", sim) setMoleculeScaleDivisors(molecule, 0.001) molecules <- getAllMoleculesMatching("Organism|**|A", sim) setMoleculeScaleDivisors(molecules, c(0.002, 0.003))
Set molecule start values in the simulation by path
setMoleculeValuesByPath( moleculePaths, values, simulation, units = NULL, stopIfNotFound = TRUE )setMoleculeValuesByPath( moleculePaths, values, simulation, units = NULL, stopIfNotFound = TRUE )
moleculePaths |
A single or a list of molecule paths |
values |
A numeric value that should be assigned to the molecule start value or a vector
of numeric values, if the start value of more than one molecule should be changed. Must have the same
length as |
simulation |
Simulation containing the quantities |
units |
A string or a list of strings defining the units of the
|
stopIfNotFound |
Boolean. If |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) setMoleculeValuesByPath("Organism|Liver|A", 1, sim) setMoleculeValuesByPath( c("Organism|Liver|A", "Organism|Liver|B"), c(2, 3), sim, units = c("\u00b5mol", "mmol") )simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) setMoleculeValuesByPath("Organism|Liver|A", 1, sim) setMoleculeValuesByPath( c("Organism|Liver|A", "Organism|Liver|B"), c(2, 3), sim, units = c("\u00b5mol", "mmol") )
Clears the output interval from the simulation and adds a new one.
setOutputInterval( simulation, startTime, endTime, resolution, intervalName = NULL )setOutputInterval( simulation, startTime, endTime, resolution, intervalName = NULL )
simulation |
Simulation for which a new interval should be created |
startTime |
Start time of the interval in min |
endTime |
End time of the interval in min |
resolution |
resolution in points/min |
intervalName |
Optional Name of interval. If not specified, a unique name will be assigned. |
Returns the interval created.
This is essentially a shortcut for clearOutputIntervals followed by addOutputInterval
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath, addToCache = FALSE, loadFromCache = FALSE) # Adds a new interval starting at 1h and ending at 10h with a resolution of 10 points per hour setOutputInterval(sim, 1 * 60, 10 * 60, 1 / 6)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") # Load the simulation sim <- loadSimulation(simPath, addToCache = FALSE, loadFromCache = FALSE) # Adds a new interval starting at 1h and ending at 10h with a resolution of 10 points per hour setOutputInterval(sim, 1 * 60, 10 * 60, 1 / 6)
Sets the quantities as output of the simulation.
The quantities can either be specified using explicit instances or using paths.
This function clears the output selection before adding the new quantities.
See addOutputs for adding quantities without clearing the output selection.
See clearOutputs for clearing the output selection without adding new quantities.
setOutputs(quantitiesOrPaths, simulation, stopIfNotFound = TRUE)setOutputs(quantitiesOrPaths, simulation, stopIfNotFound = TRUE)
quantitiesOrPaths |
Quantity instances (element or vector) (typically
retrieved using |
simulation |
Instance of a simulation for which output selection should be updated. |
stopIfNotFound |
Boolean. If |
Set values of parameters
setParameterValues(parameters, values, units = NULL)setParameterValues(parameters, values, units = NULL)
parameters |
A single or a list of |
values |
A numeric value that should be assigned to the parameter or a vector of numeric values, if the value of more than one parameter should be changed. Must have the same length as 'parameters'. Alternatively, the value can be a unique number. In that case, the same value will be set in all parameters |
units |
A string or a list of strings defining the units of the
|
getParameter() and getAllParametersMatching() to create objects of type Parameter
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) param <- getParameter("Organism|Liver|Volume", sim) setParameterValues(param, 1) params <- getAllParametersMatching("Organism|**|Volume", sim) setParameterValues(params, c(2, 3, 4), units = c("ml", "l", "ml"))simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) param <- getParameter("Organism|Liver|Volume", sim) setParameterValues(param, 1) params <- getAllParametersMatching("Organism|**|Volume", sim) setParameterValues(params, c(2, 3, 4), units = c("ml", "l", "ml"))
Set the values of parameters in the simulation by path
setParameterValuesByPath( parameterPaths, values, simulation, units = NULL, stopIfNotFound = TRUE )setParameterValuesByPath( parameterPaths, values, simulation, units = NULL, stopIfNotFound = TRUE )
parameterPaths |
A single or a list of parameter path |
values |
A numeric value that should be assigned to the parameters or a vector of numeric values, if the value of more than one parameter should be changed. Must have the same length as 'parameterPaths' |
simulation |
Simulation uses to retrieve parameter instances from given paths. |
units |
A string or a list of strings defining the units of the
|
stopIfNotFound |
Boolean. If |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) setParameterValuesByPath("Organism|Liver|Volume", 1, sim) setParameterValuesByPath(c("Organism|Liver|Volume", "Organism|Volume"), c(2, 3), sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) setParameterValuesByPath("Organism|Liver|Volume", 1, sim) setParameterValuesByPath(c("Organism|Liver|Volume", "Organism|Volume"), c(2, 3), sim)
Set the values of quantities in the simulation by path
setQuantityValuesByPath( quantityPaths, values, simulation, units = NULL, stopIfNotFound = TRUE )setQuantityValuesByPath( quantityPaths, values, simulation, units = NULL, stopIfNotFound = TRUE )
quantityPaths |
A single or a list of absolute quantity paths |
values |
A numeric value that should be assigned to the quantities or a vector of numeric values, if the value of more than one quantity should be changed. Must have the same length as 'quantityPaths'. |
simulation |
Simulation containing the quantities |
units |
A string or a list of strings defining the units of the
|
stopIfNotFound |
Boolean. If |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) setQuantityValuesByPath("Organism|Liver|Volume", 1, sim) setParameterValuesByPath(list("Organism|Liver|Volume", "Organism|Liver|A"), c(2, 3), sim)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) setQuantityValuesByPath("Organism|Liver|Volume", 1, sim) setParameterValuesByPath(list("Organism|Liver|Volume", "Organism|Liver|A"), c(2, 3), sim)
An OSPSuite simulation
rSharp::NetObject -> DotNetWrapper -> ObjectBase -> Simulation
rootRoot container of the simulation (read-only)
pathPath of the root container of the simulation (read-only)
solverSimulationSolver object for the simulation (read-only)
outputSchemaoutputSchema object for the simulation (read-only)
outputSelectionsoutputSelections object for the simulation (read-only)
sourceFilePath to the file the simulation was loaded from (read-only)
nameName of the simulation
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()Simulation$new()Initialize a new instance of the class
Simulation$new(netObject, sourceFile = NULL)
netObjectReference to NetObject .NET simulation object
sourceFile(Optional) File used to load the simulation
A new Simulation object.
Simulation$allEndogenousStationaryMoleculeNames()Returns the name of all endogenous stationary molecules defined in the simulation. (e.g. with the flag IsStationary = TRUE) This is a typically a molecule that is individual specific such as en Enzyme, Protein, Transporter, FcRn etc.
Simulation$allEndogenousStationaryMoleculeNames()
Simulation$allXenobioticFloatingMoleculeNames()Returns the name of all xenobiotic floating molecules defined in the simulation. (e.g. with the flag IsStationary = FALSE) This is typically a molecule that is being explicitly simulated such as Compound, Inhibitor, DrugComplex.
Simulation$allXenobioticFloatingMoleculeNames()
Simulation$allStationaryMoleculeNames()Returns the name of all stationary molecules defined in the simulation. (e.g. with the flag IsStationary = TRUE)
Simulation$allStationaryMoleculeNames()
Simulation$allFloatingMoleculeNames()Returns the name of all floating molecules defined in the simulation. (e.g. with the flag IsStationary = FALSE)
Simulation$allFloatingMoleculeNames()
Simulation$molWeightFor()Returns the mol weight value (in core unit) associated to the quantity with given path or NA if not found
Simulation$molWeightFor(quantityPath)
quantityPathPath of quantity used to retrieve the molecular weight
Simulation$allApplicationsFor()Returns the applications ordered by start time associated to the quantity with path quantityPath or an empty list if not found
Simulation$allApplicationsFor(quantityPath)
quantityPathPath of quantity used to retrieve the applications (e.g. applications resulting in this quantity being applied)
Simulation$print()Print the object to the console
Simulation$print(...)
...Rest arguments.
An optimized simulation with faster loading. The corresponding .NET class is "OSPSuite.R.Services.ConcurrentRunSimulationBatch"
rSharp::NetObject -> DotNetWrapper -> SimulationBatch
simulationUnderlying simulation used for the batch run. Read only.
runValuesIdsIds of the run values that will be executed on next run
idThe id of the .NET wrapped object. (read-only)
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()SimulationBatch$new()Initialize a new instance of the class
SimulationBatch$new(netObject, simulation)
netObjectAn rSharp::NetObject object.
simulationSimulation used in the batch run
A new SimulationBatch object.
SimulationBatch$addRunValues()Add a set of parameter and start values for next execution.
SimulationBatch$addRunValues(parameterValues = NULL, initialValues = NULL)
parameterValuesVector of parameter values to set in the simulation (default is NULL)
initialValuesVector of initial values to set in the simulation (default is NULL)
Intended for the use with runSimulationBatches. The simulation batch is executed
with the sets of parameter and initial values that have been scheduled.
The set of run values is cleared after successful run.
Id of the values set that can be used to get the correct result from runSimulationBatches.
sim1 <- loadSimulation("sim1", loadFromCache = TRUE)
sim2 <- loadSimulation("sim2", loadFromCache = TRUE)
parameters <- c("Organism|Liver|Volume", "R1|k1")
molecules <- "Organism|Liver|A"
# Create two simulation batches.
simulationBatch1 <- createSimulationBatch(simulation = sim1,
parametersOrPaths = parameters,
moleculesOrPaths = molecules)
simulationBatch2 <- createSimulationBatch(simulation = sim2,
parametersOrPaths = parameters,
moleculesOrPaths = molecules)
#Ids of run values
ids <- c()
ids[[1]] <- simulationBatch1$addRunValues(parameterValues = c(1, 2), initialValues = 1)
ids[[2]] <- simulationBatch1$addRunValues(parameterValues = c(1.6, 2.4), initialValues = 3)
ids[[3]] <- simulationBatch2$addRunValues(parameterValues = c(4, 2), initialValues = 4)
ids[[4]] <- simulationBatch2$addRunValues(parameterValues = c(2.6, 4.4), initialValues = 5)
res <- runSimulationBatches(simulationBatches = list(simulationBatch1, simulationBatch2))
SimulationBatch$getVariableParameters()Returns a list of parameter paths that are variable in this batch.
SimulationBatch$getVariableParameters()
The order of parameters is the same as the order of parameter
values added with $addRunValues() method.
List of parameter paths, or NULL if no parameter is variable.
SimulationBatch$getVariableMolecules()Returns a list of molecules paths that are variable in this batch
SimulationBatch$getVariableMolecules()
The order of molecules is the same as the order of molecule
start values added with $addRunValues() method.
List of parameter paths, or NULL if no molecule is variable.
SimulationBatch$print()Print the object to the console
SimulationBatch$print(...)
...Additional arguments.
## ------------------------------------------------ ## Method `SimulationBatch$addRunValues()` ## ------------------------------------------------ ## Not run: sim1 <- loadSimulation("sim1", loadFromCache = TRUE) sim2 <- loadSimulation("sim2", loadFromCache = TRUE) parameters <- c("Organism|Liver|Volume", "R1|k1") molecules <- "Organism|Liver|A" # Create two simulation batches. simulationBatch1 <- createSimulationBatch(simulation = sim1, parametersOrPaths = parameters, moleculesOrPaths = molecules) simulationBatch2 <- createSimulationBatch(simulation = sim2, parametersOrPaths = parameters, moleculesOrPaths = molecules) #Ids of run values ids <- c() ids[[1]] <- simulationBatch1$addRunValues(parameterValues = c(1, 2), initialValues = 1) ids[[2]] <- simulationBatch1$addRunValues(parameterValues = c(1.6, 2.4), initialValues = 3) ids[[3]] <- simulationBatch2$addRunValues(parameterValues = c(4, 2), initialValues = 4) ids[[4]] <- simulationBatch2$addRunValues(parameterValues = c(2.6, 4.4), initialValues = 5) res <- runSimulationBatches(simulationBatches = list(simulationBatch1, simulationBatch2)) ## End(Not run)## ------------------------------------------------ ## Method `SimulationBatch$addRunValues()` ## ------------------------------------------------ ## Not run: sim1 <- loadSimulation("sim1", loadFromCache = TRUE) sim2 <- loadSimulation("sim2", loadFromCache = TRUE) parameters <- c("Organism|Liver|Volume", "R1|k1") molecules <- "Organism|Liver|A" # Create two simulation batches. simulationBatch1 <- createSimulationBatch(simulation = sim1, parametersOrPaths = parameters, moleculesOrPaths = molecules) simulationBatch2 <- createSimulationBatch(simulation = sim2, parametersOrPaths = parameters, moleculesOrPaths = molecules) #Ids of run values ids <- c() ids[[1]] <- simulationBatch1$addRunValues(parameterValues = c(1, 2), initialValues = 1) ids[[2]] <- simulationBatch1$addRunValues(parameterValues = c(1.6, 2.4), initialValues = 3) ids[[3]] <- simulationBatch2$addRunValues(parameterValues = c(4, 2), initialValues = 4) ids[[4]] <- simulationBatch2$addRunValues(parameterValues = c(2.6, 4.4), initialValues = 5) res <- runSimulationBatches(simulationBatches = list(simulationBatch1, simulationBatch2)) ## End(Not run)
Options to be passed to the SimulationBatch.
rSharp::NetObject -> DotNetWrapper -> SimulationBatchOptions
variableParametersVector of absolute parameter paths to be varied in a simulation batch
variableMoleculesVector of absolute molecule paths to be varied in a simulation batch
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()SimulationBatchOptions$new()Initialize a new instance of the class
SimulationBatchOptions$new(variableParameters = NULL, variableMolecules = NULL)
variableParametersVector of absolute parameter paths to be varied in a simulation batch
variableMoleculesVector of absolute molecule paths to be varied in a simulation batch
A new SimulationBatchOptions object.
SimulationBatchOptions$print()Print the object to the console
SimulationBatchOptions$print(...)
...Rest arguments.
Options to be passed to the SimulationBatch run
rSharp::NetObject -> DotNetWrapper -> SimulationBatchRunValues
parameterValuesVector of parameter values used in a batch run
initialValuesVector of initial values used in a batch run
idInternal id of the batch run value
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()SimulationBatchRunValues$new()Initialize a new instance of the class
SimulationBatchRunValues$new(parameterValues = NULL, initialValues = NULL)
parameterValuesVector of parameter values
initialValuesVector of molecule initial values
A new SimulationBatchRunValues object.
SimulationBatchRunValues$print()Print the object to the console
SimulationBatchRunValues$print(...)
...Rest arguments.
pK-Analyses of a simulation (either individual or population simulation).
rSharp::NetObject -> DotNetWrapper -> SimulationPKAnalyses
simulationReference to the Simulation used to calculate or import the PK-Analyses (Read-Only)
allPKParameterNamesReturns the name of all pk parameters for which a value is available
allQuantityPathsReturns the path of all quantities for which pk parameters were calculated
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()SimulationPKAnalyses$new()Initialize a new instance of the class
SimulationPKAnalyses$new(netObject, simulation)
netObjectA NetObject
simulationSimulation for which the pkParameters were calculated
A new SimulationPKAnalyses object.
SimulationPKAnalyses$allPKParametersFor()Returns all QuantityPKParameter defined for a given path
SimulationPKAnalyses$allPKParametersFor(quantityPath)
quantityPathPath for which pkParameters should be retrieved
SimulationPKAnalyses$pKParameterFor()The pK Parameter defined for the given path and name
SimulationPKAnalyses$pKParameterFor(quantityPath, pkParameter)
quantityPathPath for which the pkParameter named pkParameter
should be retrieved
pkParameterName of the pkParameter to retrieve
SimulationPKAnalyses$print()Print the object to the console
SimulationPKAnalyses$print(...)
...Rest arguments.
Results of a simulation run (either individual or population simulation)
rSharp::NetObject -> DotNetWrapper -> SimulationResults
countthe number of individual results (Count==1 generally means that we are dealing with an individual simulation results).
simulationReference to the Simulation used to calculate or import the results (Read-Only).
timeValuesVector of simulated time output values
allQuantityPathsList of all paths for which results are defined.
allIndividualIdsList of Ids of all individuals that have been simulated
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()SimulationResults$new()Initialize a new instance of the class
SimulationResults$new(netObject, simulation)
netObjectAn rSharp::NetObject object.
simulationReference to the simulation object used to calculated the results
A new SimulationResults object.
SimulationResults$hasResultsForIndividual()Returns TRUE if results are available for the individual with id individualId otherwise FALSE
SimulationResults$hasResultsForIndividual(individualId)
individualIdId of the individual
SimulationResults$getValuesByPath()Returns TRUE if results are available for the individual with id individualId otherwise FALSE
SimulationResults$getValuesByPath(path, individualIds, stopIfNotFound = TRUE)
pathPath for which values should be retrieved
individualIdsOne or more individual ids for which values should be returned
stopIfNotFoundIf TRUE (default) an error is thrown if no values could be found for the path/
If FALSE, a list of NA values is returned
SimulationResults$resultsForIndividual()Returns all available results for the individual with id individualId
SimulationResults$resultsForIndividual(individualId)
individualIdId for which the results should be returned
SimulationResults$print()Print the object to the console
SimulationResults$print(...)
...Rest arguments.
SimulationResults objects to a data.frameConverts a SimulationResults objects to a data.frame
simulationResultsToDataFrame( simulationResults, quantitiesOrPaths = NULL, population = NULL, individualIds = NULL ) simulationResultsToTibble( simulationResults, quantitiesOrPaths = NULL, population = NULL, individualIds = NULL )simulationResultsToDataFrame( simulationResults, quantitiesOrPaths = NULL, population = NULL, individualIds = NULL ) simulationResultsToTibble( simulationResults, quantitiesOrPaths = NULL, population = NULL, individualIds = NULL )
simulationResults |
Object of type |
quantitiesOrPaths |
Quantity instances (element or vector) typically
retrieved using |
population |
population used to calculate the |
individualIds |
|
SimulationResults object as data.frame with columns IndividualId, Time, paths, simulationValues, unit, dimension, TimeUnit.
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Running an individual simulation # results is an instance of `SimulationResults` results <- runSimulations(sim)[[1]] # convert to a dataframe simulationResultsToDataFrame(results)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) # Running an individual simulation # results is an instance of `SimulationResults` results <- runSimulations(sim)[[1]] # convert to a dataframe simulationResultsToDataFrame(results)
Options to be passed to the simulation engine
rSharp::NetObject -> DotNetWrapper -> SimulationRunOptions
numberOfCores(Maximal) number of cores to be used. This is only relevant when simulating a population simulation.
Default is getOSPSuiteSetting("numberOfCores").
checkForNegativeValuesSpecifies whether negative values check is on or off. Default is TRUE
showProgressSpecifies whether a progress bar should be shown during population simulations. If TRUE, a progress bar is shown in the console,
indicating the number of already executed simulations from the total population size. The progress bar does not indicate the progress
of a single simulation. This option only applies to population simulations and has no effect on individual simulations.
Default is getOSPSuiteSetting("showProgress")
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()SimulationRunOptions$new()Initialize a new instance of the class
SimulationRunOptions$new( numberOfCores = NULL, checkForNegativeValues = NULL, showProgress = NULL )
numberOfCoresNumber of cores to use for the simulation. Default value is getOSPSuiteSetting("numberOfCores")
checkForNegativeValuesShould the solver check for negative values. Default is TRUE
showProgressShould a progress bar be displayed during population simulations. If TRUE, a progress bar is shown in the console,
indicating the number of already executed simulations from the total population size. The progress bar does not indicate the progress
of a single simulation. This option only applies to population simulations and has no effect on individual simulations.
Default value is getOSPSuiteSetting("showProgress")
A new SimulationRunOptions object.
SimulationRunOptions$print()Print the object to the console
SimulationRunOptions$print(...)
...Rest arguments.
Settings associated with a given simulation
rSharp::NetObject -> DotNetWrapper -> SimulationSettings
solverContainer containing all solver parameters for the simulation (read-only)
outputSelectionsAll selected quantities (species, observers, parameters) that will be part of the simulated results
outputSchemaOutputSchema object containing the output intervals used to generate simulation data
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DotNetWrapper$initialize()SimulationSettings$print()Print the object to the console
SimulationSettings$print(...)
...Rest arguments.
A parameter typically used in the definition of IndividualCharacteristics covariates (Height, Weight etc...)
rSharp::NetObject -> DotNetWrapper -> SnapshotParameter
valueParameter value
unitUnit in which the value is defined
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()SnapshotParameter$new()Initialize a new instance of the class
SnapshotParameter$new(netObject = NULL, value = NULL, unit = NULL)
netObjectOptional NetObject. If not defined, a new instance will be created
valueOptional value of the parameter.
unitOptional unit of the value specified.
A new SnapshotParameter object.
SnapshotParameter$print()Print the object to the console
SnapshotParameter$print(...)
...Rest arguments.
SnapshotParameter$printValue()Print the parameter in one line
SnapshotParameter$printValue(caption)
captionCaption to display before the value of the parameter
SnapshotParameter$getPrintValue()Return a string for printing the parameter in one line
SnapshotParameter$getPrintValue()
A string for printing the parameter in one line
Solver settings associated with a given simulation
rSharp::NetObject -> DotNetWrapper -> SolverSettings
useJacobianUse of Jacobian matrix during calculations
h0Initial time step size
hMinMinimum absolute value of step size allowed
hMaxMaximum absolute value of step size allowed
mxStepMaximum number of internal steps to be taken by the solver in its attempt to reach tout
relTolRelative tolerance of unknowns
absTolAbsolute tolerance of unknowns
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DotNetWrapper$initialize()SolverSettings$print()Print the object to the console
SolverSettings$print(...)
...Rest arguments.
Default species defined in PK-Sim
SpeciesSpecies
csvPopulationFile and split the loaded population according to
numberOfCores.Loads a population from the csvPopulationFile and split the loaded population according to
numberOfCores.
splitPopulationFile( csvPopulationFile, numberOfCores, outputFolder, outputFileName )splitPopulationFile( csvPopulationFile, numberOfCores, outputFolder, outputFileName )
csvPopulationFile |
Full path of csv population file to split. |
numberOfCores |
Number of cores used for parallelization computing. The population will be split across all cores. |
outputFolder |
Folder where all split files will be created |
outputFileName |
File names will be constructed using this parameter concatenated with the core index. |
A string vector containing the full path of the population files created. Note that there might be less files than cores
csvPath <- system.file("extdata", "pop.csv", package = "ospsuite") # Split the population in up to 3 files, saved in the temp folder splitFiles <- splitPopulationFile(csvPath, 3, tempdir(), "PopFile")csvPath <- system.file("extdata", "pop.csv", package = "ospsuite") # Split the population in up to 3 files, saved in the temp folder splitFiles <- splitPopulationFile(csvPath, 3, tempdir(), "PopFile")
Standard containers typically available in a PBPK simulation
StandardContainerStandardContainer
List of ontogeny supported in PK-Sim
StandardOntogenyStandardOntogeny
Standard parameter paths typically available in a PBPK simulation
StandardPathStandardPath
Standard PK-Parameters types defined in OSPSuite This is only used to defined how a user defined PK Parameter should be calculated
StandardPKParameterStandardPKParameter
Converts a value given in a specified unit into the base unit of a quantity
toBaseUnit( quantityOrDimension, values, unit, molWeight = NULL, molWeightUnit = NULL )toBaseUnit( quantityOrDimension, values, unit, molWeight = NULL, molWeightUnit = NULL )
quantityOrDimension |
Instance of a quantity from which the dimension will be retrieved or name of dimension |
values |
Value in unit (single or vector) |
unit |
Unit of value |
molWeight |
Optional molecule weight to use when converting, for example, from molar to mass amount or concentration. If |
molWeightUnit |
Unit of the molecular weight value. If |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) par <- getParameter("Organism|Liver|Volume", sim) # Converts the value in unit (1000 ml) to the base unit (l) => 1 valueInBaseUnit <- toBaseUnit(par, 1000, "ml") valuesInBaseUnit <- toBaseUnit(par, c(1000, 2000, 3000), "ml")simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) par <- getParameter("Organism|Liver|Volume", sim) # Converts the value in unit (1000 ml) to the base unit (l) => 1 valueInBaseUnit <- toBaseUnit(par, 1000, "ml") valuesInBaseUnit <- toBaseUnit(par, c(1000, 2000, 3000), "ml")
Converts a value given in base unit of a quantity into the display unit of a quantity
toDisplayUnit(quantity, values, unit = NULL)toDisplayUnit(quantity, values, unit = NULL)
quantity |
Instance of a quantity from which the base unit will be retrieved |
values |
Value (single or vector). If |
unit |
Optional Name of the unit to convert from. If |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) par <- getParameter("Organism|Liver|Volume", sim) # Converts the value in base unit (1L) to display unit valueInMl <- toDisplayUnit(par, 1) valuesInDisplayUnit <- toDisplayUnit(par, c(1, 5, 5)) # Converts the value in ml to display unit valueInDisplayUnit <- toDisplayUnit(par, 1000, "ml")simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) par <- getParameter("Organism|Liver|Volume", sim) # Converts the value in base unit (1L) to display unit valueInMl <- toDisplayUnit(par, 1) valuesInDisplayUnit <- toDisplayUnit(par, c(1, 5, 5)) # Converts the value in ml to display unit valueInDisplayUnit <- toDisplayUnit(par, 1000, "ml")
Convert a path defined as string to a path array
toPathArray(path)toPathArray(path)
path |
A string representation of a path, with path entries separated by '|' |
An array containing one element for each path entry.
toPathArray("Organism|Organ|Liver")toPathArray("Organism|Organ|Liver")
Convert a path array to a path as string with entries separated by '|'
toPathString(...)toPathString(...)
... |
Path entries to concatenate into a path string. |
A string built using each entry of the pathArray.
toPathString(c("Organism", "Organ", "Liver"))toPathString(c("Organism", "Organ", "Liver"))
Converts values from one unit to another
toUnit( quantityOrDimension, values, targetUnit, sourceUnit = NULL, molWeight = NULL, molWeightUnit = NULL )toUnit( quantityOrDimension, values, targetUnit, sourceUnit = NULL, molWeight = NULL, molWeightUnit = NULL )
quantityOrDimension |
Instance of a quantity from which the dimension will be retrieved or name of dimension |
values |
Values to convert (single or vector). If |
targetUnit |
Unit to convert to |
sourceUnit |
Optional Name of the unit to convert from. If |
molWeight |
Optional molecular weight to use when converting, for example, from molar to mass amount or concentration. If |
molWeightUnit |
Optional Unit of the molecular weight value. If |
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) par <- getParameter("Organism|Liver|Volume", sim) # Converts the value in base unit (1L) to ml => 1000 valueInMl <- toUnit(par, 1, "ml") valuesInMl <- toUnit(par, c(1, 5, 5), "ml") # Converts a numerical value in from mmol/l to mg/dl valuesInMgDl <- toUnit(ospDimensions$`Concentration (molar)`, 5, targetUnit = "mmol/l", sourceUnit = "mg/dl", molWeight = 180, molWeightUnit = "g/mol" )simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) par <- getParameter("Organism|Liver|Volume", sim) # Converts the value in base unit (1L) to ml => 1000 valueInMl <- toUnit(par, 1, "ml") valuesInMl <- toUnit(par, c(1, 5, 5), "ml") # Converts a numerical value in from mmol/l to mg/dl valuesInMgDl <- toUnit(ospDimensions$`Concentration (molar)`, 5, targetUnit = "mmol/l", sourceUnit = "mg/dl", molWeight = 180, molWeightUnit = "g/mol" )
Extract Unique Elements of type 'Entity'
uniqueEntities(entities, compareBy = CompareBy$id)uniqueEntities(entities, compareBy = CompareBy$id)
entities |
List of objects of type 'Entity' |
compareBy |
A string defining the property that is compared by. Can take values 'id', 'name', and 'path'. Default is 'id'. |
List of entities that are unique for the property defined by the argument 'compareBy'.
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) parameters <- c( getParameter(toPathString(c("Organism", "Liver", "Volume")), sim), getParameter(toPathString(c("Organism", "Liver", "Volume")), sim), getParameter(toPathString(c("Organism", "TableParameter")), sim) ) # Return a list containing the two parameters 'Volume' and 'Weight (tissue)' uniqueEntities(parameters, CompareBy$id)simPath <- system.file("extdata", "simple.pkml", package = "ospsuite") sim <- loadSimulation(simPath) parameters <- c( getParameter(toPathString(c("Organism", "Liver", "Volume")), sim), getParameter(toPathString(c("Organism", "Liver", "Volume")), sim), getParameter(toPathString(c("Organism", "TableParameter")), sim) ) # Return a list containing the two parameters 'Volume' and 'Weight (tissue)' uniqueEntities(parameters, CompareBy$id)
Updates some properties of a PK-Parameter (displayName and displayUnit)
updatePKParameter(name, displayName = NULL, displayUnit = NULL)updatePKParameter(name, displayName = NULL, displayUnit = NULL)
name |
Name of PK-Parameter to update |
displayName |
Optional display name |
displayUnit |
Optional display unit. Note that the unit should be defined in unit of the dimension |
updatePKParameter("t_max", "MyTmax", "min")updatePKParameter("t_max", "MyTmax", "min")
Definition of a user defined PKParameter that can be calculated on top of the standard PK Parameters
rSharp::NetObject -> DotNetWrapper -> PKParameter -> UserDefinedPKParameter
startTimeStart time in minutes for the calculation of the PK-Parameter. If not specified, the time will start at the first time point of the simulation (optional)
startTimeOffsetOffset in minutes to apply to the start time or
to the start time of the application identified by startApplicationIndex. (0 by default).
endTimeEnd time in minutes for the calculation of the PK-Parameter. If not specified, the time will end at the last time point of the simulation (optional)
endTimeOffsetOffset in minutes to apply to the end time or
to the start time of the application identified by endApplicationIndex. (0 by default).
startApplicationIndex1-based Index of the application to use to determine the start time for the calculation of the PK-Parameter. If not specified, the time will start at the first time point of the simulation (optional)
endApplicationIndex1-based Index of the application to use to determine the end time for the calculation of the PK-Parameter. If not specified, the time will end at the last time point of the simulation (optional)
normalizationFactorFactor to use to normalized the calculated PK-Parameter. (typically DrugMass, Dose, DosePerBodyWeight). It is the responsibility of the caller to ensure that the value is in the correct unit. (optional)
concentrationThresholdUsed in conjunction with the threshold parameter type.
If defined, the time at which this concentration was reached will be calculated
standardPKParameterBased parameter to use to perform the PK-Analysis calculation.
See StandardPKParameter enum for all possible pk parameters
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DotNetWrapper$initialize()UserDefinedPKParameter$print()Print the object to the console
UserDefinedPKParameter$print(...)
...Rest arguments.
Validate dimension
validateDimension(dimension)validateDimension(dimension)
dimension |
String name of the dimension. |
Check if the provided dimension is supported. If not, throw an error
Validate that an object is a named list
validateIsNamedList(x, varName)validateIsNamedList(x, varName)
x |
Object to validate as a named list. |
varName |
Name of the variable being validated (used in error message). |
invisible TRUE if the validation passed, otherwise an error is thrown.
validateIsNamedList(list(a = 1, b = 2), "myVar") # passes # validateIsNamedList(list(1, 2), "myVar") # throws an errorvalidateIsNamedList(list(a = 1, b = 2), "myVar") # passes # validateIsNamedList(list(1, 2), "myVar") # throws an error
Validate unit
validateUnit(unit, dimension)validateUnit(unit, dimension)
unit |
String name of the unit |
dimension |
String name of the dimension. |
Check if the unit is valid for the dimension. If not, throw an error
An entry (x, y) in a table formula
rSharp::NetObject -> DotNetWrapper -> ValuePoint
xThe x value of the point.
ythe y value of the point.
restartSolverIndicates whether the solver should be restarted when this point is reached. Default is FALSE
rSharp::NetObject$.printClass()rSharp::NetObject$.printLine()rSharp::NetObject$call()rSharp::NetObject$get()rSharp::NetObject$getFields()rSharp::NetObject$getMemberSignature()rSharp::NetObject$getMethods()rSharp::NetObject$getProperties()rSharp::NetObject$getStaticFields()rSharp::NetObject$getStaticMethods()rSharp::NetObject$getStaticProperties()rSharp::NetObject$set()DotNetWrapper$initialize()ValuePoint$print()Print the object to the console
ValuePoint$print(...)
...Rest arguments.