-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexamine_proteins.Rmd
107 lines (88 loc) · 3.29 KB
/
examine_proteins.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
```{r}
library(shiny)
library(visNetwork)
```
# Proteins
## {.sidebar data-width="200" .opening-page-text}
#### Legend
<p class='options-text'><b>Kinase groups by color</b></p>
```{r}
imageOutput('legend',height="auto")
output$legend <- renderImage({
list(src='img/kinase_families_legend2.png',width="100%")
},deleteFile=FALSE)
```
#### Layout
```{r,cache=FALSE}
selectizeInput('layout1',label=NULL,choices=names(layout_choices),selected="Default",multiple=FALSE)
```
#### Export
```{r, cache=FALSE}
selectizeInput('download_choice1',label=NULL,choices=names(export_choices))
filename1 <- reactive({export_choices[[input$download_choice1]]})
(downloadButton('download1',"Download"))
output$download1 <- downloadHandler(
filename=function() {filename1()},
content = function(file) {export_method(filename1(),g1(),file)}
)
```
#### Data Overview {.disclaimer-text}
Last update: </br> <b>`r dataset_last_update`</b>
Proteins available: </br> <b> `r nproteins` </b>
Proteins data source: </br> [UniProt](https://www.uniprot.org/uniprotkb?query=Human&facets=reviewed%3Atrue%2Cmodel_organism%3A9606){target="_blank"} <i>`r uniprot_release`</i>.
## Main Panel {data-width=750}
#### Choose a protein {.opening-page-text}
Visualize kinase-substrate interactions of **individual proteins**. Choose a protein from the dropdown menu, or, double-click on a visible protein node.
```{r, cache = FALSE}
selectizeInput(inputId='centerGene',choices=all_nodes$GeneName,label=NULL,selected = "STK11", multiple = F,options=list(maxOptions=4000))
```
### {}
```{r, cache=FALSE}
g1 <- reactive(get_one_degree(input$centerGene,TRUE))
visNetworkOutput('network1')
output$network1 <- renderVisNetwork({
vis_default(g1()) %>%
visNodes(scaling=list(label=list(min=60,max=80))) %>%
visEvents(selectEdge = "function(edges) {Shiny.setInputValue('selectedEdges1', edges.edges);}") %>%
visEvents(selectNode ="function(nodes){Shiny.onInputChange('selectNode1', nodes.nodes);}") %>%
visEvents(doubleClick="function(nodes){Shiny.onInputChange('nextCenterNode',nodes.nodes)}") %>%
visIgraphLayout(layout=layout_choices[[input$layout1]],smooth=T,physics=(nrow(g1()$edges)<10))
})
observeEvent(input$nextCenterNode,{updateSelectInput(inputId='centerGene',selected=get_gene_name(input$nextCenterNode))})
infoGene1 <- reactive({
req(input$selectNode1)
get_gene_name(input$selectNode1)
# if(is.null(input$selectNode1)) {NULL} else {get_gene_name(input$selectNode1)}
})
infoEdge1 <- reactive({
# infoEdge1 <- renderUI({
#
# req(input$selectedEdges1)
# input[['button-view-toggle-p1']] <- FALSE
req(input$selectedEdges1)
print(input$selectedEdges1)
req(g1())
req(g1()$edges)
edge_id <- input$selectedEdges1
e <- g1()$edges %>% filter(id == edge_id)
req(nrow(e)==1)
# render_edge_info(e, 'button-view-toggle-p1', 'seq-table-p1')
render_edge_info(e)
})
# observeEvent()
```
## {data-width="650" .opening-page-text}
### {data-height="500"}
#### Interaction information
<p class='options-text'> <b> Click on an edge</b> </p>
```{r,cache=FALSE}
renderUI({infoEdge1()})
```
<!-- #### test2 -->
<!-- test123 -->
### {data-height="110"}
#### Troubleshooting
<div class="options-text">
<p><b>Not laid out as expected? </b></p>
<p>Try a different layout, or, manually move nodes around.</p>
</div>