Skip to main content
Skip table of contents

Execute a Virtual Bioequivalence Run

This RMarkdown file executes an existing Virtual Bioequivalence Run. The script utilizes the gastroPlusAPI package to communicate with the GastroPlus X 10.2 service.

To customize your study with this script for a different simulation / project / variables, please make changes to the “Set Input Information” section.

Configure required packages

  1. Load other necessary packages required to execute the script

  2. Load gastroPlusAPI package

R
library(tidyverse)
library(gastroPlusAPI)

Set working directory

Set working directory as the current source editor context

R
if (rstudioapi::isAvailable()){
  current_working_directory <- dirname(rstudioapi::getSourceEditorContext()$path)
  setwd(current_working_directory)
}

Start GPX Service

R
gpx_service <- start_service(verbose=FALSE)
CODE
✔ Configured the GastroPlus Service
R
gpx_service$is_alive()
CODE
[1] TRUE

Set Input Information

Make modification to the variables in this chunk to customize your analysis.

project_path = Location of the project with the Population Simulation run popsim_run_name = Name of the Virtual Bioequivalence run to be executed compound_name = Name of the compound in the simulations selected for the Virtual Bioequivalence Run reference_simulation_name = Name of the Reference Simulation in the VBE run test_simulation_name = Name of the Test Simulation in the VBE run

R
project_path = "../../ProjectFiles/Valproate-VBE.gpproject"
vbe_run_name = "vbe_slow_vs_slightly_slow"
compound_name = "Valproate"
reference_simulation_name = "500mg-ER Slow"
test_simulation_name = "500mg-ER Slightly Slow"

Execute the run

Checks if the specified run exists in the project and executes it

R
open_project(project_path)

#available runs
get_runs()
CODE
# A tibble: 4 × 1
  run_name                           
  <chr>                              
1 Exploratory Simulation             
2 popsim_2_trial_100_pop             
3 vbe_slow_vs_slightly_slow          
4 vbe_replicate_slow_vs_slightly_slow
R
#execute the run
execute_run(vbe_run_name)

Process Run Output

Get summary output and Systemic Circulation Plasma Concentration for all iterations in the run for reference and test simulations selected for the VBE

R
#Get available simulation iteration keys in the run
simulation_iteration_keys <- get_simulation_keys(vbe_run_name)

#Get summary output table for all simulations in the run
summary_output <- get_summary_output(vbe_run_name, simulation_iteration_keys$simulation_iteration_key_name)

#Get Simulation Name
simulations_in_run <- get_simulations_in_run(vbe_run_name)

#Get concentration plasma for all the iterations in the run
concentration_plasma_series_list <- list()
plasma_concentration_series_descriptor <- paste(compound_name, CompartmentType$SystemicCirculation, StateType$ConcentrationPlasma, sep=  " - ")

#Get concentration plasma data for all the iterations within the popsim run
reference_simulation_iteration_keys <- simulation_iteration_keys %>% filter(simulation_name == reference_simulation_name)
test_simulation_iteration_keys <- simulation_iteration_keys %>% filter(simulation_name == test_simulation_name)

reference_series_data <- get_series_data(vbe_run_name, reference_simulation_name, plasma_concentration_series_descriptor, reference_simulation_iteration_keys$simulation_iteration_key_name)

test_series_data <- get_series_data(vbe_run_name, test_simulation_name, plasma_concentration_series_descriptor, test_simulation_iteration_keys$simulation_iteration_key_name)

glimpse(reference_series_data)
CODE
Rows: 27,879
Columns: 8
$ dependent_unit                  <chr> "ng/mL", "ng/mL", "ng/mL", "ng/mL", "n…
$ independent_unit                <chr> "h", "h", "h", "h", "h", "h", "h", "h"…
$ iteration                       <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
$ dependent                       <dbl> 0.000000e+00, 4.923835e-16, 3.825921e-…
$ independent                     <dbl> 0.000000e+00, 1.169526e-05, 4.366056e-…
$ simulation_iteration_key_name   <chr> "500mg-ER Slow \a1 \a1", "500mg-ER Slo…
$ simulation_iteration_key_name_2 <chr> "500mg-ER Slow | Trial 1", "500mg-ER S…
$ trial                           <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
R
glimpse(test_series_data)
CODE
Rows: 29,118
Columns: 8
$ dependent_unit                  <chr> "ng/mL", "ng/mL", "ng/mL", "ng/mL", "n…
$ independent_unit                <chr> "h", "h", "h", "h", "h", "h", "h", "h"…
$ iteration                       <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
$ dependent                       <dbl> 0.000000e+00, 4.807496e-18, 6.709051e-…
$ independent                     <dbl> 0.000000e+00, 1.728865e-06, 2.359576e-…
$ simulation_iteration_key_name   <chr> "500mg-ER Slightly Slow \a1 \a1", "500…
$ simulation_iteration_key_name_2 <chr> "500mg-ER Slightly Slow | Trial 1", "5…
$ trial                           <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…

Kill GPX Service

R
gpx_service$kill()
CODE
[1] TRUE
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.