Skip to content

Commit

Permalink
added plotting button
Browse files Browse the repository at this point in the history
  • Loading branch information
pfgherardini committed Nov 8, 2018
1 parent c47abca commit 6174802
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 32 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Description: This package includes panel editing/renaming for FCS files, bead-ba
Imports: shiny (>= 0.14), flowCore, reshape, ggplot2, hexbin, gridExtra, rhandsontable, jsonlite
License: GPL v3
LazyData: TRUE
RoxygenNote: 6.0.1
RoxygenNote: 6.1.0
71 changes: 40 additions & 31 deletions inst/debarcoder_shinyGUI/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ render_debarcoder_ui <- function(...){renderUI({
selectizeInput("debarcoderui_xaxis", "Select x axis", choices = c(""), multiple = FALSE, width = "100%"),
selectizeInput("debarcoderui_yaxis", "Select y axis", choices = c(""), multiple = FALSE, width = "100%")
),
actionButton("debarcoderui_plot_data", "Plot data"),
actionButton("debarcoderui_save_files", "Save files")
),
column(8,
Expand Down Expand Up @@ -110,42 +111,50 @@ shinyServer(function(input, output, session) {
})

output$debarcoderui_plot1 <- renderPlot({
bc.res <- debarcoderui_get_bc_results()
if(!is.null(bc.res)) {
if(input$debarcoderui_plot_type == "Separation")
return(premessa:::plot_separation_histogram(bc.res))
else if(input$debarcoderui_plot_type == "Event" || input$debarcoderui_plot_type == "Single biaxial"
|| input$debarcoderui_plot_type == "All barcode biaxials") {
mahal.dist <- debarcoderui_get_mahalanobis_distance()
return(premessa:::plot_barcode_yields(bc.res, input$debarcoderui_separation_threshold,
input$debarcoderui_mahal_dist_threshold, mahal.dist))
}
if(!is.null(input$debarcoderui_plot_data) && input$debarcoderui_plot_data) {
isolate({
bc.res <- debarcoderui_get_bc_results()
if(!is.null(bc.res)) {
if(input$debarcoderui_plot_type == "Separation")
return(premessa:::plot_separation_histogram(bc.res))
else if(input$debarcoderui_plot_type == "Event" || input$debarcoderui_plot_type == "Single biaxial"
|| input$debarcoderui_plot_type == "All barcode biaxials") {
mahal.dist <- debarcoderui_get_mahalanobis_distance()
return(premessa:::plot_barcode_yields(bc.res, input$debarcoderui_separation_threshold,
input$debarcoderui_mahal_dist_threshold, mahal.dist))
}
}
})
}
})

output$debarcoderui_plot2 <- renderPlot({
bc.res <- debarcoderui_get_bc_results()
if(!is.null(bc.res)) {
if(input$debarcoderui_plot_type == "Separation")
return(premessa:::plot_barcode_separation(bc.res, input$debarcoderui_separation_threshold))
else {
m <- debarcoderui_get_exprs()
mahal.dist <- debarcoderui_get_mahalanobis_distance()
m <- cbind(m, mahal.dist = mahal.dist)
sel.rows <- premessa:::get_sample_idx(input$debarcoderui_selected_sample,
bc.res, input$debarcoderui_separation_threshold, input$debarcoderui_mahal_dist_threshold, mahal.dist)
m <- m[sel.rows, ]

if(input$debarcoderui_plot_type == "Event")
return(premessa:::plot_barcode_channels_intensities(m, bc.res$bc.channels, bc.res$m.normed[sel.rows,]))
else {
if(input$debarcoderui_plot_type == "Single biaxial")
return(premessa:::plot_color_coded_biaxial(m, input$debarcoderui_xaxis,
input$debarcoderui_yaxis, "mahal.dist"))
else if(input$debarcoderui_plot_type == "All barcode biaxials")
return(premessa:::plot_all_barcode_biaxials(m, bc.res$bc.channels))
if(!is.null(input$debarcoderui_plot_data) && input$debarcoderui_plot_data) {
isolate({
bc.res <- debarcoderui_get_bc_results()
if(!is.null(bc.res)) {
if(input$debarcoderui_plot_type == "Separation")
return(premessa:::plot_barcode_separation(bc.res, input$debarcoderui_separation_threshold))
else {
m <- debarcoderui_get_exprs()
mahal.dist <- debarcoderui_get_mahalanobis_distance()
m <- cbind(m, mahal.dist = mahal.dist)
sel.rows <- premessa:::get_sample_idx(input$debarcoderui_selected_sample,
bc.res, input$debarcoderui_separation_threshold, input$debarcoderui_mahal_dist_threshold, mahal.dist)
m <- m[sel.rows, ]

if(input$debarcoderui_plot_type == "Event")
return(premessa:::plot_barcode_channels_intensities(m, bc.res$bc.channels, bc.res$m.normed[sel.rows,]))
else {
if(input$debarcoderui_plot_type == "Single biaxial")
return(premessa:::plot_color_coded_biaxial(m, input$debarcoderui_xaxis,
input$debarcoderui_yaxis, "mahal.dist"))
else if(input$debarcoderui_plot_type == "All barcode biaxials")
return(premessa:::plot_all_barcode_biaxials(m, bc.res$bc.channels))
}
}
}
}
})
}
})

Expand Down

0 comments on commit 6174802

Please sign in to comment.