R/Kpcoeff_PT.R

Defines functions Kpcoeff_PT

Documented in Kpcoeff_PT

#calculate tissue:plasma partition coefficients based on: Poulin and Theil http://jpharmsci.org/article/S0022-3549(16)30889-9/fulltext
#the function returns a list of parameters that can be used directly to update the param() function in mrgsolve

Kpcoeff_PT <- function(logP, pKa, fup, BP=1, type=1){
  
  dat <- dat_PT
  
  dat_all <- dat %>% filter(!tissue %in% c("Plasma","Adipose","RBCs"))
  
  n <- length(dat$tissue)
  Kp_all <- vector(mode = "numeric", length = n)
  
  Vwp <- dat$f_water[dat$tissue == "Plasma"]
  Vnlp <- dat$f_n_l[dat$tissue == "Plasma"]
  Vphp <- dat$f_pl[dat$tissue == "Plasma"]
    dat2 <- dat %>% filter(!tissue %in% c("Plasma","RBCs"))
  
  Vwt <- dat2$f_water[dat2$tissue != "Adipose"]
  Vwad <- dat2$f_water[dat2$tissue == "Adipose"]
  Vnlt <- dat2$f_n_l[dat2$tissue != "Adipose"]
  Vnlad <- dat2$f_n_l[dat2$tissue == "Adipose"]
  Vpht <- dat2$f_pl[dat2$tissue != "Adipose"]
  Vphad <- dat2$f_pl[dat2$tissue == "Adipose"]
  
  fut <- 1/(1+((1-fup)/fup)*0.5)
  
  pH <- dat$pH[dat$tissue == "Adipose"]
  #pH <- 7.4 # Use when comparing to PK-Sim Berez. method Kp predictions 
  logD <- 1.115*logP-1.35 #logD is the olive oil:buffer(water) partition coefficient of nonionized species
  
  logD_star <- switch(type,
                      #1-neutral
                      logD,   
                      #2-monoprotic acid
                      logD-log10(1+10^(pH-pKa)),
                      #3-monoprotic base
                      logD-log10(1+10^(pKa-pH)), 
                      #4-diprotic acid
                      logD-log10(1+10^(2*pH-pKa[1]-pKa[2])),
                      #5-diprotic base
                      logD-log10(1+10^(pKa[1]+pKa[2]-2*pH)), 
                      #6-zwitterion
                      logD-log10(1+10^(pKa[2]-pKa[1]))
  )      
  
  D_star <- 10^logD_star   
  Kpad <- ((D_star*(Vnlad+0.3*Vphad)+((Vwad/fut)+0.7*Vphad))/(D_star*(Vnlp+0.3*Vphp)+((Vwp/fup)+0.7*Vphp)))

  
  P <- 10^logP
  fut <- 1/(1+((1-fup)/fup)*0.5)
  Kpt <- ((P*(Vnlt+0.3*Vpht)+(1*(Vwt+0.7*Vpht)))/(P*(Vnlp+0.3*Vphp)+(1*(Vwp+0.7*Vphp)))) * (fup/fut)
  
  # Kp <- c(Kpad, Kpt)
  # name <- dat2$tissue %>% substr(1,2) %>% tolower()
  # name <- paste("Kp", name, sep="")
  # uParam <- split(Kp, name)
  
  nms_all <- dat_all$tissue %>% substr(1,2) %>% tolower()
  nms_all <- paste("Kp", nms_all, sep="")
  nms <- c("Kpad",nms_all)
  Kp <- as.list(c(Kpad,Kpt))
  names(Kp) <- nms
  
  return(Kp)
  
  
}


    
    
sueinchoi/KpCoeff documentation built on Dec. 5, 2023, 5:29 a.m.