Open-Systems-Pharmacology / OSPSuite-R

R package for the OSPSuite
https://www.open-systems-pharmacology.org/OSPSuite-R/
Other
28 stars 11 forks source link

`plotObservedVsSimulated()`: wrong error message when no groupings are defined #1168

Open PavelBal opened 1 year ago

PavelBal commented 1 year ago

Trying to plot a data mapping with data sets but no groupings (calling the code from the "tests/testthat" folder of the package):

sim <- loadTestSimulation("MinimalModel")
simResults <- importResultsFromCSV(
  simulation = sim,
  filePaths = getTestDataFilePath("Stevens_2012_placebo_indiv_results.csv")
)

# import observed data (will return a list of `DataSet` objects)
dataSet <- loadDataSetsFromExcel(
  xlsFilePath = getTestDataFilePath("CompiledDataSetStevens2012.xlsx"),
  importerConfiguration = loadDataImporterConfiguration(getTestDataFilePath("ImporterConfiguration.xml"))
)

myCombDat <- DataCombined$new()
myCombDat$addDataSets(dataSet)
myCombDat$addSimulationResults(simResults)

plotObservedVsSimulated(myCombDat)
Following datasets were specified to be grouped but not found:
Organism|Lumen|Stomach|Metformin|Gastric retention
Organism|Lumen|Stomach|Metformin|Gastric retention distal
Organism|Lumen|Stomach|Metformin|Gastric retention proximal
Stevens_2012_placebo.Placebo_distal
Stevens_2012_placebo.Placebo_proximal
Stevens_2012_placebo.Placebo_total
Stevens_2012_placebo.Sita_dist
Stevens_2012_placebo.Sita_proximal
Stevens_2012_placebo.Sita_total

NULL
Warning message:
In calculateResiduals(dataCombined, scaling = obsVsPredPlotConfiguration$yAxis$scale,  :
  No residuals can be computed because the entered `DataCombined` object does not contain any observed-simulated datasets that can be paired.
PavelBal commented 1 year ago

Same for plotResidualsVsSimulated(myCombDat), plotResidualsVsTime(myCombDat).

The message is wrong because the listed data sets are not specified to be grouped.

The message should be

"This type of plot requires at least one group with simulated and observed results in the DataCombined object." or something like this.

PavelBal commented 5 months ago

The same for when a grouping is defined, but consists of only simulated or only observed data:

dataSet <- DataSet$new(name = "SimData")
dataSet$setValues(0, 1)

myDC <- DataCombined$new()
myDC$addDataSets(dataSet, groups = "Group")
plotObservedVsSimulated(myDC)
> plotObservedVsSimulated(myDC)
Following datasets were specified to be grouped but not found:
SimData

NULL
Warning message:
In calculateResiduals(dataCombined, scaling = obsVsPredPlotConfiguration$yAxis$scale,  :
  No residuals can be computed because the entered `DataCombined` object does not contain any observed-simulated datasets that can be paired.