[LONGITUDINAL] input = {l0,l1,w0,kpot,tau} PK: compartment(amount=Ac) oral(ka=20) EQUATION: V = 2.8 ke = 2.4 t0 = 0 Ac_0 = 0 p_0 = w0 d_0 = 0 Cc = Ac/V ddt_Ac = -ke*Ac ddt_p = (2*l0*l1*p^2)/((l1+2*l0*p)*(p+d)) - kpot*Cc*p ddt_d = kpot*Cc*p - kpot*delay(Ac,tau)/V*delay(p,tau) w = p+d
shinyUI(fluidPage( tabsetPanel( tabPanel("Plot", fluidRow( column(4, tabsetPanel( tabPanel("Treatment", br(), sliderInput("tfd", "time of first dose:", value=12, min=0, max = 24, step=2), sliderInput("nd", "number of doses:", value=4, min=0, max = 20, step=1), sliderInput("ii", "interdose interval:", value = 1, min = 0.25, max = 5, step=0.25), sliderInput("amt", "amount:", value = 100, min = 20, max = 300, step=20), br() ), tabPanel("Parameters", sliderInput("l0", "l0:", value=0.3, min=0.05, max=0.5, step=0.05), sliderInput("l1", "l1:", value=0.3, min=0.05, max=0.5, step=0.05), sliderInput("w0", "w0:", value=0.02, min=0.002, max=0.04, step=0.002), sliderInput("kpot", "kpot:", value=0.01, min=0.001, max=0.02, step=0.001), sliderInput("tau", "tau:", value=1, min=0.5, max=10, step=0.5), br() ) )), column(8, plotOutput("plot", height="450px")) )), tabPanel("Mlxtran", pre(includeText("simeoni_dde.txt"))), tabPanel("ui.R", pre(includeText("ui.R"))), tabPanel("server.R", pre(includeText("server.R"))) ) ))
#source("../../initMlxR.R") library(mlxR) shinyServer(function(input, output) { r <- reactive({ t.value=seq(0,25,by=0.25) t1=input$tfd t2=input$ii*(input$nd-1)+t1 if (t2>=t1){ t.dose=seq(t1,t2,by=input$ii) adm <- list(time=t.dose, amount=input$amt) }else{ adm <- list(time=t1, amount=0) } f <- list(name=c('w'),time=t.value) param.value <- c(input$l0,input$l1,input$w0,input$kpot,input$tau) p <- list(name=c('l0','l1','w0','kpot','tau'), value=param.value) res <- simulx( model = 'simeoni_dde.txt', treatment = adm, parameter = p, output = f) return(res) }) output$plot <- renderPlot({ withProgress(message = 'Creating plot', detail='Wait...', value = 0.1, expr={ r=r() pl=ggplotmlx(data=r$w, aes(x=time, y=w)) + geom_line(size=0.75) print(pl) }) }) })