... | ... |
@@ -10,13 +10,13 @@ plot3_Server <- function(id, eventData2, rv, matrix, genesets){ |
10 | 10 |
output$plot3 <- renderPlotly({ |
11 | 11 |
req(eventData2()) |
12 | 12 |
selected.gene.set <- rv$p2$x$data[[1]]$text[eventData2()] |
13 |
- if(is(genesets, "GeneSetCollection")){ |
|
14 |
- genes.toplot <- geneIds(genesets)[[selected.gene.set]] |
|
13 |
+ if(is(genesets(), "GeneSetCollection")){ |
|
14 |
+ genes.toplot <- geneIds(genesets())[[selected.gene.set]] |
|
15 | 15 |
} else { |
16 |
- genes.toplot <- genesets[[selected.gene.set]] |
|
16 |
+ genes.toplot <- genesets()[[selected.gene.set]] |
|
17 | 17 |
} |
18 |
- mt <- match(genes.toplot, rownames(matrix)) |
|
19 |
- x <- matrix[na.omit(mt), rv$sample.c] |
|
18 |
+ mt <- match(genes.toplot, rownames(matrix())) |
|
19 |
+ x <- matrix()[na.omit(mt), rv$sample.c] |
|
20 | 20 |
df <- as.data.frame(x) |
21 | 21 |
df$x <- as.numeric(df$x) |
22 | 22 |
df$Gene <- rownames(df) |
... | ... |
@@ -25,7 +25,7 @@ plot3_Server <- function(id, eventData2, rv, matrix, genesets){ |
25 | 25 |
stat_density(geom="line", position = "identity") + |
26 | 26 |
geom_rug() + theme(legend.position = "none") + |
27 | 27 |
labs(x="Gene Expressions in selected sample", y="Density") + |
28 |
- xlim(as.numeric(range(matrix))) + |
|
28 |
+ xlim(as.numeric(range(matrix()))) + |
|
29 | 29 |
scale_color_manual("legend", values= rv$dd.col) |
30 | 30 |
ggplotly(rv$p3, tooltip = c("Gene", "x")) %>% style(hoverinfo="none", traces = 1) %>% |
31 | 31 |
layout(title = list(text = paste0('<br><sup><i>', selected.gene.set, '</i></sup>'), |
... | ... |
@@ -34,18 +34,18 @@ function(input, output, session) { |
34 | 34 |
#### GSVA RESULTS #### |
35 | 35 |
|
36 | 36 |
rv <- reactiveValues(gs=NULL, dat.t=NULL, n=NULL, dd.col=NULL, p=NULL, |
37 |
- errors.gsva = NULL, matrix=NULL, genesets=NULL) |
|
37 |
+ errors.gsva = NULL) |
|
38 | 38 |
gsva.cancel <- reactiveVal(FALSE) |
39 | 39 |
|
40 | 40 |
observeEvent( input$button, { |
41 |
+ runjs("Shiny.setInputValue('plotly_click-click1', null);") |
|
42 |
+ runjs("Shiny.setInputValue('plotly_click-click2', null);") |
|
41 | 43 |
rv$gs <- NULL |
42 | 44 |
rv$dat.t <- NULL |
43 | 45 |
rv$p <- NULL |
44 | 46 |
rv$p2 <- NULL |
45 | 47 |
rv$p3 <- NULL |
46 | 48 |
rv$errors.gsva = NULL |
47 |
- rv$matrix <- isolate(matrix()) |
|
48 |
- rv$genesets <- isolate(genesets()) |
|
49 | 49 |
gsva.cancel(FALSE) |
50 | 50 |
modalGSVAUI("modal.text") |
51 | 51 |
# future() cannot take reactive values, so we must isolate() them |
... | ... |
@@ -96,7 +96,6 @@ function(input, output, session) { |
96 | 96 |
# PLOT1 RENDER |
97 | 97 |
plot1_Server("plot1", rv) |
98 | 98 |
|
99 |
- |
|
100 | 99 |
# PLOT2 RENDER |
101 | 100 |
eventData1 <- reactive({ |
102 | 101 |
req(rv$dat.t) |
... | ... |
@@ -112,7 +111,8 @@ function(input, output, session) { |
112 | 111 |
ind <- event_data("plotly_click", source = "click2") |
113 | 112 |
ind <- ind$pointNumber+1 |
114 | 113 |
}) |
115 |
- plot3_Server("plot3", eventData2, rv, rv$matrix, rv$genesets) |
|
114 |
+ # plot3_Server("plot3", eventData2, rv, rv$matrix, rv$genesets) |
|
115 |
+ plot3_Server("plot3", eventData2, rv, matrix, genesets) |
|
116 | 116 |
|
117 | 117 |
# DWN BTN |
118 | 118 |
downloadServer("download", reactive(rv$gs)) |