R/messages.R

Defines functions molWeightErrorMessage valueNotPositive invalidDataType wrongUnitForQuantity DataFrameNameAlreadyUsed plotObservedVsSimulatedWrongFoldDistance simBatchStartValueNaN lloqOnlyScalar logScaleNotAllowed residualsCanNotBeComputed plottingWithEmptyDataCombined errorLoadingUnitsForDimension linearScaleWithFoldDistance printMultipleEntries valuesNotInterpolated unpairableDatasetsRemoved datasetsToGroupNotFound noDatasetsToGroup noDatasetsPresentInDataCombined errorOneOfNameAndPathMustBeSpecified errorWrongPopulation

#' List of functions and strings used to signal error messages
#' Extends the `messages` list from ospsuite.utils
messages <- ospsuite.utils::messages

messages$errorWrongPopulation <- function(species, population) {
  paste0("Could not find population '", population, "' for species '", species, "'")
}

messages$errorOneOfNameAndPathMustBeSpecified <- function() {
  "One of the `parameterName` or `parameterPath` must be specified, but not both."
}

messages$noDatasetsPresentInDataCombined <- function() {
  "There are currently no datasets. You can add them with `$addDataSets()` and/or `$addSimulationResults()` methods."
}

messages$noDatasetsToGroup <- function() {
  "There are currently no datasets to be grouped. You can add them with `$addDataSets()` and/or `$addSimulationResults()` methods."
}

messages$datasetsToGroupNotFound <- function() {
  "Following datasets were specified to be grouped but not found"
}

messages$unpairableDatasetsRemoved <- function() {
  "Following non-grouped or unpairable datasets have been removed"
}

messages$valuesNotInterpolated <- function() {
  "Predicted values couldn't be interpolated at following time points"
}

messages$printMultipleEntries <- function(header, entries) {
  message(paste0(header, ":\n"), paste0(entries, collapse = "\n"))
}

messages$linearScaleWithFoldDistance <- function() {
  "Linear scale is inappropriate when `foldDistance` argument is specified."
}

messages$errorLoadingUnitsForDimension <- function(dimensions) {
  messages$printMultipleEntries("Could not load units for the following dimensions", dimensions)
}

messages$plottingWithEmptyDataCombined <- function() {
  "No plot can be created because the entered `DataCombined` object does not contain any datasets."
}

messages$residualsCanNotBeComputed <- function() {
  "No residuals can be computed because the entered `DataCombined` object does not contain any observed-simulated datasets that can be paired."
}

messages$logScaleNotAllowed <- function() {
  "The Y-axis for this plot should not be on a log scale, since the residuals are expected to be centered around 0."
}

messages$lloqOnlyScalar <- function() {
  "Only one LLOQ value per `DataSet` is supported! Please provide a scalar value and not a vector."
}

messages$simBatchStartValueNaN <- function(entityPaths) {
  paste0("Start values of the entities with paths '", paste(entityPaths, collapse = ", "), "' is `NaN`! Cannot add such run values set")
}

messages$plotObservedVsSimulatedWrongFoldDistance <- function(parameterName, foldDistances) {
  paste0("Parameter '", parameterName, "' should be >1! Following values have
         been passed: '", paste(foldDistances, collapse = ", "), "'.")
}

messages$DataFrameNameAlreadyUsed <- function(DataFrameName) {
  warning(paste0(
    "\r\n",
    "The following name(s) already exist in DataCombined:",
    "\r\n",
    "  - ", paste(DataFrameName, collapse = "\r\n  - "),
    "\r\n",
    "Existing data will be overwritten."
  ))
}

messages$wrongUnitForQuantity <- function(quantityPath, unit, dimension) {
  paste0("Unit '", unit, "' is not valid for quantity with path '", quantityPath, "' and dimension '", dimension, "'")
}

messages$invalidDataType <- function(name, dataType) {
  paste0("Data type '", dataType, "' specified for data set '", name, "' is not valid. Valid data types are: 'simulated' or 'observed'.")
}

messages$valueNotPositive <- function(value, propertyName) {
  paste0("The value of `", propertyName, "` must be > 0, but it is '", paste(value, collapse = ", "), "'")
}

messages$molWeightErrorMessage <- function(quantityPath) {
  paste0("Unable to retrieve the molecular weight for: ", quantityPath)
}
Open-Systems-Pharmacology/OSPSuite-R documentation built on Feb. 14, 2025, 4:48 p.m.