Initial Setup

library(CoRC)
loadExamples(1)
#> [[1]]
#> # A COPASI model reference:
#> Model name: "The Brusselator"
#> Number of compartments: 1
#> Number of species: 6
#> Number of reactions: 4

Quicklist

Todo:

  • Add more COPASI tasks
  • (Internal) Code marked with ‘TODO’ for minor problems
  • Consider only ever using setcompileflag instead of compiling
  • getListOfPossibleFunctions only returns bare pointer

Issues:

  • getwd() and copasi$getReferenceDirectory() are not in sync
  • some S3 classes should have reconstruct functions (hadley/sloop)

Saving .cps loses experimental data

I commonly want to save a .cps to a tmp folder but when I do that experimental data paths will fail.

# Load example which has experimental data.
datamodel <- loadExamples(4)[[1]]

fitproblem <- as(datamodel$getTask("Parameter Estimation")$getProblem(), "_p_CFitProblem")
filenames <- fitproblem$getExperimentSet()$getFileNames()

The filenames are in the correct folder.

filenames
#> [1] "/tmp/RtmpMgOczC/temp_libpath2af3754b0cee/CoRC/extdata/test_paramest_exp_data.txt"
file.exists(filenames)
#> [1] TRUE

Now I will save the model into a tmp folder.

file <- tempfile(fileext = ".cps")
saveModel(file)
unloadModel()

datamodel <- loadModel(file)
fitproblem <- as(datamodel$getTask("Parameter Estimation")$getProblem(), "_p_CFitProblem")
filenames <- fitproblem$getExperimentSet()$getFileNames()

The filenames are now supposedly in the folder where the .cps was saved but there they don’t exist.

filenames
#> [1] "/tmp/RtmpMgOczC/temp_libpath2af3754b0cee/CoRC/extdata/test_paramest_exp_data.txt"
file.exists(filenames)
#> [1] TRUE