@@ -27,7 +27,7 @@ print(minx, maxx)
27
27
# ##############################################################################
28
28
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~UI~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
29
29
# ##############################################################################
30
- # Define UI for application that draws a histogram
30
+
31
31
ui <- fluidPage(
32
32
33
33
# Application title
@@ -61,12 +61,12 @@ ui <- fluidPage(
61
61
# ##############################################################################
62
62
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#~Server~#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
63
63
# ##############################################################################
64
- # Define server logic required to draw a histogram
64
+
65
65
server <- function (input , output , session ) {
66
66
67
67
output $ out6 <- renderPrint(input $ in6 )
68
68
69
- output $ trendPlot <- renderPlotly({
69
+ output $ trendPlot <- renderPlotly({ # Process input data and make plotly heatmap
70
70
if (! is.null(input $ in6 ) & ! is.null(input $ in12 )) {
71
71
data_to_plot <- emd_info %> % filter(marker %in% input $ in6 ) %> % filter(file_origin %in% input $ in12 )
72
72
data_to_plot $ file_origin <- as.factor(data_to_plot $ file_origin ) %> % fct_relevel(input $ in12 )
@@ -79,7 +79,6 @@ server <- function(input, output, session) {
79
79
data_to_plot $ file_origin <- as.factor(data_to_plot $ file_origin ) %> % fct_relevel(input $ in12 )
80
80
}
81
81
else {data_to_plot <- emd_info }
82
- # saveRDS(data_to_plot, "testdata.RDS")
83
82
initial_emd <- data_to_plot %> % ggplot(aes(x = file_origin , y = fct_rev(marker ))) + geom_tile(aes(fill = EMD_no_norm_arc ))
84
83
print(
85
84
ggplotly(initial_emd + scale_fill_distiller(
@@ -94,7 +93,7 @@ server <- function(input, output, session) {
94
93
ggtitle(" EMD scores heatmap" )
95
94
) %> % layout(height = 700 , width = 700 ))
96
95
})
97
- output $ complexheatmap <- renderPlot({ # ##TESTING ADDITION OF COMPLEXHEATMAP###
96
+ output $ complexheatmap <- renderPlot({ # Process input data and make ComplexHeatmap
98
97
if (! is.null(input $ in6 ) & ! is.null(input $ in12 )) {
99
98
data_to_plot <- emd_info %> % filter(marker %in% input $ in6 ) %> % filter(file_origin %in% input $ in12 )
100
99
data_to_plot $ file_origin <- as.factor(data_to_plot $ file_origin ) %> % fct_relevel(input $ in12 )
@@ -114,7 +113,7 @@ server <- function(input, output, session) {
114
113
Heatmap(t(df_mat ), name = " EMD scores" , column_title = " Conditions" ,row_title = " Markers" ,column_names_rot = 60 )
115
114
}, width = 600 , height = 800 )
116
115
117
- output $ foo <- downloadHandler(
116
+ output $ foo <- downloadHandler( # Download plotly heatmap
118
117
filename = " emd_heatmap.pdf" ,
119
118
content = function (file ) {
120
119
if (! is.null(input $ in6 ) & ! is.null(input $ in12 )) {
@@ -145,7 +144,7 @@ server <- function(input, output, session) {
145
144
, device = " pdf" )
146
145
}
147
146
)
148
- output $ complex <- downloadHandler(
147
+ output $ complex <- downloadHandler( # Download ComplexHeatmap
149
148
filename = " emd_complexheatmap.pdf" ,
150
149
content = function (file ) {
151
150
if (! is.null(input $ in6 ) & ! is.null(input $ in12 )) {
@@ -179,6 +178,6 @@ if (getOption("browser") == "") {
179
178
options(browser = " xdg-open" )
180
179
print(" R encountered an error when identifying your default browser." )
181
180
print(" Please manually open in your browser the addres indicated below." )
182
- } # The block below solves the utils::browseURL(appUrl) ERROR present in certain conda/WSL installs
181
+ } # The block above solves the utils::browseURL(appUrl) ERROR present in certain conda/WSL installs
183
182
184
183
shinyApp(ui = ui , server = server ) # , options = list(launch.browser=TRUE))
0 commit comments