This workflow gives out the collapsed result for 4 models.

Setup

First, load the libraries needed for the workflow

library(tidyverse)
library(CoRC)

Input

Put in all variables needed to customise the workflow

Put in the path to the model (.cps), as a local path (as string) and load the model. Use loadSBML() for sbml models.

# Load all models
model_PVR  <- loadModel("Models/Aston2018PVR_model.cps")
model_BT   <- loadModel("Models/Aston2018Breakthrough_model.cps")
model_Null <- loadModel("Models/Aston2018NullResponse_model.cps")
model_TriP <- loadModel("Models/Aston2018Triphasic_model.cps")

# Make a list of models
models     <- list(model_PVR, model_BT, model_Null, model_TriP)

Define the subtask. Has to be one of “SteadyState”, “TimeSeries”, “ParameterEstimation”, “Optimization”.

subtask         <- "TimeSeries"

Set Sensitivity Method settings.

delta_factor    <- 0.001
delta_minimum   <- 1E-12

Define the effect (can be any of EMPTY_LIST, SINGLE_OBJECT, ALL_VARIABLES, NON_CONST_METAB_CONCENTRATIONS, NON_CONST_METAB_NUMBERS, METAB_CONC_RATES, METAB_PART_RATES, NON_CONST_GLOBAL_PARAMETER_VALUES, REACTION_PART_FLUXES, REDUCED_JACOBIAN_EV_RE, REDUCED_JACOBIAN_EV_IM).

effect          <- "NON_CONST_METAB_CONCENTRATIONS"

Define the cause and (if applicable) secondary cause (can be any of “SINGLE_OBJECT”, “ALL_LOCAL_PARAMETER_VALUES”, “ALL_PARAMETER_VALUES”, “METAB_INITIAL_CONCENTRATIONS”).

cause           <- "ALL_PARAMETER_VALUES"
secondary_cause <- NULL

Do you want to save the result as a RDS object? Also give the file, where you want to save it.

save           <- TRUE
file           <- "docs/Sens_Aston"

Workflow

This should generally not need to be changed, only if the workflow is to be changed more generally.

# Set up output
result <- matrix(nrow = 8, ncol = length(models))

# Run Sensitivities for all models
for (i in 1:length(models)){
  sens_result <- runSensitivities(model           = models[[i]], 
                                  subtask         = subtask, 
                                  delta_factor    = delta_factor,
                                  delta_minimum   = delta_minimum,
                                  effect          = effect,
                                  cause           = cause,
                                  secondary_cause= secondary_cause)
  result[,i] = sens_result$main$annotated_collapsed_result
}

# Reshape data for better visualisation
rownames(result) <- rownames(sens_result$main$annotated_collapsed_result)
colnames(result) <- c("PVR", "Breakthrough", "Nullresponse", "Triphasic")

Sens_result  <- tibble(PVR  = Sens_PVR$main$annotated_collapsed_result,
                       BT   = Sens_BT$main$annotated_collapsed_result,
                       Null = Sens_Null$main$annotated_collapsed_result,
                       TriP = Sens_TriP$main$annotated_collapsed_result)
#> Error in eval_tidy(xs[[j]], mask): Objekt 'Sens_PVR' nicht gefunden


# Save file
if (save){
  saveRDS(Sens_result, 
          file = file)
}

Output

This workflow produces the following output:

result
#>                                       PVR Breakthrough Nullresponse   Triphasic
#> Values[s].InitialValue        0.999652732 1.528531e-07 0.2188977015 0.119805644
#> Values[r_T_Tmax].InitialValue 0.013428398 4.140327e-03 0.6955497119 0.845481027
#> Values[r_T_d].InitialValue    0.171226079 1.718108e+00 0.0585342258 0.194995426
#> Values[R].InitialValue        0.001065302 4.693949e-07 0.1609618741 0.105987060
#> Values[D].InitialValue        0.170799740 1.716128e+00 0.0446922981 0.184704936
#> Values[beta*].InitialValue    0.018219683 1.176302e+00 0.0059774746 0.001554009
#> Values[pstar].InitialValue    1.002044519 1.949354e+00 1.0000571129 1.000021596
#> Values[c].InitialValue        1.007333690 1.489204e+00 0.0001348762 0.503589470