Commit d216d802 authored by dmattek's avatar dmattek

Changed checks for NULL data to validate-need syntax.

parent 653dfeba
...@@ -168,12 +168,6 @@ modDistPlot = function(input, output, session, ...@@ -168,12 +168,6 @@ modDistPlot = function(input, output, session,
# Boxplot - display # Boxplot - display
output$outPlotBox = renderPlot({ output$outPlotBox = renderPlot({
locBut = input$butPlot
if (locBut == 0) {
cat(file = stderr(), 'boxPlot:Go button not pressed\n')
return(NULL)
}
plotBox() plotBox()
...@@ -181,12 +175,6 @@ modDistPlot = function(input, output, session, ...@@ -181,12 +175,6 @@ modDistPlot = function(input, output, session,
output$outPlotBoxInt = renderPlotly({ output$outPlotBoxInt = renderPlotly({
locBut = input$butPlot
if (locBut == 0) {
cat(file = stderr(), 'boxPlot:Go button not pressed\n')
return(NULL)
}
# This is required to avoid # This is required to avoid
# "Warning: Error in <Anonymous>: cannot open file 'Rplots.pdf'" # "Warning: Error in <Anonymous>: cannot open file 'Rplots.pdf'"
...@@ -222,14 +210,15 @@ modDistPlot = function(input, output, session, ...@@ -222,14 +210,15 @@ modDistPlot = function(input, output, session,
plotBox <- function() { plotBox <- function() {
cat(file = stderr(), 'plotBox\n') cat(file = stderr(), 'plotBox\n')
locBut = input$butPlot
loc.dt = in.data() # Check if main data exists
# Thanks to solate all mods in the left panel are delayed
cat(file = stderr(), "plotBox: on to plot\n\n") # until clicking the Plot button
if (is.null(loc.dt)) { loc.dt = isolate(in.data())
cat(file = stderr(), 'plotBox: dt is NULL\n') validate(
return(NULL) need(!is.null(loc.dt), "Nothing to plot. Load data first!")
} )
cat(file = stderr(), 'plotBox:dt not NULL\n') cat(file = stderr(), 'plotBox:dt not NULL\n')
......
...@@ -130,7 +130,7 @@ tabScatterPlotUI <- ...@@ -130,7 +130,7 @@ tabScatterPlotUI <-
checkboxInput(ns('plotInt'), checkboxInput(ns('plotInt'),
'Interactive Plot', 'Interactive Plot',
value = FALSE), value = FALSE),
actionButton(ns('butGoScatter'), 'Plot!'), actionButton(ns('butPlot'), 'Plot!'),
uiOutput(ns("plotInt_ui")), uiOutput(ns("plotInt_ui")),
downPlotUI(ns('downPlotScatter'), "Download Plot") downPlotUI(ns('downPlotScatter'), "Download Plot")
) )
...@@ -286,20 +286,18 @@ tabScatterPlot <- ...@@ -286,20 +286,18 @@ tabScatterPlot <-
plotScatter <- function() { plotScatter <- function() {
cat(file = stderr(), "plotScatter\n") cat(file = stderr(), "plotScatter\n")
locBut = input$butPlot
# isolate because calculations & plotting take a while # Check if main data exists
# re-plotting done upon button press # Thanks to solate all mods in the left panel are delayed
loc.dt = isolate(data4scatterPlot()) # until clicking the Plot button
loc.dt = isolate(in.data())
cat("plotScatter on to plot\n\n") validate(
if (is.null(loc.dt)) { need(!is.null(loc.dt), "Nothing to plot. Load data first!")
cat(file = stderr(), 'plotScatter: dt is NULL\n') )
return(NULL)
}
cat(file = stderr(), 'plotScatter:dt not NULL\n') cat(file = stderr(), 'plotScatter:dt not NULL\n')
p.out = LOCggplotScat( p.out = LOCggplotScat(
dt.arg = loc.dt, dt.arg = loc.dt,
plotlab.arg = NULL, plotlab.arg = NULL,
...@@ -314,14 +312,6 @@ tabScatterPlot <- ...@@ -314,14 +312,6 @@ tabScatterPlot <-
# Plot rendering ---- # Plot rendering ----
output$outPlotScatter <- renderPlot({ output$outPlotScatter <- renderPlot({
locBut = input$butGoScatter
if (locBut == 0) {
cat(file = stderr(), 'plotScatter: Go button not pressed\n')
return(NULL)
}
plotScatter() plotScatter()
}) })
...@@ -331,12 +321,6 @@ tabScatterPlot <- ...@@ -331,12 +321,6 @@ tabScatterPlot <-
# When running on a server. Based on: # When running on a server. Based on:
# https://github.com/ropensci/plotly/issues/494 # https://github.com/ropensci/plotly/issues/494
locBut = input$butGoScatter
if (locBut == 0) {
cat(file = stderr(), 'plotScatterInt Go button not pressed\n')
return(NULL)
}
if (names(dev.cur()) != "null device") if (names(dev.cur()) != "null device")
dev.off() dev.off()
pdf(NULL) pdf(NULL)
......
...@@ -79,6 +79,7 @@ modTrajPlotUI = function(id, label = "Plot Individual Time Series") { ...@@ -79,6 +79,7 @@ modTrajPlotUI = function(id, label = "Plot Individual Time Series") {
uiOutput(ns('uiPlotTraj')), uiOutput(ns('uiPlotTraj')),
br(), br(),
modTrackStatsUI(ns('dispTrackStats')), modTrackStatsUI(ns('dispTrackStats')),
br(),
downPlotUI(ns('downPlotTraj'), "Download Plot") downPlotUI(ns('downPlotTraj'), "Download Plot")
) )
} }
...@@ -238,26 +239,20 @@ modTrajPlot = function(input, output, session, ...@@ -238,26 +239,20 @@ modTrajPlot = function(input, output, session,
plotTraj <- function() { plotTraj <- function() {
cat(file = stderr(), 'plotTraj: in\n') cat(file = stderr(), 'plotTraj: in\n')
locBut = input$butPlotTraj
if (locBut == 0) { # make the f-n dependent on the button click
cat(file = stderr(), 'plotTraj: Go button not pressed\n') locBut = input$butPlotTraj
return(NULL)
}
# check main data exists # Check if main data exists
# Thanks to solate all mods in the left panel are delayed
# until clicking the Plot button
loc.dt = isolate(in.data()) loc.dt = isolate(in.data())
validate(
cat("plotTraj: on to plot\n\n") need(!is.null(loc.dt), "Nothing to plot. Load data first!")
if (is.null(loc.dt)) { )
cat(file = stderr(), 'plotTraj: dt is NULL\n')
return(NULL)
}
cat(file = stderr(), 'plotTraj: dt not NULL\n') cat(file = stderr(), 'plotTraj: dt not NULL\n')
# check if stim data exists # check if stim data exists
loc.dt.stim = isolate(in.data.stim()) loc.dt.stim = isolate(in.data.stim())
...@@ -267,8 +262,6 @@ modTrajPlot = function(input, output, session, ...@@ -267,8 +262,6 @@ modTrajPlot = function(input, output, session,
cat(file = stderr(), 'plotTraj: dt.stim not NULL\n') cat(file = stderr(), 'plotTraj: dt.stim not NULL\n')
} }
# Future: change such that a column with colouring status is chosen by the user # Future: change such that a column with colouring status is chosen by the user
# colour trajectories, if dataset contains mid.in column # colour trajectories, if dataset contains mid.in column
# with filtering status of trajectory # with filtering status of trajectory
......
...@@ -68,7 +68,7 @@ modTrajRibbonPlotUI = function(id, label = "Plot Individual Time Series") { ...@@ -68,7 +68,7 @@ modTrajRibbonPlotUI = function(id, label = "Plot Individual Time Series") {
uiOutput(ns('uiPlotTraj')), uiOutput(ns('uiPlotTraj')),
br(), br(),
modTrackStatsUI(ns('dispTrackStats')), modTrackStatsUI(ns('dispTrackStats')),
br(),
downPlotUI(ns('downPlotTraj'), "Download Plot") downPlotUI(ns('downPlotTraj'), "Download Plot")
) )
} }
...@@ -232,24 +232,16 @@ modTrajRibbonPlot = function(input, output, session, ...@@ -232,24 +232,16 @@ modTrajRibbonPlot = function(input, output, session,
cat(file = stderr(), 'plotTrajRibbon: in\n') cat(file = stderr(), 'plotTrajRibbon: in\n')
locBut = input$butPlotTraj locBut = input$butPlotTraj
if (locBut == 0) { # Check if main data exists
cat(file = stderr(), 'plotTrajRibbon: Go button not pressed\n') # Thanks to solate all mods in the left panel are delayed
# until clicking the Plot button
return(NULL)
}
# check if main data exists
loc.dt = isolate(in.data()) loc.dt = isolate(in.data())
validate(
cat("plotTrajRibbon: on to plot\n\n") need(!is.null(loc.dt), "Nothing to plot. Load data first!")
if (is.null(loc.dt)) { )
cat(file = stderr(), 'plotTrajRibbon: dt is NULL\n')
return(NULL)
}
cat(file = stderr(), 'plotTrajRibbon: dt not NULL\n') cat(file = stderr(), 'plotTrajRibbon: dt not NULL\n')
# check if stim data exists # check if stim data exists
loc.dt.stim = isolate(in.data.stim()) loc.dt.stim = isolate(in.data.stim())
......
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