Commit d8801a30 authored by IZARD Lloyd's avatar IZARD Lloyd
Browse files

Nouvelle version :

- ajout d'un fichier 'demo' a télécharger
- ajout de la possibilité de changer les axes x et y
- ajout de la possibilité de télécharger les données estimées
- modification de la page 'Citation'
parent 143c36e6
......@@ -65,6 +65,32 @@ shinyServer(
return(params)
})
output$interaction_slider_x <- renderUI({
df <- getData()
req(df)
sliderInput(
"slider_x",
"Select Range for x:",
min = 0,
max = round(max(df[,1], na.rm = T), 0) + 3,
value = c(min, max)
)
})
output$interaction_slider_y <- renderUI({
df <- getData()
req(df)
sliderInput(
"slider_y",
"Select Range for y:",
min = 0,
max = round(max(df[,2], na.rm = T), 0) + 3,
value = c(min, max)
)
})
####### Raw_plot #######
output$raw_plot <- renderPlot({
......@@ -84,8 +110,8 @@ shinyServer(
mu <- 1 / coef[3]
# output plot
plot(x, y, xlab = input$xlabel, ylab = input$ylabel, xlim = c (0, maxx),
ylim = c(0, maxy), las = 1, pch = 22, bg = 1)
plot(x, y, xlab = input$xlabel, ylab = input$ylabel, xlim = input$slider_x,
ylim = input$slider_y, las = 1, pch = 22, bg = 1)
lines(w0, SSlogis(w0, coef[1], coef[2], coef[3]), lwd = 1.5)
grid()
......@@ -111,6 +137,22 @@ shinyServer(
#
})
####### Telecharger le fichier de demo
output$downloadDataDemo <- downloadHandler(
filename <- function() {
paste("demo_data", "txt", sep=".")
},
content <- function(file) {
time <- seq(from = 1, to = 10, by = 1)
biomass <- c(1.342986198, 2.746422764, 3.48279074, 4.934273137,
5.54237533, 5.433656298, 6.119407822, 6.208366414,
6.212723807, 5.801694724)
df <- data.frame(time, biomass)
write.table(df, file, row.names = F, col.names = T, sep = '\t')
}
)
####### Affichage du tableau initial #######
output$raw_data <- DT::renderDataTable({
df <- getData()
......@@ -120,8 +162,8 @@ shinyServer(
####### Affichage de la citation #######
output$citation <- renderText({
paste("Martini, S., B. Al Ali, M. Garel, and others. 2013. Effects of Hydrostatic Pressure on Growth and Luminescence of a Moderately-Piezophilic Luminous Bacteria\nPhotobacterium phosphoreum ANT-2200 A. Driks [ed.]. PLoS One 8: e66580. doi:10.1371/journal.pone.0066580")
#
paste("Martini, S., B. Al Ali, M. Garel, and others. 2013. Effects of Hydrostatic Pressure on Growth and Luminescence of a Moderately-Piezophilic Luminous Bacteria Photobacterium phosphoreum ANT-2200 A. Driks [ed.]. PLoS One 8: e66580. doi:10.1371/journal.pone.0066580
Garel, M., Izard, L., Vienne, M., Nerini, D., Tamburini, C., & Martini, S. (2020, October 26). A ready-to-use logistic regression implemented in R shiny to estimate growth parameters of microorganisms (Version 1). Zenodo. http://doi.org/10.5281/zenodo.4136476")
})
####### Fonction de cout #######
......@@ -250,9 +292,9 @@ shinyServer(
rglwidget()
})
output$downloadData <- downloadHandler(
output$downloadDataParameters <- downloadHandler(
filename = function() {
paste('data-', Sys.Date(), '.txt', sep='')
paste('parameters-', Sys.Date(), '.txt', sep='')
},
content = function(con) {
param <- calculate()
......@@ -260,4 +302,44 @@ shinyServer(
}
)
####### Calcul des estimateurs #######
calculated_data <- reactive({
df <- getData()
req(df)
x <- rep(df[, 1], ncol(df) - 1)
y <- unlist(df[, 2:ncol(df)])
crssce <- data.frame(y, x)
w0 <- seq(0, max(x), 1)
coef <- getInitial(y ~ SSlogis(x, asym, xmid, scal), data = cbind.data.frame(x, y))
mu <- 1 / coef[3]
q1b <- nlrq(y ~ SSlogis(x, K, xmid, r), tau = 0.25, data = crssce)
q3b <- nlrq(y ~ SSlogis(x, K, xmid, r), tau = 0.75, data = crssce)
q05b <- nlrq(y ~ SSlogis(x, K, xmid, r), tau = 0.025, data = crssce)
q95b <- nlrq(y ~ SSlogis(x, K, xmid, r), tau = 0.975, data = crssce)
result = data.frame(w0, c(0, y),
SSlogis(w0, coef[1], coef[2], coef[3]),
predict(q1b, newdata = list(x = w0)),
predict(q3b, newdata = list(x = w0)),
predict(q05b, newdata = list(x = w0)),
predict(q95b, newdata = list(x = w0)))
return(result)
})
output$downloadDataCalculated <- downloadHandler(
filename = function() {
paste('data-', Sys.Date(), '.txt', sep='')
},
content = function(file) {
write.table(calculated_data(), file, row.names = F, col.names = T, sep = '\t')
}
)
})
\ No newline at end of file
......@@ -26,6 +26,10 @@ shinyUI(
sidebarPanel("",
fileInput('file1', 'Upload your dataset (.csv or .txt)',
accept=c('text/csv', 'text/comma-separated-values,text/plain', '.csv', '.txt')),
# download demo file
downloadButton("downloadDataDemo", label = "Download a demo dataset"),
# header or not header
checkboxInput('header', 'Header', TRUE),
......@@ -54,14 +58,26 @@ shinyUI(
)
),
tabPanel("Uploaded data", DT::dataTableOutput("raw_data")),
tabPanel("Plot", plotOutput("raw_plot"), DT::dataTableOutput("parameters"),
downloadButton("downloadData", "Download")),
tabPanel("Uploaded data",
DT::dataTableOutput("raw_data")),
tabPanel("Plot",
uiOutput("interaction_slider_x"),
uiOutput("interaction_slider_y"),
plotOutput("raw_plot"),
DT::dataTableOutput("parameters"),
downloadButton("downloadDataParameters", "Download parameters"),
DT::dataTableOutput("data"),
downloadButton("downloadDataCalculated", "Download plot data")
),
navbarMenu("Verify parameters estimation",
tabPanel("2D", plotOutput("verify_plot_2D")),
tabPanel("3D", rglwidgetOutput("verify_plot_3D", width = 800, height = 800))),
tabPanel("Citation", verbatimTextOutput("citation")),
tabPanel("About", helpText('This App is teamwork between resarchers and students.
tabPanel("2D",
plotOutput("verify_plot_2D")),
tabPanel("3D",
rglwidgetOutput("verify_plot_3D", width = 800, height = 800))),
tabPanel("Citation",
verbatimTextOutput("citation")),
tabPanel("About",
helpText('This App is teamwork between resarchers and students.
The PIs are Marc Garel (MIO-CNRS) and Severine Martini (LOV-CNRS), Marthe Vienne (BSc student) improved the app with statiscal tools and Lloyd Izard (MSc Student) has participated in the developpement of the app.'))
)
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment