R scripts/codes for in-vivo conc. [Dissolution / BCS / IVIVC]

posted by yjlee168 Homepage – Kaohsiung, Taiwan, 2019-09-10 17:13 (1917 d 10:45 ago) – Posting: # 20576
Views: 8,565

Hi amer,

❝ ... However, i didnt actually mean external validation. What i meant is this: I have constructed IVIVC using in vivo data and dissolution data done at pH 1.2. if i have a new dissolution data (say done at pH 2), how can i predict the in vivo concentrations based on the new dissolution (i.e. does ivivc for R does convulution where the input is the dissolution data and we want to predict the output which is plasma concentration profile?).


I see. But it is still part of model validation. I prepare the codes (R script) mainly pulled from ivivc for R. The following steps are required to run the codes (amer.R).
  1. Run ivivc first and get Levy plots. Take a note about the slope and intercept of Levy plots. You will need that later. This step will also generate PK parameters saved in a file called pk_values.rds in working path. You will need this file too.
  2. prepare your dataset as csv format with 4 columns named as "pH","subj","time","FRD". Then save this dataset file as csv format in R working path (getwd() to know where it is).
  3. copy the the following codes and paste it with plain editor. Now, you can update Slope, Intercept,dose of MR, and your dataset file name (red-inked parts in the codes). Save it in your R working path.
  4. open R console/terminal. type source("amer.R") to run the codes, supposed the codes are saved as amer.R. Go to your R working path to find a file called predicted_in-vivo_dataset.csv. Done.
### amer.R
    Slope<- 0.939     ### from levy plots; change the value if necessary
Intercept<- 10.6      ### from levy plot; change the value if necessary
     Dose<- 200000    ### dose of MR administered; change the value if necessary
                      ### the unit of 'Dose' may need to be converted, depending
                      ### unit of conc. and Vd.
keindex<- readRDS("pk_values.rds")   ### load kel & Vd from previous Wagner-Nelson method
cnames<- c("pH","subj","time","FRD")
InVVTestindex<- load.csv.data("your_dataset.csv",cnames)   ### pls change the file name.
W.data<- data.frame(pH=InVVTestindex$pH,subj=InVVTestindex$subj, time=InVVTestindex$time,FRD=InVVTestindex$FRD)
W.split<- split(W.data,list(W.data$pH,W.data$subj))
pH<- 0  ### not used at all.
PredCp<- NULL
time<- NULL
for (j in 1:length(W.split)){
PFab<- 0
PCp<- 0
for(x in 1: length(unique(keindex$subj))) {
  if (W.split[[j]][["subj"]][1]==keindex$subj[[x]]) {
     ke<- keindex$ke[[x]];Vd<- keindex$Vd[[x]]}}   ### load kel, Vd from previous Wagner-Nelson
  for(i in 2:length(W.split[[j]][["FRD"]])){
      PFab[i]<-(W.split[[j]][["FRD"]][i])*Slope + Intercept}  ### calc predicted Fab
  for(i in 2:length(W.split[[j]][["time"]]))
      PCp[i]<-((PCp[i-1]*(2-((W.split[[j]][["time"]][i]-W.split[[j]][["time"]][i-1])*ke))+(2*(PFab[i]-PFab[i-1])*1/100*Dose/Vd))/(2+(ke*(W.split[[j]][["time"]][i]-W.split[[j]][["time"]][i-1])))) ### PCp[i] = predicted in-vivo conc.
     time[[j]]<- c(W.split[[j]][["time"]])
     PredCp[[j]]<- c(PCp)
}
CC<- reshape2::melt(PredCp)
DD<- reshape2::melt(time)
Predvivo<- data.frame(subj=InVVTestindex$subj,time=DD$value,conc.pred=CC$value)
write.csv(Predvivo,"predicted_in-vivo_dataset.csv",row.names=FALSE)
cat("\nDone.\n\n") ### done.


I don't know if this is what you want. Let me know you still have question about running the codes. I have tested the codes and it works well.

❝ on the side, just wondering if the ivivc package been validated against standard ivivc software (say WinNonlin?)


Not validated with WLN. Should I? :confused: I do not have WLN. If you have WNL, can you help to validate?

All the best,
-- Yung-jin Lee
bear v2.9.2:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here

Complete thread:

UA Flag
Activity
 Admin contact
23,335 posts in 4,901 threads, 1,665 registered users;
32 visitors (0 registered, 32 guests [including 11 identified bots]).
Forum time: 02:59 CET (Europe/Vienna)

Every man is fully satisfied that there is such a thing as truth,
or he would not ask any question.    Charles Sanders Peirce

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5