Skip to content

Commit 58ceecb

Browse files
undid previous change
1 parent 65a54bb commit 58ceecb

4 files changed

Lines changed: 46 additions & 45 deletions

File tree

.RData

551 KB
Binary file not shown.
Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Simcyp R package - forest plot example
22

3-
# This script will show you:
3+
# This script will show you:
44
# 1. How to run the Simcyp Simulator from R
55
# 2. How to extract the necessary data for forest plots
66
# 3. How to use those data to make a forest plot
@@ -28,8 +28,8 @@ setwd(path_user)
2828
# this to use the Simcyp package. We're based in the UK, so, USA folks, please
2929
# note the spelling here! :)
3030
Simcyp::Initialise(filePath = "C:/Program Files/Simcyp Simulator V24/Screens/SystemFiles",
31-
requestedVersion = 24,
32-
species = SpeciesID$Human)
31+
requestedVersion = 24,
32+
species = SpeciesID$Human)
3333

3434
# If you've already run this script in the past -- maybe you're only interested
3535
# in tweaking the appearance of your forest plot, for example -- then you don't
@@ -39,58 +39,58 @@ Simcyp::Initialise(filePath = "C:/Program Files/Simcyp Simulator V24/Screens/Sys
3939
if(file.exists("SV-Atazanavir Forest Data.RData")){
4040
load("SV-Atazanavir Forest Data.RData")
4141
} else {
42-
42+
4343
# We will run 5 DDI simulations and store their results; specifically, we
4444
# need the AUC and Cmax ratios for the forest plot.
45-
45+
4646
# Get workspace names
4747
SimcypWksz <- list.files(pattern = "wksz")
48-
48+
4949
# Creating lists to store data
5050
ForestData <- list()
5151
SimTime <- list() # This is optional; it just tracks how long each iteration takes.
52-
53-
for (Wks in SimcypWksz){
54-
52+
53+
for (Wks in SimcypWksz){
54+
5555
tic(msg = paste("Simulation", Wks))
56-
56+
5757
# Setting what workspace to simulate
5858
SetWorkspace(Wks)
5959
# This will give you useful summary information on your simulation. Check
6060
# that you're simulating what you think you're simulating! :)
61-
61+
6262
# Run the simulation and save to database. For saving our database files,
6363
# we'll use the same file name as the workspace but with the ".db" extension.
6464
DBfilename <- sub("wksz", "db", Wks)
6565
Simulate(database = DBfilename)
66-
66+
6767
# Make a connection with the database file using RSQLite
6868
conn <- RSQLite::dbConnect(SQLite(), DBfilename)
69-
70-
# Extract the population statistics of the predicted AUC and Cmax ratios
69+
70+
# Extract the population statistics of the predicted AUC and Cmax ratios
7171
ForestData[[Wks]] <- GetForestData_DB(Alpha = 0.1,
7272
Upper = 95,
73-
Lower = 5,
74-
conn,
75-
Last_Dose = TRUE,
73+
Lower = 5,
74+
conn,
75+
Last_Dose = TRUE,
7676
AUC_Type = "AUCt")
77-
77+
7878
SimTime[[Wks]] <- toc(log = TRUE)
79-
79+
8080
# Disconnect from the database
8181
RSQLite::dbDisconnect(conn)
82-
82+
8383
}
84-
84+
8585
# Putting all the forest data into a single data.frame
8686
ForestData <- bind_rows(ForestData)
87-
87+
8888
# Check the times for each iteration
8989
map(SimTime, "toc")
90-
91-
save(ForestData, SimTime, SimcypWksz,
90+
91+
save(ForestData, SimTime, SimcypWksz,
9292
file = "SV-Atazanavir Forest Data.RData")
93-
93+
9494
}
9595

9696
# Setting up observed data ---------------------------------------------------
@@ -101,7 +101,7 @@ if(file.exists("SV-Atazanavir Forest Data.RData")){
101101
# those data are set up because we'll set up the observed data in the same way:
102102
glimpse(ForestData)
103103

104-
# Columns we'll need to match in the observed data:
104+
# Columns we'll need to match in the observed data:
105105

106106
# File
107107
# We'll need to specify which simulation file should be matched to the observed
@@ -112,25 +112,25 @@ glimpse(ForestData)
112112
# In the forest data we extracted from those simulations, you'll see that we
113113
# have named the PK parameters either "AUCt_ratio" or "Cmax_ratio". We'll use
114114
# those exact same names for the PK parameters in the observed data so that the
115-
# forest_plot function knows which parameters match.
115+
# forest_plot function knows which parameters match.
116116

117117
# GeoMean
118118
# What we plan to graph are the geometric means and geometric confidence
119119
# intervals (this is the most typical set of statistics for forest plots), so
120120
# we'll need the matching data in the observed data.frame. We don't have
121121
# observed confidence interval data, though, so we'll skip those. If we had
122-
# them, they would be shown as error bars on the plot.
122+
# them, they would be shown as error bars on the plot.
123123

124124
# What if you don't have all the observed data? That's fine. Skip whatever you
125-
# don't have and that simulation just won't have any observed data points.
125+
# don't have and that simulation just won't have any observed data points.
126126

127127
ObsRatios <- data.frame(File = c("Neely_raltegravirDDI",
128128
"Zhu_2010_raltegravirDDI",
129129
"Krishna_raltegravirDDI",
130130
"Iwamoto_2008_raltegravirDDI",
131-
"Mummaneni_Clarith_ATZ_DDI"),
132-
PKparameter = c(rep("AUCt_ratio", 5),
133-
rep("Cmax_ratio", 5)),
131+
"Mummaneni_Clarith_ATZ_DDI"),
132+
PKparameter = c(rep("AUCt_ratio", 5),
133+
rep("Cmax_ratio", 5)),
134134
GeoMean = c(1.72, 1.54, 1.67, 1.72, 1.94, # AUC ratios
135135
1.37, 1.39, 1.16, 1.53, 1.50)) # Cmax ratios
136136

@@ -141,7 +141,7 @@ ObsRatios <- data.frame(File = c("Neely_raltegravirDDI",
141141
?PlotForestDDI
142142

143143
# Let's make draft forest plot with mostly default parameters.
144-
PlotForestDDI(SimForestData = ForestData,
144+
PlotForestDDI(SimForestData = ForestData,
145145
ObsForestData = ObsRatios)
146146

147147
# As you can see, the y axis is labeled according to the simulation, which does
@@ -157,47 +157,47 @@ YAxisLabels<- c("Neely_raltegravirDDI" = "Raltegravir\nNeely et al. (2010)",
157157
"Mummaneni_Clarith_ATZ_DDI" = "Clarithromycin\nMummaneni et al. (2002)")
158158

159159
# And the revised forest plot with the nicer labels:
160-
PlotForestDDI(SimForestData = ForestData,
160+
PlotForestDDI(SimForestData = ForestData,
161161
ObsForestData = ObsRatios,
162162
y_axis_column = YAxisLabels)
163163

164164
# There are a number of ways that you can customize your forest plot, and we
165165
# hope you'll play around with the function a bit with assistance from the help
166166
# file. Here are a few more options for an example.
167167

168-
PlotForestDDI(SimForestData = ForestData,
168+
PlotForestDDI(SimForestData = ForestData,
169169
ObsForestData = ObsRatios,
170-
y_axis_column = YAxisLabels,
170+
y_axis_column = YAxisLabels,
171171
Mean_type = "Geometric",
172172
Variability_type = "CI",
173-
173+
174174
# You can change the set of colors to one of the sets already
175175
# included (see the help file) or specify your own colors. We'll
176176
# use one of the built-in sets.
177177
color_set = "yellow to red",
178-
178+
179179
# By default, the PlotForestDDI function orders the simulations
180180
# from strongest inhibition at the top to strongest induction at
181181
# the bottom, but you can specify that you want the order to be as
182-
# it is in the source data.frame instead.
183-
y_order = "as is",
184-
182+
# it is in the source data.frame instead.
183+
y_order = "as is",
184+
185185
x_axis_title = "Geometric Mean Ratio (90% CI)",
186186
x_axis_limits = c(1, 2),
187187
graph_title = "Predicted Geometric Mean AUC and Cmax Ratios for DDI studies",
188188
graph_title_size = 14 ,
189-
legend_position = "right",
190-
189+
legend_position = "right",
190+
191191
# We recommend playing around with the output graph dimensions to
192192
# make sure things are clear and not smooshed together.
193-
fig_height = 7,
193+
fig_height = 7,
194194
fig_width = 8,
195195
save_graph = "Forest plot SV-Atazanavir.png")
196196

197197

198198
# Finishing up -----------------------------------------------------------------
199199

200-
Uninitialise() # Uninitialise the Simcyp engine
200+
Uninitialise() # Uninitialise the Simcyp engine
201201

202202

203203

Simcyp-R-Scripts.Rproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Version: 1.0
2+
ProjectId: b023b08c-22e4-4945-8319-3bcf5c190afb
23

34
RestoreWorkspace: Default
45
SaveWorkspace: Default

human/DefaultLocation.Rd

105 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)