knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE, 
                      dpi = 600)

Induction models available -- CHANGE THE TEXT BELOW AS NEEDED

Note: Some of these models will give you Ind~max~ and some will give you E~max~, so pay careful attention to which parameter each model fits. The Simcyp Simulator uses Ind~max~ as input. For converting between the two: $Ind_{max} = E_{max} + 1$ and IndC~50~ is the same thing as EC~50~.

Four induction models (Equations 1, 2, 3, and 4) were fit to the in vitro induction data.

Equation 1. E~max~ model

$$ \text{fold induction} = 1 + \frac{E_{max} \times I}{EC_{50} + I} $$

where I is the concentration of the inducer, E~max~ is the maximum change in fold induction, and EC~50~ is the concentration of the inducer that elicits half the maximum fold-change in induction.

Equation 2. E~max~ slope model

$$ \text{fold induction} = 1 + E_{max} \times \frac{I^\gamma}{EC_{50}^\gamma + I^\gamma} $$

where I is the concentration of the inducer, E~max~ is the maximum change in fold induction, EC~50~ is the concentration of the inducer that elicits half the maximum fold-change in induction, and γ is the Hill equation coefficient describing the slope.

Equation 3. Slope model

$$ \text{fold induction} = 1 + I \times n $$

where I is the concentration of the inducer and n is the slope.

Equation 4. Sigmoidal three-parameter model

$$ \text{fold induction} = \frac{Ind_{max}}{1 + e^{ \frac{IndC_{50}-I}{\gamma}}} $$

where I is the concentration of the inducer, Ind~max~ is the maximum fold induction, IndC~50~ is the concentration of the inducer that elicits half the maximum fold induction, and γ is the Hill equation coefficient describing the slope.

model_label <- switch(model, 
                      "EmaxSlope" = "E~max~ slope model", 
                      "Slope" = "slope model", 
                      "Sig3Param" = "sigmoidal three-parameter model", 
                      "Emax" = "E~max~ model", 
                      "all" = "E~max~, E~max~ slope, sigmoidal three-parameter, and slope models")

Figure XXX. r ifelse(model == "all", "Fits", "Fit") of the r model_label tor ifelse(is.na(enzyme), "", paste0(" ", enzyme)) r measurement fold-change data after incubations of human hepatocytesr ifelse(complete.cases(drug), paste0(" with ", drug, "."), ".")

Out$Graph

if(model == "all"){
   FitsThatWorked <- unique(Out$Fit$Model)    
} else {
   FitsThatWorked <- model
}

GoodMod <-  c("EmaxSlope" = "E~max~ slope", 
              "Slope" = "slope", 
              "Sig3Param" = "sigmoidal three-parameter", 
              "Emax" = "E~max~")
FitsThatWorked <- GoodMod[FitsThatWorked]
FitsThatWorked <- paste(str_comma(FitsThatWorked), 
                        ifelse(length(FitsThatWorked) == 1, "model", "models"))



VertLineText <- ifelse(complete.cases(vert_line), 
                       "The red dotted vertical line indicates XXX REPLACE THIS WITH WHAT IT INDICATES XXX.", "")
ImaxuText <- ifelse(complete.cases(Imaxu_line), 
                    "The upper left quadrant as marked by the red dotted line indicates the region of concern for induction. Points in that quadrant are both above a 2-fold change in induction and also are below the expected Imax,u concentration. Please see p. 5 USFDA Guidance (2020) 'In Vitro Drug Interaction Studies - Cytochrome P450 Enzyme and Transporter Mediated Drug Interactions' for details.", "")

HLineText <- ifelse(hline_foldinduct1, 
                    "The red dotted horizontal line indicates a fold-change of 1, i.e., no induction compared to vehicle control.", "")

LineText <- str_trim(paste(VertLineText, ImaxuText, HLineText))

r ifelse(model == "all", "Models were", "The model was") fit to the r ifelse(fitByDonor, "individual", "mean") data, and lines represent successful fits; where fits failed to converge, no line is shown. r LineText

Table XXX. Fitted parameters for the r FitsThatWorked for r ifelse(is.na(enzyme), "", paste0(" ", enzyme)) r measurement fold-change data after incubations of human hepatocytesr ifelse(complete.cases(drug), paste0(" with ", drug, "."), ".")

if(fitByDonor){

   Fit_ind <- Out$Fit

   suppressWarnings(
      Fit_sum <- Fit_ind %>% group_by(Model) %>% 
         summarize(across(.cols = any_of(c("Emax", "EC50", "Gamma", "slope", 
                                           "Indmax", "IndC50")),
                          .fns = mean, na.rm = T)) %>% 
         mutate(DonorID = "mean")
   )

   AllFits <- bind_rows(Fit_ind, Fit_sum) %>% 
      mutate(DonorID = as.factor(DonorID),
             DonorID = forcats::fct_relevel(DonorID, "mean", after = Inf)) %>% 
      arrange(Model, DonorID)

} else {
   AllFits <- Out$Fit
}

# Making "model" look nice for the table
PvalCols <- names(AllFits)[str_detect(names(AllFits), "p value")]
OtherCols <- names(AllFits)[str_detect(names(AllFits), "Emax|EC50|Gamma|slope|IndC50|Indmax|AIC")]
OtherCols <- setdiff(OtherCols, PvalCols)

AllFits <- AllFits %>% 
   mutate(Model = case_when(Model == "Emax" ~ "Emax", 
                            Model == "EmaxSlope" ~ "Emax slope", 
                            Model == "Sig3Param" ~ "sigmoidal 3-parameter", 
                            Model == "Slope" ~ "slope")) %>% 

   # Rounding as requested
   mutate(across(.cols = any_of(OtherCols),
                 .fns = round_opt, 
                 round_fun = rounding, 
                 is_this_for_Word = TRUE, 
                 out_class = "character"), 
          across(.cols = any_of(PvalCols), 
                 .fns = ~ as.character(signif(.x, 1))))

MakeBold <- which(AllFits$DonorID == "mean")
MakeBold <- as.list(MakeBold) %>% map(.f = \(x) c(x, NA))
MakeBold[[length(MakeBold) + 1]] <- c(0, NA)

AllFits <- AllFits %>% 
   formatTable_Simcyp(shading_column = Model, 
                      merge_shaded_cells = TRUE, 
                      bold_cells = MakeBold, 
                      center_1st_column = TRUE) 

# if(fitByDonor){
#    AllFits <- AllFits %>% 
#       flextable::bold(i = which(AllFits$DonorID == "mean"))
# } 
# 
# AllFits %>%
#    flextable::merge_v(j = 1) %>% 
#    flextable::hline_bottom(border = officer::fp_border(width = 0.5))

AllFits

r ifelse(FitsThatWorked == model_label, "", "*Only fits that converged are shown in the table.*")



shirewoman2/Consultancy documentation built on Feb. 18, 2025, 10 p.m.