shinyUI(fluidPage(
tabsetPanel(
tabPanel("Plot",
fluidRow(
column(4,
tabsetPanel(
tabPanel("Treatment",
fluidRow(
column(6,
br(),
h5("type = 1"),
sliderInput("tfd1", "time of first dose:", value=8, min=0, max = 40, step=4),
sliderInput("nd1", "number of doses:", value=4, min=0, max = 20, step=1),
sliderInput("ii1", "interdose interval:", value = 4, min = 1, max = 10, step=1),
sliderInput("amt1", "amount:", value = 0.2, min = 0, max = 0.5, step=0.05),
br()
),
column(6,
br(),
h5("type = 2"),
sliderInput("tfd2", "time of first dose:", value=9, min=0, max = 40, step=3),
sliderInput("nd2", "number of doses:", value=10, min=0, max = 20, step=1),
sliderInput("ii2", "interdose interval:", value = 1, min = 0.5, max = 5, step=0.5),
sliderInput("amt2", "amount:", value = 80, min = 0, max = 200, step=20),
br()
))),
tabPanel("Parameters",
fluidRow(
column(6,
sliderInput('Emax', label='Emax', min=0.5, max=2, value=1, step=0.15),
sliderInput('FV1A', label='FV1A', min=4, max=20, value=8, step=1.6),
sliderInput('FV1B', label='FV1B', min=0.2, max=0.9, value=0.5, step=0.07),
sliderInput('IC50', label='IC50', min=2, max=7, value=4, step=0.5),
sliderInput('IC50c', label='IC50c', min=1, max=4, value=2, step=0.3),
sliderInput('k1', label='k1', min=2, max=7, value=4, step=0.5),
sliderInput('k12', label='k12', min=70, max=300, value=100, step=23),
sliderInput('k2', label='k2', min=0.1, max=0.4, value=0.2, step=0.03),
sliderInput('k21', label='k21', min=5, max=20, value=10, step=1.5),
br()
),
column(6,
sliderInput('kaA', label='kaA', min=1, max=5, value=3, step=0.4),
sliderInput('kaB', label='kaB', min=9, max=40, value=20, step=3.1),
sliderInput('keA', label='keA', min=0.06, max=0.2, value=0.1, step=0.014),
sliderInput('keB', label='keB', min=20, max=100, value=50, step=8),
sliderInput('lambda0', label='lambda0', min=0.07, max=0.3, value=0.1, step=0.023),
sliderInput('lambda1', label='lambda1', min=0.06, max=0.3, value=0.1, step=0.024),
sliderInput('psi', label='psi', min=1, max=20, value=5, step=1),
sliderInput('w0', label='w0', min=0.03, max=0.1, value=0.06, step=0.007),
br()
)))
)),
column(8,
plotOutput("plot", height="500px"))
)),
tabPanel("Mlxtran", pre(includeText("rocchetti.txt"))),
tabPanel("ui.R", pre(includeText("ui.R"))),
tabPanel("server.R", pre(includeText("server.R")))
)
))
source("../../initMlxR.R")
shinyServer(function(input, output) {
r <- reactive({
param.value <-c(input$Emax,input$FV1A,input$FV1B,input$IC50,input$IC50c,
input$k1,input$k12,input$k2,input$k21,input$kaA,input$kaB,
input$keA,input$keB,input$lambda0,input$lambda1,input$psi,input$w0)
f <- list(name='W',time=seq(0,50,by=0.2))
p <- list(name=c('Emax', 'FV1A', 'FV1B', 'IC50', 'IC50c', 'k1', 'k12', 'k2', 'k21',
'kaA', 'kaB', 'keA', 'keB', 'lambda0', 'lambda1', 'psi', 'w0'),
value=param.value)
t11=input$tfd1
t12=input$ii1*(input$nd1-1)+t11
if (t12>=t11){
t1.dose=seq(t11,t12,by=input$ii1)
adm1 <- list(time=t1.dose, amount=input$amt1, type=1)
}else{
adm1 <- list(time=t11, amount=0, type=1)
}
t21=input$tfd2
t22=input$ii2*(input$nd2-1)+t21
if (t22>=t21){
t2.dose=seq(t21,t22,by=input$ii2)
adm2 <- list(time=t2.dose, amount=input$amt2, type=2)
}else{
adm2 <- list(time=t21, amount=0, type=2)
}
res <- simulx( model = 'rocchetti.txt',
parameter = p,
treatment = list(adm1,adm2),
output = f)
return(res)
})
output$plot <- renderPlot({
r=r()
pl=ggplotmlx(data=r$W, aes(x=time, y=W)) + geom_line(size=0.75)
print(pl)
})
})