Skip to content

Commit

Permalink
remove pdf option
Browse files Browse the repository at this point in the history
  • Loading branch information
loye16 committed Sep 5, 2023
1 parent 47de410 commit 9c76bda
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 39 deletions.
6 changes: 1 addition & 5 deletions UIs/ui_plot_single_result.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ plot_decoding <- tabPanel(
"Type of results to plot",
cm_result_type),
withSpinner(plotOutput("plot_cm"),
color = "#79c9da")),
tabPanel("PDF of scripts and results",
uiOutput("single_results_pdf_chosen"),
uiOutput("show_single_result_pdf_path"),
uiOutput("show_single_result_pdf"))
color = "#79c9da"))
)
)
)
52 changes: 19 additions & 33 deletions servers/server_plot_single_result.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
################################################################################

# Create list of valid Rdas from results
observeEvent(rv$working_dir,{
observeEvent(list(rv$working_dir, input$DC_run_script),{
result_folder <- file.path(rv$decoding_result_files_base_dir)
result_list <- list.files(result_folder)
rv$valid_result_list <- c()
Expand Down Expand Up @@ -58,51 +58,37 @@ output$plot_show_chosen_result <- renderText({

# Plot time series using NeuroDecodeR function
output$plot_timeseries <- renderPlot({
req(rv$result_data)
validate(
need(rv$result_data, "No data uploaded")
)
validate(
need(rv$result_data$rm_main_results, "This data does not have main results")
)
plot(rv$result_data$rm_main_results, type = "line",
results_to_show = input$plot_timeseries_result_type)
})

# Plot TCD using NeuroDecodeR function
output$plot_tcd <- renderPlot({
validate(
need(rv$result_data, "No data uploaded")
)
validate(
need(rv$result_data$rm_main_results, "This data does not have main results")
)
req(rv$result_data)
plot(rv$result_data$rm_main_results,
results_to_show = input$plot_tcd_result_type)
})

# Plot CM using NeuroDecodeR function
output$plot_cm <- renderPlot({
req(rv$result_data)
validate(
need(rv$result_data, "No data uploaded")
)
validate(
need(rv$result_data$rm_main_results, "This data does not have a confusion matrix")
)
plot(rv$result_data$rm_confusion_matrix,
results_to_show = input$plot_cm_result_type)
})

################################################################################
################################## PDF Output ##################################
################################################################################

# If the create button has been pressed, then render the pdf
# elisa idk if this is how you wanna do this
observeEvent(input$plot_create_pdf, {
req(rv$result_chosen, input$plot_timeseries_result_type)
# This function doesn't exist
append_result_to_pdf_and_knit(rv$result_chosen, input$plot_timeseries_result_type)
output$plot_pdf <- renderUI({
req(rv$result_chosen)
pdf_name <- gsub("Rmd", "pdf", rv$save_script_name)
tags$iframe(style = "height:600px; width:100%", src = pdf_name)
})
})

# This exists above so i removed it but it still doesn't work
# Elisa Not sure if this is right, used to be DC_pdf also it doesn't work
#output$plot_pdf <- renderUI({
# if (is.null(rv$save_script_name)){
# "The results will appear as a pdf below once the code is done running."
# } else {
# pdf_name <- gsub("Rmd", "pdf", basename(rv$save_script_name))
# tags$iframe(style="height:600px; width:100%", src = pdf_name)
# }
#})


2 changes: 1 addition & 1 deletion servers/server_run_analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ observeEvent(list(input$decoding_tabs,
decoding_params <- setNames(decoding_params, rv$script)
# Add directory names to the decoding params
decoding_params$binned_dir_name <- file.path(rv$binned_base_dir)
decoding_params$results_dir_name <- file.path(rv$result_base_dir)
decoding_params$results_dir_name <- file.path(rv$decoding_result_files_base_dir)


# GENERATE SCRIPT
Expand Down

0 comments on commit 9c76bda

Please sign in to comment.