diff --git a/DESCRIPTION b/DESCRIPTION index d02fc1d6f..6c45d8b94 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -35,6 +35,7 @@ Imports: xml2, openxlsx, lifecycle, + cli, showtext Suggests: pacman, @@ -108,6 +109,7 @@ Collate: 'simulation-settings.R' 'simulation.R' 'snapshot-parameter.R' + 'snapshots.R' 'solver-settings.R' 'utilities-path.R' 'standard-path.R' diff --git a/NAMESPACE b/NAMESPACE index f61a28418..ba4b64c82 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -39,6 +39,7 @@ export(calculateResiduals) export(clearMemory) export(clearOutputIntervals) export(clearOutputs) +export(convertSnapshot) export(convertUnits) export(createDistributions) export(createImporterConfigurationForFile) @@ -127,6 +128,7 @@ export(runSensitivityAnalysis) export(runSimulation) export(runSimulationBatches) export(runSimulations) +export(runSimulationsFromSnapshot) export(saveDataSetToPKML) export(saveSimulation) export(scaleParameterValues) diff --git a/NEWS.md b/NEWS.md index 880a6ebe9..31e0e56b8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ # ospsuite (development version) +## Major Changes + +- New `runSimulationsFromSnapshot()` to run simulations from `.json` snapshots files, +- New `convertSnapshot()` to convert project snapshots between `.json` and `.pksim5` files. + # ospsuite 12.1.0 ## Major Changes diff --git a/R/snapshots.R b/R/snapshots.R new file mode 100644 index 000000000..9c1db5a70 --- /dev/null +++ b/R/snapshots.R @@ -0,0 +1,160 @@ +#' Run Simulations From Snapshot Files +#' +#' @param ... character strings, path to snapshot files or a directory containing snapshot files +#' @param output character string, path to the output directory where to write simulation results +#' @param exportCSV logical, whether to export the results as csv (default = TRUE) +#' @param exportPKML logical, whether to export the results as pkml (default = FALSE) +#' @param exportJSON logical, whether to export simulation results as json (default = FALSE) +#' @param exportXML logical, whether to export the results as xml (default = FALSE) +#' +#' @return NULL +#' @export +#' +#' @examples +#' \dontrun{ +#' runSimulationsFromSnapshot("path/to/my_snapshot.json", csv = TRUE, pkml = TRUE) +#' } +runSimulationsFromSnapshot <- function(..., output = ".", exportCSV = TRUE, exportPKML = FALSE, exportJSON = FALSE, exportXML = FALSE) { + ospsuite.utils::validateIsLogical(object = c(exportCSV, exportPKML, exportXML)) + ospsuite.utils::validateIsCharacter(object = c(..., output)) + + paths_exist <- file.exists(c(..., output)) + if (!all(paths_exist)) { + missing_paths <- c(..., output)[!paths_exist] + cli::cli_abort(message = c("x" = "Some of the paths provided do not exist: {.file {missing_paths}}")) + } + + initPKSim() + + temp_dir <- .gatherFiles(c(...)) + + JsonRunOptions <- rSharp::newObjectFromName("PKSim.CLI.Core.RunOptions.JsonRunOptions") + JsonRunOptions$set("InputFolder", temp_dir) + JsonRunOptions$set("OutputFolder", normalizePath(output)) + + if (isTRUE(exportJSON)) { + exportJSON <- 1L + } else { + exportJSON <- 0L + } + if (isTRUE(exportCSV)) { + exportCSV <- 2L + } else { + exportCSV <- 0L + } + if (isTRUE(exportXML)) { + exportXML <- 4L + } else { + exportXML <- 0L + } + if (isTRUE(exportPKML)) { + exportPKML <- 8L + } else { + exportPKML <- 0L + } + + ExportMode <- exportJSON + exportCSV + exportXML + exportPKML + # 1: json + # 2: csv + # 3: json + csv + # 4: xml + # 5: xml + json + # 6: xml + csv + # 7: json + csv + xml + # 8: pkml + # 9: pkml + json + # 10: pkml + csv + # 11: pkml + json + csv + # 12: pkml + xml + # 13: pkml + xml + json + # 14: pkml + xml + csv + # 15: all + + JsonRunOptions$set("ExportMode", ExportMode) + + cli::cli_process_start( + msg = "Running simulations from {length(list.files(temp_dir))} snapshot{?s}", + msg_done = "Simulations completed", + msg_failed = "An error occured while running simulation" + ) + + tryCatch( + { + invisible(rSharp::callStatic("PKSim.R.Api", "RunJson", JsonRunOptions)) + }, + error = function(e) { + message <- stringr::str_extract(as.character(e), "(?<=Message: )[^\\n]*") + + cli::cli_abort(message = message, call = rlang::caller_env(n = 4)) + } + ) +} + +#' Convert between snapshot and project formats +#' +#' @param ... character strings, path to files or a directory containing files to convert +#' @param format, character string, target format either "snapshot" or "project". +#' @param output character string, path to the output directory where to write the converted files +#' +#' @return NULL +#' @export +#' +#' @examples +#' \dontrun{ +#' convertSnapshot("path/to/snapshot.json", format = "project") +#' convertSnapshot("path/to/project.pksim5", format = "snapshot") +#' } +convertSnapshot <- function(..., format, output = ".") { + rlang::arg_match(arg = format, values = c("snapshot", "project")) + + initPKSim() + + temp_dir <- .gatherFiles(c(...)) + + SnapshotRunOptions <- rSharp::newObjectFromName("PKSim.CLI.Core.RunOptions.SnapshotRunOptions") + SnapshotRunOptions$set(name = "InputFolder", value = temp_dir) + SnapshotRunOptions$set(name = "OutputFolder", value = normalizePath(output)) + + if (format == "project") { + SnapshotRunOptions$set("ExportMode", 0L) + nfiles <- length(list.files(temp_dir, pattern = ".json")) + } else if (format == "snapshot") { + SnapshotRunOptions$set("ExportMode", 1L) + nfiles <- length(list.files(temp_dir, pattern = ".pksim5")) + } + + cli::cli_process_start( + msg = "Converting {nfiles} files{?s} to {format} format", + msg_done = "Conversion completed", + msg_failed = "An error occured while converting files" + ) + + rSharp::callStatic("PKSim.R.Api", "RunSnapshot", SnapshotRunOptions) +} + + +#' Gather files and files from folders to one location +#' +#' @param ... character strings of file paths or folder paths +#' +#' @return A temporary directory with all files copied to it +.gatherFiles <- function(...) { + temp_dir <- tempfile() + dir.create(temp_dir) + for (element in c(...)) { + # if the element is a folder, list all files in it and copy them to the temp directory + if (dir.exists(element)) { + files <- list.files(element, full.names = TRUE, recursive = TRUE) + for (file in files) { + file.copy(from = file, to = temp_dir) + } + next + } + # if the element is a file, copy it to the temp directory + else if (file.exists(element)) { + file.copy(from = element, to = temp_dir) + next + } + } + return(temp_dir) +} diff --git a/inst/lib/ConsoleApp.deps.json b/inst/lib/ConsoleApp.deps.json index a296d5a37..87bb55b01 100644 --- a/inst/lib/ConsoleApp.deps.json +++ b/inst/lib/ConsoleApp.deps.json @@ -12,7 +12,7 @@ "OSPSuite.R": "12.0.313", "OSPSuite.SimModel.Ubuntu22": "4.0.0.59", "OSPSuite.SimModelSolver_CVODES.Ubuntu22": "4.1.0.9", - "PKSim.R": "12.0.324" + "PKSim.R": "12.0.328" }, "runtime": { "ConsoleApp.dll": {} @@ -97,9 +97,9 @@ "Microsoft.Win32.Registry": "5.0.0", "NETStandard.Library": "2.0.3", "System.ComponentModel.Annotations": "4.7.0", - "System.Configuration.ConfigurationManager": "4.5.0", + "System.Configuration.ConfigurationManager": "6.0.0", "System.Diagnostics.PerformanceCounter": "4.5.0", - "System.Drawing.Common": "5.0.0", + "System.Drawing.Common": "6.0.0", "System.Reflection.Emit": "4.3.0", "System.Reflection.Emit.Lightweight": "4.3.0", "System.Text.Encoding.CodePages": "4.4.0" @@ -111,14 +111,14 @@ } } }, - "FluentNHibernate/2.1.2": { + "FluentNHibernate/3.4.0": { "dependencies": { - "NHibernate": "5.2.5" + "NHibernate": "5.4.9" }, "runtime": { "lib/netcoreapp2.0/FluentNHibernate.dll": { - "assemblyVersion": "2.1.2.0", - "fileVersion": "2.1.2.0" + "assemblyVersion": "3.4.0.0", + "fileVersion": "3.4.0.0" } } }, @@ -285,36 +285,33 @@ } } }, - "Microsoft.NETCore.Platforms/5.0.0": {}, + "Microsoft.NETCore.Platforms/2.0.0": {}, "Microsoft.NETCore.Targets/1.1.3": {}, "Microsoft.Win32.Registry/5.0.0": { "dependencies": { - "System.Security.AccessControl": "5.0.0", + "System.Security.AccessControl": "6.0.0", "System.Security.Principal.Windows": "5.0.0" } }, - "Microsoft.Win32.SystemEvents/5.0.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0" - }, + "Microsoft.Win32.SystemEvents/6.0.0": { "runtime": { - "lib/netstandard2.0/Microsoft.Win32.SystemEvents.dll": { - "assemblyVersion": "5.0.0.0", - "fileVersion": "5.0.20.51904" + "lib/net6.0/Microsoft.Win32.SystemEvents.dll": { + "assemblyVersion": "6.0.0.0", + "fileVersion": "6.0.21.52210" } }, "runtimeTargets": { - "runtimes/win/lib/netcoreapp3.0/Microsoft.Win32.SystemEvents.dll": { + "runtimes/win/lib/net6.0/Microsoft.Win32.SystemEvents.dll": { "rid": "win", "assetType": "runtime", - "assemblyVersion": "5.0.0.0", - "fileVersion": "5.0.20.51904" + "assemblyVersion": "6.0.0.0", + "fileVersion": "6.0.21.52210" } } }, "NETStandard.Library/2.0.3": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0" + "Microsoft.NETCore.Platforms": "2.0.0" } }, "Newtonsoft.Json/12.0.3": { @@ -336,18 +333,18 @@ } } }, - "NHibernate/5.2.5": { + "NHibernate/5.4.9": { "dependencies": { "Antlr3.Runtime": "3.5.1", "Iesi.Collections": "4.0.4", "Remotion.Linq": "2.2.0", "Remotion.Linq.EagerFetching": "2.2.0", - "System.Configuration.ConfigurationManager": "4.5.0" + "System.Configuration.ConfigurationManager": "6.0.0" }, "runtime": { - "lib/netcoreapp2.0/NHibernate.dll": { - "assemblyVersion": "5.2.0.0", - "fileVersion": "5.2.5.0" + "lib/net6.0/NHibernate.dll": { + "assemblyVersion": "5.4.0.0", + "fileVersion": "5.4.9.0" } } }, @@ -355,8 +352,8 @@ "dependencies": { "Portable.BouncyCastle": "1.8.9", "SharpZipLib": "1.3.2", - "System.Configuration.ConfigurationManager": "4.5.0", - "System.Drawing.Common": "5.0.0" + "System.Configuration.ConfigurationManager": "6.0.0", + "System.Drawing.Common": "6.0.0" }, "runtime": { "lib/netstandard2.1/NPOI.OOXML.dll": { @@ -393,7 +390,7 @@ "DevExpress.Data": "21.2.3", "OSPSuite.Assets": "12.0.313", "OSPSuite.Utility": "4.1.0.6", - "System.Drawing.Common": "5.0.0" + "System.Drawing.Common": "6.0.0" }, "runtime": { "lib/netstandard2.0/OSPSuite.Assets.Images.dll": { @@ -519,7 +516,7 @@ "OSPSuite.Infrastructure.Serialization/12.0.313": { "dependencies": { "Dapper": "2.0.123", - "NHibernate": "5.2.5", + "NHibernate": "5.4.9", "OSPSuite.Core": "12.0.313", "System.Data.SQLite.Core": "1.0.118" }, @@ -668,7 +665,7 @@ }, "runtime.native.System/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3" } }, @@ -803,7 +800,7 @@ }, "System.Collections/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3", "System.Runtime": "4.3.1" } @@ -875,15 +872,15 @@ "System.Threading": "4.3.0" } }, - "System.Configuration.ConfigurationManager/4.5.0": { + "System.Configuration.ConfigurationManager/6.0.0": { "dependencies": { - "System.Security.Cryptography.ProtectedData": "4.5.0", - "System.Security.Permissions": "4.5.0" + "System.Security.Cryptography.ProtectedData": "6.0.0", + "System.Security.Permissions": "6.0.0" }, "runtime": { - "lib/netstandard2.0/System.Configuration.ConfigurationManager.dll": { - "assemblyVersion": "4.0.1.0", - "fileVersion": "4.6.26515.6" + "lib/net6.0/System.Configuration.ConfigurationManager.dll": { + "assemblyVersion": "6.0.0.0", + "fileVersion": "6.0.21.52210" } } }, @@ -895,16 +892,16 @@ }, "System.Diagnostics.Debug/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3", "System.Runtime": "4.3.1" } }, "System.Diagnostics.PerformanceCounter/4.5.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.Win32.Registry": "5.0.0", - "System.Configuration.ConfigurationManager": "4.5.0", + "System.Configuration.ConfigurationManager": "6.0.0", "System.Security.Principal.Windows": "5.0.0" }, "runtime": { @@ -924,7 +921,7 @@ }, "System.Diagnostics.TraceSource/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "System.Collections": "4.3.0", "System.Diagnostics.Debug": "4.3.0", "System.Globalization": "4.3.0", @@ -937,33 +934,33 @@ }, "System.Diagnostics.Tracing/4.1.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3", "System.Runtime": "4.3.1" } }, - "System.Drawing.Common/5.0.0": { + "System.Drawing.Common/6.0.0": { "dependencies": { - "Microsoft.Win32.SystemEvents": "5.0.0" + "Microsoft.Win32.SystemEvents": "6.0.0" }, "runtime": { - "lib/netcoreapp3.0/System.Drawing.Common.dll": { - "assemblyVersion": "5.0.0.0", - "fileVersion": "5.0.20.51904" + "lib/net6.0/System.Drawing.Common.dll": { + "assemblyVersion": "6.0.0.0", + "fileVersion": "6.0.21.52210" } }, "runtimeTargets": { - "runtimes/unix/lib/netcoreapp3.0/System.Drawing.Common.dll": { + "runtimes/unix/lib/net6.0/System.Drawing.Common.dll": { "rid": "unix", "assetType": "runtime", - "assemblyVersion": "5.0.0.0", - "fileVersion": "5.0.20.51904" + "assemblyVersion": "6.0.0.0", + "fileVersion": "6.0.21.52210" }, - "runtimes/win/lib/netcoreapp3.0/System.Drawing.Common.dll": { + "runtimes/win/lib/net6.0/System.Drawing.Common.dll": { "rid": "win", "assetType": "runtime", - "assemblyVersion": "5.0.0.0", - "fileVersion": "5.0.20.51904" + "assemblyVersion": "6.0.0.0", + "fileVersion": "6.0.21.52210" } } }, @@ -987,14 +984,14 @@ }, "System.Globalization/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3", "System.Runtime": "4.3.1" } }, "System.Globalization.Extensions/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "System.Globalization": "4.3.0", "System.Resources.ResourceManager": "4.3.0", "System.Runtime": "4.3.1", @@ -1004,7 +1001,7 @@ }, "System.IO/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3", "System.Runtime": "4.3.1", "System.Text.Encoding": "4.3.0", @@ -1013,7 +1010,7 @@ }, "System.IO.FileSystem/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3", "System.IO": "4.3.0", "System.IO.FileSystem.Primitives": "4.3.0", @@ -1025,7 +1022,7 @@ }, "System.IO.FileSystem.AccessControl/5.0.0": { "dependencies": { - "System.Security.AccessControl": "5.0.0", + "System.Security.AccessControl": "6.0.0", "System.Security.Principal.Windows": "5.0.0" } }, @@ -1087,7 +1084,7 @@ }, "System.Reflection/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3", "System.IO": "4.3.0", "System.Reflection.Primitives": "4.3.0", @@ -1120,7 +1117,7 @@ }, "System.Reflection.Extensions/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3", "System.Reflection": "4.3.0", "System.Runtime": "4.3.1" @@ -1128,7 +1125,7 @@ }, "System.Reflection.Primitives/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3", "System.Runtime": "4.3.1" } @@ -1149,7 +1146,7 @@ }, "System.Resources.ResourceManager/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3", "System.Globalization": "4.3.0", "System.Reflection": "4.3.0", @@ -1158,27 +1155,27 @@ }, "System.Runtime/4.3.1": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3" } }, "System.Runtime.Extensions/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3", "System.Runtime": "4.3.1" } }, "System.Runtime.Handles/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3", "System.Runtime": "4.3.1" } }, "System.Runtime.InteropServices/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3", "System.Reflection": "4.3.0", "System.Reflection.Primitives": "4.3.0", @@ -1188,7 +1185,7 @@ }, "System.Runtime.InteropServices.RuntimeInformation/4.0.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "System.Reflection": "4.3.0", "System.Resources.ResourceManager": "4.3.0", "System.Runtime": "4.3.1", @@ -1219,55 +1216,51 @@ "System.Runtime": "4.3.1" } }, - "System.Security.AccessControl/5.0.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", - "System.Security.Principal.Windows": "5.0.0" - } - }, - "System.Security.Cryptography.ProtectedData/4.5.0": { + "System.Security.AccessControl/6.0.0": {}, + "System.Security.Cryptography.ProtectedData/6.0.0": { "runtime": { - "lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll": { - "assemblyVersion": "4.0.3.0", - "fileVersion": "4.6.26515.6" + "lib/net6.0/System.Security.Cryptography.ProtectedData.dll": { + "assemblyVersion": "6.0.0.0", + "fileVersion": "6.0.21.52210" } }, "runtimeTargets": { - "runtimes/win/lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll": { + "runtimes/win/lib/net6.0/System.Security.Cryptography.ProtectedData.dll": { "rid": "win", "assetType": "runtime", - "assemblyVersion": "4.0.3.0", - "fileVersion": "4.6.26515.6" + "assemblyVersion": "6.0.0.0", + "fileVersion": "6.0.21.52210" } } }, - "System.Security.Permissions/4.5.0": { + "System.Security.Permissions/6.0.0": { "dependencies": { - "System.Security.AccessControl": "5.0.0" + "System.Security.AccessControl": "6.0.0", + "System.Windows.Extensions": "6.0.0" }, "runtime": { - "lib/netstandard2.0/System.Security.Permissions.dll": { - "assemblyVersion": "4.0.1.0", - "fileVersion": "4.6.26515.6" + "lib/net6.0/System.Security.Permissions.dll": { + "assemblyVersion": "6.0.0.0", + "fileVersion": "6.0.21.52210" } } }, "System.Security.Principal.Windows/5.0.0": {}, "System.Text.Encoding/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3", "System.Runtime": "4.3.1" } }, "System.Text.Encoding.CodePages/4.4.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0" + "Microsoft.NETCore.Platforms": "2.0.0" } }, "System.Text.Encoding.Extensions/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3", "System.Runtime": "4.3.1", "System.Text.Encoding": "4.3.0" @@ -1286,7 +1279,7 @@ }, "System.Threading.Tasks/4.3.0": { "dependencies": { - "Microsoft.NETCore.Platforms": "5.0.0", + "Microsoft.NETCore.Platforms": "2.0.0", "Microsoft.NETCore.Targets": "1.1.3", "System.Runtime": "4.3.1" } @@ -1303,6 +1296,25 @@ "System.Runtime": "4.3.1" } }, + "System.Windows.Extensions/6.0.0": { + "dependencies": { + "System.Drawing.Common": "6.0.0" + }, + "runtime": { + "lib/net6.0/System.Windows.Extensions.dll": { + "assemblyVersion": "6.0.0.0", + "fileVersion": "6.0.21.52210" + } + }, + "runtimeTargets": { + "runtimes/win/lib/net6.0/System.Windows.Extensions.dll": { + "rid": "win", + "assetType": "runtime", + "assemblyVersion": "6.0.0.0", + "fileVersion": "6.0.21.52210" + } + } + }, "System.Xml.ReaderWriter/4.3.0": { "dependencies": { "System.Collections": "4.3.0", @@ -1336,38 +1348,47 @@ "System.Xml.ReaderWriter": "4.3.0" } }, - "PKSim.Assets/12.0.324": { + "PKSim.Assets/12.0.328": { "dependencies": { "OSPSuite.Assets": "12.0.313", "OSPSuite.Assets.Images": "12.0.313", "OSPSuite.Core": "12.0.313" }, "runtime": { - "PKSim.Assets.dll": {} + "PKSim.Assets.dll": { + "assemblyVersion": "12.0.328", + "fileVersion": "12.0.328" + } } }, - "PKSim.Assets.Images/12.0.324": { + "PKSim.Assets.Images/12.0.328": { "dependencies": { "OSPSuite.Assets": "12.0.313", "OSPSuite.Assets.Images": "12.0.313", "System.Resources.Extensions": "8.0.0" }, "runtime": { - "PKSim.Assets.Images.dll": {} + "PKSim.Assets.Images.dll": { + "assemblyVersion": "12.0.328", + "fileVersion": "12.0.328" + } } }, - "PKSim.CLI.Core/12.0.324": { + "PKSim.CLI.Core/12.0.328": { "dependencies": { "OSPSuite.Assets": "12.0.313", "OSPSuite.Core": "12.0.313", "OSPSuite.Utility": "4.1.0.6", - "PKSim.Core": "12.0.324" + "PKSim.Core": "12.0.328" }, "runtime": { - "PKSim.CLI.Core.dll": {} + "PKSim.CLI.Core.dll": { + "assemblyVersion": "12.0.328", + "fileVersion": "12.0.328" + } } }, - "PKSim.Core/12.0.324": { + "PKSim.Core/12.0.328": { "dependencies": { "Newtonsoft.Json": "12.0.3", "OSPSuite.Assets": "12.0.313", @@ -1375,16 +1396,19 @@ "OSPSuite.Core": "12.0.313", "OSPSuite.Infrastructure.Import": "12.0.313", "OSPSuite.Utility": "4.1.0.6", - "PKSim.Assets": "12.0.324", + "PKSim.Assets": "12.0.328", "System.ComponentModel.Annotations": "4.7.0" }, "runtime": { - "PKSim.Core.dll": {} + "PKSim.Core.dll": { + "assemblyVersion": "12.0.328", + "fileVersion": "12.0.328" + } } }, - "PKSim.Infrastructure/12.0.324": { + "PKSim.Infrastructure/12.0.328": { "dependencies": { - "FluentNHibernate": "2.1.2", + "FluentNHibernate": "3.4.0", "LumenWorksCsvReader": "4.0.0", "MarkdownLog.NS20": "0.10.1", "Microsoft.Extensions.Logging": "3.1.0", @@ -1401,30 +1425,36 @@ "OSPSuite.Infrastructure.Serialization": "12.0.313", "OSPSuite.Presentation.Serialization": "12.0.313", "OSPSuite.Utility": "4.1.0.6", - "PKSim.Assets": "12.0.324", - "PKSim.Core": "12.0.324", - "PKSim.Presentation": "12.0.324" + "PKSim.Assets": "12.0.328", + "PKSim.Core": "12.0.328", + "PKSim.Presentation": "12.0.328" }, "runtime": { - "PKSim.Infrastructure.dll": {} + "PKSim.Infrastructure.dll": { + "assemblyVersion": "12.0.328", + "fileVersion": "12.0.328" + } } }, - "PKSim.Presentation/12.0.324": { + "PKSim.Presentation/12.0.328": { "dependencies": { "OSPSuite.Assets": "12.0.313", "OSPSuite.Core": "12.0.313", "OSPSuite.Presentation": "12.0.313", "OSPSuite.TeXReporting": "3.0.0.5", "OSPSuite.Utility": "4.1.0.6", - "PKSim.Assets": "12.0.324", - "PKSim.Assets.Images": "12.0.324", - "PKSim.Core": "12.0.324" + "PKSim.Assets": "12.0.328", + "PKSim.Assets.Images": "12.0.328", + "PKSim.Core": "12.0.328" }, "runtime": { - "PKSim.Presentation.dll": {} + "PKSim.Presentation.dll": { + "assemblyVersion": "12.0.328", + "fileVersion": "12.0.328" + } } }, - "PKSim.R/12.0.324": { + "PKSim.R/12.0.328": { "dependencies": { "OSPSuite.Assets": "12.0.313", "OSPSuite.Core": "12.0.313", @@ -1432,13 +1462,16 @@ "OSPSuite.SimModel": "4.0.0.59", "OSPSuite.SimModelSolver_CVODES": "4.1.0.9", "OSPSuite.Utility": "4.1.0.6", - "PKSim.CLI.Core": "12.0.324", - "PKSim.Core": "12.0.324", - "PKSim.Infrastructure": "12.0.324", + "PKSim.CLI.Core": "12.0.328", + "PKSim.Core": "12.0.328", + "PKSim.Infrastructure": "12.0.328", "System.Data.SQLite.Core": "1.0.118" }, "runtime": { - "PKSim.R.dll": {} + "PKSim.R.dll": { + "assemblyVersion": "12.0.328", + "fileVersion": "12.0.328" + } } } } @@ -1498,12 +1531,12 @@ "path": "devexpress.data/21.2.3", "hashPath": "devexpress.data.21.2.3.nupkg.sha512" }, - "FluentNHibernate/2.1.2": { + "FluentNHibernate/3.4.0": { "type": "package", "serviceable": true, - "sha512": "sha512-JcSxfsgciJQJDEWGYp1tur4XIEBRYpWquDihFZZhFP0yF1UuXwvC/UxNGawQArw6PpLAaVDJdLZPH1Ot8+8DHQ==", - "path": "fluentnhibernate/2.1.2", - "hashPath": "fluentnhibernate.2.1.2.nupkg.sha512" + "sha512": "sha512-PLVeL749HtndhH7LRIk4NlVn5uxqGjkxf7g9QOKPVgE7yAXhFWVJzRLHdKAKfUMbAn6bnvDtswu5J2XrPlzCJw==", + "path": "fluentnhibernate/3.4.0", + "hashPath": "fluentnhibernate.3.4.0.nupkg.sha512" }, "Iesi.Collections/4.0.4": { "type": "package", @@ -1610,12 +1643,12 @@ "path": "microsoft.extensions.primitives/3.1.0", "hashPath": "microsoft.extensions.primitives.3.1.0.nupkg.sha512" }, - "Microsoft.NETCore.Platforms/5.0.0": { + "Microsoft.NETCore.Platforms/2.0.0": { "type": "package", "serviceable": true, - "sha512": "sha512-VyPlqzH2wavqquTcYpkIIAQ6WdenuKoFN0BdYBbCWsclXacSOHNQn66Gt4z5NBqEYW0FAPm5rlvki9ZiCij5xQ==", - "path": "microsoft.netcore.platforms/5.0.0", - "hashPath": "microsoft.netcore.platforms.5.0.0.nupkg.sha512" + "sha512": "sha512-VdLJOCXhZaEMY7Hm2GKiULmn7IEPFE4XC5LPSfBVCUIA8YLZVh846gtfBJalsPQF2PlzdD7ecX7DZEulJ402ZQ==", + "path": "microsoft.netcore.platforms/2.0.0", + "hashPath": "microsoft.netcore.platforms.2.0.0.nupkg.sha512" }, "Microsoft.NETCore.Targets/1.1.3": { "type": "package", @@ -1631,12 +1664,12 @@ "path": "microsoft.win32.registry/5.0.0", "hashPath": "microsoft.win32.registry.5.0.0.nupkg.sha512" }, - "Microsoft.Win32.SystemEvents/5.0.0": { + "Microsoft.Win32.SystemEvents/6.0.0": { "type": "package", "serviceable": true, - "sha512": "sha512-Bh6blKG8VAKvXiLe2L+sEsn62nc1Ij34MrNxepD2OCrS5cpCwQa9MeLyhVQPQ/R4Wlzwuy6wMK8hLb11QPDRsQ==", - "path": "microsoft.win32.systemevents/5.0.0", - "hashPath": "microsoft.win32.systemevents.5.0.0.nupkg.sha512" + "sha512": "sha512-hqTM5628jSsQiv+HGpiq3WKBl2c8v1KZfby2J6Pr7pEPlK9waPdgEO6b8A/+/xn/yZ9ulv8HuqK71ONy2tg67A==", + "path": "microsoft.win32.systemevents/6.0.0", + "hashPath": "microsoft.win32.systemevents.6.0.0.nupkg.sha512" }, "NETStandard.Library/2.0.3": { "type": "package", @@ -1659,12 +1692,12 @@ "path": "newtonsoft.json.schema/3.0.13", "hashPath": "newtonsoft.json.schema.3.0.13.nupkg.sha512" }, - "NHibernate/5.2.5": { + "NHibernate/5.4.9": { "type": "package", "serviceable": true, - "sha512": "sha512-WBCNDRS9LFz6Vo0uz5x7uJWjjW6XkNJYlAhyemLN85cajSDdDe83A5lp0DsWt5tSC0iE0rVnbHAzg/I6X1DVLg==", - "path": "nhibernate/5.2.5", - "hashPath": "nhibernate.5.2.5.nupkg.sha512" + "sha512": "sha512-H78ypzh1T+D2BJDQRd/IYIICplspq/s8x5YhnkXFlcIhmAH0RHIMjjqiJCXSwC+gOqBKRMsmtVvkaCXZHqd76w==", + "path": "nhibernate/5.4.9", + "hashPath": "nhibernate.5.4.9.nupkg.sha512" }, "NPOI/2.5.5": { "type": "package", @@ -1981,12 +2014,12 @@ "path": "system.componentmodel.typeconverter/4.3.0", "hashPath": "system.componentmodel.typeconverter.4.3.0.nupkg.sha512" }, - "System.Configuration.ConfigurationManager/4.5.0": { + "System.Configuration.ConfigurationManager/6.0.0": { "type": "package", "serviceable": true, - "sha512": "sha512-UIFvaFfuKhLr9u5tWMxmVoDPkFeD+Qv8gUuap4aZgVGYSYMdERck4OhLN/2gulAc0nYTEigWXSJNNWshrmxnng==", - "path": "system.configuration.configurationmanager/4.5.0", - "hashPath": "system.configuration.configurationmanager.4.5.0.nupkg.sha512" + "sha512": "sha512-7T+m0kDSlIPTHIkPMIu6m6tV6qsMqJpvQWW2jIc2qi7sn40qxFo0q+7mEQAhMPXZHMKnWrnv47ntGlM/ejvw3g==", + "path": "system.configuration.configurationmanager/6.0.0", + "hashPath": "system.configuration.configurationmanager.6.0.0.nupkg.sha512" }, "System.Data.DataSetExtensions/4.5.0": { "type": "package", @@ -2030,12 +2063,12 @@ "path": "system.diagnostics.tracing/4.1.0", "hashPath": "system.diagnostics.tracing.4.1.0.nupkg.sha512" }, - "System.Drawing.Common/5.0.0": { + "System.Drawing.Common/6.0.0": { "type": "package", "serviceable": true, - "sha512": "sha512-SztFwAnpfKC8+sEKXAFxCBWhKQaEd97EiOL7oZJZP56zbqnLpmxACWA8aGseaUExciuEAUuR9dY8f7HkTRAdnw==", - "path": "system.drawing.common/5.0.0", - "hashPath": "system.drawing.common.5.0.0.nupkg.sha512" + "sha512": "sha512-NfuoKUiP2nUWwKZN6twGqXioIe1zVD0RIj2t976A+czLHr2nY454RwwXs6JU9Htc6mwqL6Dn/nEL3dpVf2jOhg==", + "path": "system.drawing.common/6.0.0", + "hashPath": "system.drawing.common.6.0.0.nupkg.sha512" }, "System.Dynamic.Runtime/4.3.0": { "type": "package", @@ -2233,26 +2266,26 @@ "path": "system.runtime.serialization.primitives/4.3.0", "hashPath": "system.runtime.serialization.primitives.4.3.0.nupkg.sha512" }, - "System.Security.AccessControl/5.0.0": { + "System.Security.AccessControl/6.0.0": { "type": "package", "serviceable": true, - "sha512": "sha512-dagJ1mHZO3Ani8GH0PHpPEe/oYO+rVdbQjvjJkBRNQkX4t0r1iaeGn8+/ybkSLEan3/slM0t59SVdHzuHf2jmw==", - "path": "system.security.accesscontrol/5.0.0", - "hashPath": "system.security.accesscontrol.5.0.0.nupkg.sha512" + "sha512": "sha512-AUADIc0LIEQe7MzC+I0cl0rAT8RrTAKFHl53yHjEUzNVIaUlhFY11vc2ebiVJzVBuOzun6F7FBA+8KAbGTTedQ==", + "path": "system.security.accesscontrol/6.0.0", + "hashPath": "system.security.accesscontrol.6.0.0.nupkg.sha512" }, - "System.Security.Cryptography.ProtectedData/4.5.0": { + "System.Security.Cryptography.ProtectedData/6.0.0": { "type": "package", "serviceable": true, - "sha512": "sha512-wLBKzFnDCxP12VL9ANydSYhk59fC4cvOr9ypYQLPnAj48NQIhqnjdD2yhP8yEKyBJEjERWS9DisKL7rX5eU25Q==", - "path": "system.security.cryptography.protecteddata/4.5.0", - "hashPath": "system.security.cryptography.protecteddata.4.5.0.nupkg.sha512" + "sha512": "sha512-rp1gMNEZpvx9vP0JW0oHLxlf8oSiQgtno77Y4PLUBjSiDYoD77Y8uXHr1Ea5XG4/pIKhqAdxZ8v8OTUtqo9PeQ==", + "path": "system.security.cryptography.protecteddata/6.0.0", + "hashPath": "system.security.cryptography.protecteddata.6.0.0.nupkg.sha512" }, - "System.Security.Permissions/4.5.0": { + "System.Security.Permissions/6.0.0": { "type": "package", "serviceable": true, - "sha512": "sha512-9gdyuARhUR7H+p5CjyUB/zPk7/Xut3wUSP8NJQB6iZr8L3XUXTMdoLeVAg9N4rqF8oIpE7MpdqHdDHQ7XgJe0g==", - "path": "system.security.permissions/4.5.0", - "hashPath": "system.security.permissions.4.5.0.nupkg.sha512" + "sha512": "sha512-T/uuc7AklkDoxmcJ7LGkyX1CcSviZuLCa4jg3PekfJ7SU0niF0IVTXwUiNVP9DSpzou2PpxJ+eNY2IfDM90ZCg==", + "path": "system.security.permissions/6.0.0", + "hashPath": "system.security.permissions.6.0.0.nupkg.sha512" }, "System.Security.Principal.Windows/5.0.0": { "type": "package", @@ -2317,6 +2350,13 @@ "path": "system.threading.thread/4.3.0", "hashPath": "system.threading.thread.4.3.0.nupkg.sha512" }, + "System.Windows.Extensions/6.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-IXoJOXIqc39AIe+CIR7koBtRGMiCt/LPM3lI+PELtDIy9XdyeSrwXFdWV9dzJ2Awl0paLWUaknLxFQ5HpHZUog==", + "path": "system.windows.extensions/6.0.0", + "hashPath": "system.windows.extensions.6.0.0.nupkg.sha512" + }, "System.Xml.ReaderWriter/4.3.0": { "type": "package", "serviceable": true, @@ -2331,37 +2371,37 @@ "path": "system.xml.xmldocument/4.3.0", "hashPath": "system.xml.xmldocument.4.3.0.nupkg.sha512" }, - "PKSim.Assets/12.0.324": { + "PKSim.Assets/12.0.328": { "type": "project", "serviceable": false, "sha512": "" }, - "PKSim.Assets.Images/12.0.324": { + "PKSim.Assets.Images/12.0.328": { "type": "project", "serviceable": false, "sha512": "" }, - "PKSim.CLI.Core/12.0.324": { + "PKSim.CLI.Core/12.0.328": { "type": "project", "serviceable": false, "sha512": "" }, - "PKSim.Core/12.0.324": { + "PKSim.Core/12.0.328": { "type": "project", "serviceable": false, "sha512": "" }, - "PKSim.Infrastructure/12.0.324": { + "PKSim.Infrastructure/12.0.328": { "type": "project", "serviceable": false, "sha512": "" }, - "PKSim.Presentation/12.0.324": { + "PKSim.Presentation/12.0.328": { "type": "project", "serviceable": false, "sha512": "" }, - "PKSim.R/12.0.324": { + "PKSim.R/12.0.328": { "type": "project", "serviceable": false, "sha512": "" diff --git a/inst/lib/ConsoleApp.dll b/inst/lib/ConsoleApp.dll index a3f37be48..58c0bf11b 100644 Binary files a/inst/lib/ConsoleApp.dll and b/inst/lib/ConsoleApp.dll differ diff --git a/inst/lib/FluentNHibernate.dll b/inst/lib/FluentNHibernate.dll index 87c90edd2..b9eadace5 100644 Binary files a/inst/lib/FluentNHibernate.dll and b/inst/lib/FluentNHibernate.dll differ diff --git a/inst/lib/Microsoft.Win32.SystemEvents.dll b/inst/lib/Microsoft.Win32.SystemEvents.dll index d62f3335b..3ab58500b 100644 Binary files a/inst/lib/Microsoft.Win32.SystemEvents.dll and b/inst/lib/Microsoft.Win32.SystemEvents.dll differ diff --git a/inst/lib/NHibernate.dll b/inst/lib/NHibernate.dll index 5509a96bc..b3d401dd1 100644 Binary files a/inst/lib/NHibernate.dll and b/inst/lib/NHibernate.dll differ diff --git a/inst/lib/PKSim.Assets.Images.dll b/inst/lib/PKSim.Assets.Images.dll index 5cb66c12e..c4d45004f 100644 Binary files a/inst/lib/PKSim.Assets.Images.dll and b/inst/lib/PKSim.Assets.Images.dll differ diff --git a/inst/lib/PKSim.Assets.dll b/inst/lib/PKSim.Assets.dll index cc16467eb..65f42778c 100644 Binary files a/inst/lib/PKSim.Assets.dll and b/inst/lib/PKSim.Assets.dll differ diff --git a/inst/lib/PKSim.CLI.Core.dll b/inst/lib/PKSim.CLI.Core.dll index 7159ca093..d1a9271b2 100644 Binary files a/inst/lib/PKSim.CLI.Core.dll and b/inst/lib/PKSim.CLI.Core.dll differ diff --git a/inst/lib/PKSim.Core.dll b/inst/lib/PKSim.Core.dll index a2dd3e4d3..6819a09b1 100644 Binary files a/inst/lib/PKSim.Core.dll and b/inst/lib/PKSim.Core.dll differ diff --git a/inst/lib/PKSim.Infrastructure.dll b/inst/lib/PKSim.Infrastructure.dll index 5cf9b591f..6b416becd 100644 Binary files a/inst/lib/PKSim.Infrastructure.dll and b/inst/lib/PKSim.Infrastructure.dll differ diff --git a/inst/lib/PKSim.Presentation.dll b/inst/lib/PKSim.Presentation.dll index 30d400024..c0dd02628 100644 Binary files a/inst/lib/PKSim.Presentation.dll and b/inst/lib/PKSim.Presentation.dll differ diff --git a/inst/lib/PKSim.R.dll b/inst/lib/PKSim.R.dll index dd5875998..4ea6b2415 100644 Binary files a/inst/lib/PKSim.R.dll and b/inst/lib/PKSim.R.dll differ diff --git a/inst/lib/System.Configuration.ConfigurationManager.dll b/inst/lib/System.Configuration.ConfigurationManager.dll index 7d0b114d6..d67c8a8a4 100644 Binary files a/inst/lib/System.Configuration.ConfigurationManager.dll and b/inst/lib/System.Configuration.ConfigurationManager.dll differ diff --git a/inst/lib/System.Drawing.Common.dll b/inst/lib/System.Drawing.Common.dll index 2ca2eb5ce..be6915e54 100644 Binary files a/inst/lib/System.Drawing.Common.dll and b/inst/lib/System.Drawing.Common.dll differ diff --git a/inst/lib/System.Security.Cryptography.ProtectedData.dll b/inst/lib/System.Security.Cryptography.ProtectedData.dll index 3feb9f938..1ba87704c 100644 Binary files a/inst/lib/System.Security.Cryptography.ProtectedData.dll and b/inst/lib/System.Security.Cryptography.ProtectedData.dll differ diff --git a/inst/lib/System.Security.Permissions.dll b/inst/lib/System.Security.Permissions.dll index d1af38f0f..39dd4df91 100644 Binary files a/inst/lib/System.Security.Permissions.dll and b/inst/lib/System.Security.Permissions.dll differ diff --git a/inst/lib/System.Windows.Extensions.dll b/inst/lib/System.Windows.Extensions.dll new file mode 100644 index 000000000..c3e8844fa Binary files /dev/null and b/inst/lib/System.Windows.Extensions.dll differ diff --git a/man/convertSnapshot.Rd b/man/convertSnapshot.Rd new file mode 100644 index 000000000..9a0897853 --- /dev/null +++ b/man/convertSnapshot.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/snapshots.R +\name{convertSnapshot} +\alias{convertSnapshot} +\title{Convert between snapshot and project formats} +\usage{ +convertSnapshot(..., format, output = ".") +} +\arguments{ +\item{...}{character strings, path to files or a directory containing files to convert} + +\item{format, }{character string, target format either "snapshot" or "project".} + +\item{output}{character string, path to the output directory where to write the converted files} +} +\description{ +Convert between snapshot and project formats +} +\examples{ +\dontrun{ +convertSnapshot("path/to/snapshot.json", format = "project") +convertSnapshot("path/to/project.pksim5", format = "snapshot") +} +} diff --git a/man/dot-gatherFiles.Rd b/man/dot-gatherFiles.Rd new file mode 100644 index 000000000..77cb4aa22 --- /dev/null +++ b/man/dot-gatherFiles.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/snapshots.R +\name{.gatherFiles} +\alias{.gatherFiles} +\title{Gather files and files from folders to one location} +\usage{ +.gatherFiles(...) +} +\arguments{ +\item{...}{character strings of file paths or folder paths} +} +\value{ +A temporary directory with all files copied to it +} +\description{ +Gather files and files from folders to one location +} diff --git a/man/messages.Rd b/man/messages.Rd index f42344008..b7f7ef1ed 100644 --- a/man/messages.Rd +++ b/man/messages.Rd @@ -6,7 +6,7 @@ \title{List of functions and strings used to signal error messages Extends the \code{messages} list from ospsuite.utils} \format{ -An object of class \code{list} of length 61. +An object of class \code{list} of length 62. } \usage{ messages diff --git a/man/reexports.Rd b/man/reexports.Rd index 3ce94825e..35ee57cd1 100644 --- a/man/reexports.Rd +++ b/man/reexports.Rd @@ -23,6 +23,6 @@ below to see their documentation. \describe{ \item{ospsuite.utils}{\code{\link[ospsuite.utils:op-null-default]{\%||\%}}, \code{\link[ospsuite.utils]{enum}}, \code{\link[ospsuite.utils]{enumGetKey}}, \code{\link[ospsuite.utils]{enumGetValue}}, \code{\link[ospsuite.utils]{enumHasKey}}, \code{\link[ospsuite.utils]{enumKeys}}, \code{\link[ospsuite.utils]{enumPut}}, \code{\link[ospsuite.utils]{enumRemove}}, \code{\link[ospsuite.utils]{enumValues}}} - \item{tlf}{\code{\link[tlf]{PlotGridConfiguration}}, \code{\link[tlf]{plotGrid}}} + \item{tlf}{\code{\link[tlf]{plotGrid}}, \code{\link[tlf]{PlotGridConfiguration}}} }} diff --git a/man/runSimulationsFromSnapshot.Rd b/man/runSimulationsFromSnapshot.Rd new file mode 100644 index 000000000..f61af9022 --- /dev/null +++ b/man/runSimulationsFromSnapshot.Rd @@ -0,0 +1,33 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/snapshots.R +\name{runSimulationsFromSnapshot} +\alias{runSimulationsFromSnapshot} +\title{Run Simulations From Snapshot Files} +\usage{ +runSimulationsFromSnapshot( + ..., + output = ".", + csv = TRUE, + pkml = FALSE, + xml = FALSE +) +} +\arguments{ +\item{...}{character strings, path to snapshot files or a directory containing snapshot files} + +\item{output}{character string, path to the output directory where to write simulation results} + +\item{csv}{logical, whether to export the results as csv (default = TRUE)} + +\item{pkml}{logical, whether to export the results as pkml (default = FALSE)} + +\item{xml}{logical, whether to export the results as xml (default = FALSE)} +} +\description{ +Run Simulations From Snapshot Files +} +\examples{ +\dontrun{ +runSimulationsFromSnapshot("path/to/my_snapshot.json", csv = TRUE, pkml = TRUE) +} +} diff --git a/tests/data/test_project.pksim5 b/tests/data/test_project.pksim5 new file mode 100644 index 000000000..c89bddbb2 Binary files /dev/null and b/tests/data/test_project.pksim5 differ diff --git a/tests/data/test_snapshot.json b/tests/data/test_snapshot.json new file mode 100644 index 000000000..f7108e907 --- /dev/null +++ b/tests/data/test_snapshot.json @@ -0,0 +1,776 @@ +{ + "Version": 79, + "Individuals": [ + { + "Name": "Mouse", + "Seed": 712090093, + "OriginData": { + "CalculationMethods": [ + "SurfaceAreaPlsInt_VAR1" + ], + "Species": "Mouse" + }, + "ExpressionProfiles": [] + } + ], + "Compounds": [ + { + "Name": "Generic_compound", + "IsSmallMolecule": true, + "PlasmaProteinBindingPartner": "Albumin", + "Lipophilicity": [ + { + "Name": "Measurement", + "Parameters": [ + { + "Name": "Lipophilicity", + "Value": 4.0, + "Unit": "Log Units" + } + ] + } + ], + "FractionUnbound": [ + { + "Name": "Measurement", + "Species": "Mouse", + "Parameters": [ + { + "Name": "Fraction unbound (plasma, reference value)", + "Value": 0.05 + } + ] + } + ], + "Solubility": [ + { + "Name": "Measurement", + "Parameters": [ + { + "Name": "Solubility at reference pH", + "Value": 0.01, + "Unit": "mg/ml" + }, + { + "Name": "Reference pH", + "Value": 7.0 + } + ] + } + ], + "IntestinalPermeability": [ + { + "Name": "Peff", + "Parameters": [ + { + "Name": "Specific intestinal permeability (transcellular)", + "Value": 0.0004, + "Unit": "cm/s" + } + ] + } + ], + "Permeability": [ + { + "Name": "Perm", + "Parameters": [ + { + "Name": "Permeability", + "Value": 2E-05, + "Unit": "cm/s" + } + ] + } + ], + "PkaTypes": [ + { + "Type": "Acid", + "Pka": 4.5, + "ValueOrigin": { + "Source": "Unknown" + } + } + ], + "Processes": [ + { + "InternalName": "LiverClearance", + "DataSource": "LiverPlasmaClearance", + "Species": "Mouse", + "Parameters": [ + { + "Name": "Fraction unbound (experiment)", + "Value": 0.05 + }, + { + "Name": "Lipophilicity (experiment)", + "Value": 4.0, + "Unit": "Log Units" + }, + { + "Name": "Plasma clearance", + "Value": 0.0, + "Unit": "ml/min/kg" + }, + { + "Name": "Specific clearance", + "Value": 2.5, + "Unit": "1/min", + "ValueOrigin": { + "Source": "Unknown" + } + } + ] + } + ], + "CalculationMethods": [ + "Cellular partition coefficient method - PK-Sim Standard", + "Cellular permeability - PK-Sim Standard" + ], + "Parameters": [ + { + "Name": "Cl", + "Value": 1.0, + "ValueOrigin": { + "Source": "Unknown" + } + }, + { + "Name": "Molecular weight", + "Value": 500.0, + "Unit": "g/mol" + } + ] + } + ], + "Formulations": [ + { + "Name": "Default Weibull", + "FormulationType": "Formulation_Tablet_Weibull", + "Parameters": [ + { + "Name": "Dissolution time (50% dissolved)", + "Value": 240.0, + "Unit": "min" + }, + { + "Name": "Lag time", + "Value": 0.0, + "Unit": "min" + }, + { + "Name": "Dissolution shape", + "Value": 0.92 + }, + { + "Name": "Use as suspension", + "Value": 1.0 + } + ] + } + ], + "Protocols": [ + { + "Name": "IV only", + "ApplicationType": "IntravenousBolus", + "DosingInterval": "Single", + "Parameters": [ + { + "Name": "Start time", + "Value": 0.0, + "Unit": "h" + }, + { + "Name": "InputDose", + "Value": 1.0, + "Unit": "mg/kg" + } + ] + }, + { + "Name": "IV + Weibull", + "DosingInterval": "Single", + "Schemas": [ + { + "Name": "Schema 1", + "SchemaItems": [ + { + "Name": "Schema Item 1", + "ApplicationType": "IntravenousBolus", + "Parameters": [ + { + "Name": "Start time", + "Value": 0.0, + "Unit": "h" + }, + { + "Name": "InputDose", + "Value": 1.0, + "Unit": "mg/kg" + } + ] + } + ], + "Parameters": [ + { + "Name": "Start time", + "Value": 0.0, + "Unit": "h" + }, + { + "Name": "NumberOfRepetitions", + "Value": 1.0 + }, + { + "Name": "TimeBetweenRepetitions", + "Value": 0.0, + "Unit": "h" + } + ] + }, + { + "Name": "Schema 2", + "SchemaItems": [ + { + "Name": "Schema Item 1", + "ApplicationType": "Oral", + "FormulationKey": "Formulation", + "Parameters": [ + { + "Name": "Start time", + "Value": 0.0, + "Unit": "h" + }, + { + "Name": "InputDose", + "Value": 0.0, + "Unit": "mg/kg" + }, + { + "Name": "Volume of water/body weight", + "Value": 0.0, + "Unit": "ml/kg" + } + ] + } + ], + "Parameters": [ + { + "Name": "Start time", + "Value": 0.0, + "Unit": "h" + }, + { + "Name": "NumberOfRepetitions", + "Value": 1.0 + }, + { + "Name": "TimeBetweenRepetitions", + "Value": 0.0, + "Unit": "h" + } + ] + } + ], + "TimeUnit": "h" + } + ], + "Simulations": [ + { + "Name": "Simulation - IV + Weibull - Default tolerance", + "Model": "4Comp", + "Solver": {}, + "OutputSchema": [ + { + "Parameters": [ + { + "Name": "Start time", + "Value": 0.0, + "Unit": "h" + }, + { + "Name": "End time", + "Value": 24.0, + "Unit": "h", + "ValueOrigin": { + "Source": "Unknown" + } + }, + { + "Name": "Resolution", + "Value": 20.0, + "Unit": "pts/h" + } + ] + } + ], + "Parameters": [ + { + "Path": "Applications|IV + Weibull|Default Weibull|Application_2|ProtocolSchemaItem|Volume of water/body weight", + "Value": 0.0, + "Unit": "ml/kg" + }, + { + "Path": "Undefined Liver|Reference concentration", + "Value": 1.0, + "Unit": "µmol/l" + }, + { + "Path": "Undefined Liver|t1/2 (intestine)", + "Value": 1380.0, + "Unit": "min" + }, + { + "Path": "Undefined Liver|t1/2 (liver)", + "Value": 2160.0, + "Unit": "min" + } + ], + "OutputSelections": [ + "Organism|VenousBlood|Plasma|Generic_compound|Concentration in container", + "Organism|Skin|Intracellular|Generic_compound|Concentration in container" + ], + "Individual": "Mouse", + "Compounds": [ + { + "Name": "Generic_compound", + "CalculationMethods": [ + "Cellular partition coefficient method - Rodgers and Rowland", + "Cellular permeability - PK-Sim Standard" + ], + "Alternatives": [ + { + "AlternativeName": "Perm", + "GroupName": "COMPOUND_PERMEABILITY" + }, + { + "AlternativeName": "Peff", + "GroupName": "COMPOUND_INTESTINAL_PERMEABILITY" + } + ], + "Processes": [ + { + "Name": "Total Hepatic Clearance-LiverPlasmaClearance", + "SystemicProcessType": "Hepatic" + } + ], + "Protocol": { + "Name": "IV + Weibull", + "Formulations": [ + { + "Name": "Default Weibull", + "Key": "Formulation" + } + ] + } + } + ], + "HasResults": true, + "IndividualAnalyses": [ + { + "Axes": [ + { + "Unit": "h", + "Dimension": "Time", + "Type": "X", + "GridLines": false, + "Visible": true, + "DefaultColor": "#FFFFFF", + "DefaultLineStyle": "None", + "Scaling": "Linear", + "NumberMode": "Normal" + }, + { + "Unit": "µmol/l", + "Dimension": "Concentration (molar)", + "Type": "Y", + "GridLines": false, + "Visible": true, + "DefaultColor": "#FFFFFF", + "DefaultLineStyle": "Solid", + "Scaling": "Log", + "NumberMode": "Normal" + } + ], + "Curves": [ + { + "Name": "Generic_compound-Venous Blood-Plasma-Concentration", + "X": "Time", + "Y": "Simulation - IV + Weibull - Default tolerance|Organism|VenousBlood|Plasma|Generic_compound|Concentration in container", + "CurveOptions": { + "Color": "#FF0000", + "LegendIndex": 1 + } + }, + { + "Name": "Generic_compound-Skin-Intracellular-Concentration", + "X": "Time", + "Y": "Simulation - IV + Weibull - Default tolerance|Organism|Skin|Intracellular|Generic_compound|Concentration in container", + "CurveOptions": { + "Color": "#0000FF", + "LegendIndex": 2 + } + } + ], + "Name": "Time Profile Analysis", + "FontAndSize": { + "Fonts": { + "AxisSize": 10, + "LegendSize": 8, + "TitleSize": 16, + "DescriptionSize": 12, + "OriginSize": 8, + "FontFamilyName": "Microsoft Sans Serif", + "WatermarkSize": 32 + } + }, + "Settings": { + "SideMarginsEnabled": true, + "LegendPosition": "RightInside", + "BackColor": "#FFFFFF", + "DiagramBackColor": "#FFFFFF" + }, + "OriginText": "Comparison advanced admin with weibull\nSimulation - IV + Weibull - Default tolerance\n2024-08-30 09:51" + } + ] + }, + { + "Name": "Simulation - IV only - Default tolerance", + "Model": "4Comp", + "Solver": {}, + "OutputSchema": [ + { + "Parameters": [ + { + "Name": "Start time", + "Value": 0.0, + "Unit": "h" + }, + { + "Name": "End time", + "Value": 24.0, + "Unit": "h", + "ValueOrigin": { + "Source": "Unknown" + } + }, + { + "Name": "Resolution", + "Value": 20.0, + "Unit": "pts/h" + } + ] + } + ], + "Parameters": [ + { + "Path": "Undefined Liver|Reference concentration", + "Value": 1.0, + "Unit": "µmol/l" + }, + { + "Path": "Undefined Liver|t1/2 (intestine)", + "Value": 1380.0, + "Unit": "min" + }, + { + "Path": "Undefined Liver|t1/2 (liver)", + "Value": 2160.0, + "Unit": "min" + } + ], + "OutputSelections": [ + "Organism|Skin|Intracellular|Generic_compound|Concentration in container", + "Organism|VenousBlood|Plasma|Generic_compound|Concentration in container" + ], + "Individual": "Mouse", + "Compounds": [ + { + "Name": "Generic_compound", + "CalculationMethods": [ + "Cellular partition coefficient method - Rodgers and Rowland", + "Cellular permeability - PK-Sim Standard" + ], + "Alternatives": [ + { + "AlternativeName": "Perm", + "GroupName": "COMPOUND_PERMEABILITY" + }, + { + "AlternativeName": "Peff", + "GroupName": "COMPOUND_INTESTINAL_PERMEABILITY" + } + ], + "Processes": [ + { + "Name": "Total Hepatic Clearance-LiverPlasmaClearance", + "SystemicProcessType": "Hepatic" + } + ], + "Protocol": { + "Name": "IV only" + } + } + ], + "HasResults": true, + "IndividualAnalyses": [ + { + "Axes": [ + { + "Unit": "h", + "Dimension": "Time", + "Type": "X", + "GridLines": false, + "Visible": true, + "DefaultColor": "#FFFFFF", + "DefaultLineStyle": "None", + "Scaling": "Linear", + "NumberMode": "Normal" + }, + { + "Unit": "µmol/l", + "Dimension": "Concentration (molar)", + "Type": "Y", + "GridLines": false, + "Visible": true, + "DefaultColor": "#FFFFFF", + "DefaultLineStyle": "Solid", + "Scaling": "Log", + "NumberMode": "Normal" + } + ], + "Curves": [ + { + "Name": "Generic_compound-Skin-Intracellular-Concentration", + "X": "Time", + "Y": "Simulation - IV only - Default tolerance|Organism|Skin|Intracellular|Generic_compound|Concentration in container", + "CurveOptions": { + "Color": "#FF0000", + "LegendIndex": 1 + } + }, + { + "Name": "Generic_compound-Venous Blood-Plasma-Concentration", + "X": "Time", + "Y": "Simulation - IV only - Default tolerance|Organism|VenousBlood|Plasma|Generic_compound|Concentration in container", + "CurveOptions": { + "Color": "#0000FF", + "LegendIndex": 2 + } + } + ], + "Name": "Time Profile Analysis", + "FontAndSize": { + "Fonts": { + "AxisSize": 10, + "LegendSize": 8, + "TitleSize": 16, + "DescriptionSize": 12, + "OriginSize": 8, + "FontFamilyName": "Microsoft Sans Serif", + "WatermarkSize": 32 + } + }, + "Settings": { + "SideMarginsEnabled": true, + "LegendPosition": "RightInside", + "BackColor": "#FFFFFF", + "DiagramBackColor": "#FFFFFF" + }, + "OriginText": "Comparison advanced admin with weibull\nSimulation - IV only - Default tolerance\n2024-08-30 09:51" + } + ] + } + ], + "SimulationComparisons": [ + { + "Name": "Simulation Comparison - Tolerance reduced", + "Simulations": [ + "Simulation - IV + Weibull - Tolerance reduced", + "Simulation - IV only - Tolerance reduced" + ], + "IndividualComparison": { + "Axes": [ + { + "Unit": "h", + "Dimension": "Time", + "Type": "X", + "GridLines": false, + "Visible": true, + "Min": 15.53561, + "Max": 25.05864, + "DefaultColor": "#FFFFFF", + "DefaultLineStyle": "None", + "Scaling": "Linear", + "NumberMode": "Normal" + }, + { + "Unit": "µmol/l", + "Dimension": "Concentration (molar)", + "Type": "Y", + "GridLines": false, + "Visible": true, + "Min": 5.034298E-07, + "Max": 0.3479374, + "DefaultColor": "#FFFFFF", + "DefaultLineStyle": "Solid", + "Scaling": "Log", + "NumberMode": "Normal" + } + ], + "Curves": [ + { + "Name": "Simulation - IV only-Generic_compound-Venous Blood-Plasma-Concentration", + "X": "Time", + "Y": "Simulation - IV only - Tolerance reduced|Organism|VenousBlood|Plasma|Generic_compound|Concentration in container", + "CurveOptions": { + "Color": "#800080", + "LegendIndex": 2 + } + }, + { + "Name": "Simulation - IV only-Generic_compound-Skin-Intracellular-Concentration", + "X": "Time", + "Y": "Simulation - IV only - Tolerance reduced|Organism|Skin|Intracellular|Generic_compound|Concentration in container", + "CurveOptions": { + "Color": "#0000FF", + "LegendIndex": 3 + } + }, + { + "Name": "Simulation - IV + Weibull-Generic_compound-Venous Blood-Plasma-Concentration", + "X": "Time", + "Y": "Simulation - IV + Weibull - Tolerance reduced|Organism|VenousBlood|Plasma|Generic_compound|Concentration in container", + "CurveOptions": { + "Color": "#FF00FF", + "LegendIndex": 1, + "LineStyle": "Dash" + } + }, + { + "Name": "Simulation - IV + Weibull-Generic_compound-Skin-Intracellular-Concentration", + "X": "Time", + "Y": "Simulation - IV + Weibull - Tolerance reduced|Organism|Skin|Intracellular|Generic_compound|Concentration in container", + "CurveOptions": { + "Color": "#008000", + "LegendIndex": 2, + "LineStyle": "Dash" + } + } + ], + "Name": "Simulation Comparison - Tolerance reduced", + "FontAndSize": { + "Fonts": { + "AxisSize": 10, + "LegendSize": 8, + "TitleSize": 16, + "DescriptionSize": 12, + "OriginSize": 8, + "FontFamilyName": "Microsoft Sans Serif", + "WatermarkSize": 32 + } + }, + "Settings": { + "SideMarginsEnabled": true, + "LegendPosition": "RightInside", + "BackColor": "#FFFFFF", + "DiagramBackColor": "#FFFFFF" + } + } + }, + { + "Name": "Simulation Comparison - Default tolerance", + "Simulations": [ + "Simulation - IV only - Default tolerance", + "Simulation - IV + Weibull - Default tolerance" + ], + "IndividualComparison": { + "Axes": [ + { + "Unit": "h", + "Dimension": "Time", + "Type": "X", + "GridLines": false, + "Visible": true, + "Min": 15.75082, + "Max": 23.63288, + "DefaultColor": "#FFFFFF", + "DefaultLineStyle": "None", + "Scaling": "Linear", + "NumberMode": "Normal" + }, + { + "Unit": "µmol/l", + "Dimension": "Concentration (molar)", + "Type": "Y", + "GridLines": false, + "Visible": true, + "Min": 4.803477E-07, + "Max": 0.3479376, + "DefaultColor": "#FFFFFF", + "DefaultLineStyle": "Solid", + "Scaling": "Log", + "NumberMode": "Normal" + } + ], + "Curves": [ + { + "Name": "Simulation - IV only - Default tolerance-Generic_compound-Skin-Intracellular-Concentration", + "X": "Time", + "Y": "Simulation - IV only - Default tolerance|Organism|Skin|Intracellular|Generic_compound|Concentration in container", + "CurveOptions": { + "Color": "#0000FF", + "LegendIndex": 1 + } + }, + { + "Name": "Simulation - IV only - Default tolerance-Generic_compound-Venous Blood-Plasma-Concentration", + "X": "Time", + "Y": "Simulation - IV only - Default tolerance|Organism|VenousBlood|Plasma|Generic_compound|Concentration in container", + "CurveOptions": { + "Color": "#800080", + "LegendIndex": 2 + } + }, + { + "Name": "Simulation - IV + Weibull - Default tolerance-Generic_compound-Venous Blood-Plasma-Concentration", + "X": "Time", + "Y": "Simulation - IV + Weibull - Default tolerance|Organism|VenousBlood|Plasma|Generic_compound|Concentration in container", + "CurveOptions": { + "Color": "#FF00FF", + "LegendIndex": 1, + "LineStyle": "Dash" + } + }, + { + "Name": "Simulation - IV + Weibull - Default tolerance-Generic_compound-Skin-Intracellular-Concentration", + "X": "Time", + "Y": "Simulation - IV + Weibull - Default tolerance|Organism|Skin|Intracellular|Generic_compound|Concentration in container", + "CurveOptions": { + "Color": "#008000", + "LegendIndex": 2, + "LineStyle": "Dash" + } + } + ], + "Name": "Simulation Comparison - Default tolerance", + "FontAndSize": { + "Fonts": { + "AxisSize": 10, + "LegendSize": 8, + "TitleSize": 16, + "DescriptionSize": 12, + "OriginSize": 8, + "FontFamilyName": "Microsoft Sans Serif", + "WatermarkSize": 32 + } + }, + "Settings": { + "SideMarginsEnabled": true, + "LegendPosition": "RightInside", + "BackColor": "#FFFFFF", + "DiagramBackColor": "#FFFFFF" + } + } + } + ] +} \ No newline at end of file diff --git a/tests/testthat/test-snapshots.R b/tests/testthat/test-snapshots.R new file mode 100644 index 000000000..f4614fcba --- /dev/null +++ b/tests/testthat/test-snapshots.R @@ -0,0 +1,91 @@ +test_that("Run simulation from snapshot works", { + path <- getTestDataFilePath("test_snapshot.json") + + temp_dir <- withr::local_tempdir() + + runSimulationsFromSnapshot(path, output = temp_dir, exportCSV = TRUE, exportPKML = TRUE, exportJSON = TRUE, exportXML = TRUE) + expect_length(list.files(temp_dir, pattern = ".csv"), 3) + expect_length(list.files(temp_dir, pattern = ".pkml"), 2) + expect_length(list.files(temp_dir, pattern = ".json"), 2) + expect_length(list.files(temp_dir, pattern = ".xml"), 2) +}) + +test_that("runSimulationsFromSnapshot arguments are checked", { + path <- getTestDataFilePath("test_snapshot.json") + + temp_dir <- withr::local_tempdir() + + expect_error(runSimulationsFromSnapshot(path, exportCSV = "path/to/my.csv")) + expect_error(runSimulationsFromSnapshot(path, output = 1)) + + # provide wrong input/output paths + expect_error(runSimulationsFromSnapshot("wrong_file.json", "wrong/path", + output = "wrong/output/path" + )) +}) + +test_that("Convert snapshot to project works", { + path <- getTestDataFilePath("test_snapshot.json") + temp_dir <- withr::local_tempdir() + convertSnapshot(path, output = temp_dir, format = "project") + + expect_length(list.files(temp_dir, pattern = ".pksim5"), 1) +}) + +test_that("Convert project to snapshot works", { + path <- getTestDataFilePath("test_project.pksim5") + temp_dir <- withr::local_tempdir() + convertSnapshot(path, output = temp_dir, format = "snapshot") + + expect_length(list.files(temp_dir, pattern = ".json"), 1) +}) + +test_that("gather files handles one file path", { + # create a temporary file + temp_file <- withr::local_tempfile(fileext = ".json", lines = "content") + # .gatherFiles should copy the file to a new temporary directory + new_temp_dir <- .gatherFiles(temp_file) + expect_true(length(list.files(new_temp_dir, pattern = ".json")) == 1) +}) + +test_that("gather files handles several file paths", { + # create two separate temp directory + temp_dir1 <- withr::local_tempdir() + temp_dir2 <- withr::local_tempdir() + + # create two files in temp_dir + files <- file.path(c(temp_dir1, temp_dir2), c("file1.json", "file2.json")) + file.create(files) + + # .gatherFiles should copy the file to a new temporary directory + new_temp_dir <- .gatherFiles(files) + expect_true(length(list.files(new_temp_dir, pattern = ".json")) == 2) +}) + +test_that("gather files handles a directory with several files", { + # create a temp directory + temp_dir <- withr::local_tempdir() + + # create two files in temp_dir + files <- file.path(temp_dir, c("file1.json", "file2.json")) + file.create(files) + + # .gatherFiles should copy the file to a new temporary directory + new_temp_dir <- .gatherFiles(temp_dir) + expect_true(length(list.files(new_temp_dir, pattern = ".json")) == 2) +}) + +test_that("gather files handles files and directories", { + # create a temp directory + temp_dir <- withr::local_tempdir() + + # create two files in a subdir and one file in temp_dir + sub_dir <- withr::local_tempdir(tmpdir = temp_dir) + dir_files <- file.path(sub_dir, c("file1.json", "file2.json")) + file <- file.path(temp_dir, "file.json") + files <- c(dir_files, file) + file.create(files) + + new_temp_dir <- .gatherFiles(file, sub_dir) + expect_true(length(list.files(new_temp_dir, pattern = ".json")) == 3) +})