-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoexpression_section.R
More file actions
79 lines (66 loc) · 2.99 KB
/
coexpression_section.R
File metadata and controls
79 lines (66 loc) · 2.99 KB
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
coexpression<-list()
coexpression$id <- "coexpression"
coexpression$title <- "Co-Expression Data"
coexpression$loadData<- function(){
coexpressionData <<- fread("www/coexpression/coExpressionData.csv")
}
coexpression$generateUI<- function(){
div(
fluidRow(
column(div(uiOutput('coExpSelectUI'),class="geneselect"),width =2)
),
fluidRow(
column(dataTableOutput("coExpTable"), width = 12)
)
)
}
coexpression$serverLogic <- function(input,output,session,reactives)
{
#populate the dropdown using the reactive value
output$coExpSelectUI <- renderUI({
dropDownGenes <- (evidence[(evidence$RSID == reactives$selRiskVariant()$RSID & (evidence$GWAS == reactives$selRiskVariant()$GWAS)),]$GENE)
#add "All Genes" to the list for the other drop downs
dropDownGenes <- append(dropDownGenes, "All Genes", 0)
#default selected to the first in the list
selected_gene <- dropDownGenes[1]
#if there was a searched gene, select that
if(reactives$searchedGene()!="")
{
selected_gene <-dropDownGenes[match(toupper(reactives$searchedGene()), toupper(as.vector(dropDownGenes)))]
}
selectInput("coExpSelect",label = "Choose a gene", choices = dropDownGenes, selected = selected_gene)
})
#load the disease gene table
output$coExpTable <- renderDT({
tableData <- NULL
if(is.null(input$coExpSelect))
{
tableData <- coexpressionData[coexpressionData$GENE %in% (evidence[evidence$LOC_NUM== reactives$selRiskVariant()$LOC_NUM & evidence$GWAS == reactives$selRiskVariant()$GWAS,]$GENE),]
scrollYVal <- 300
}
else
{
if(input$coExpSelect=="All Genes")
{
tableData <- coexpressionData[coexpressionData$GENE %in% (evidence[evidence$LOC_NUM== reactives$selRiskVariant()$LOC_NUM & evidence$GWAS == reactives$selRiskVariant()$GWAS,]$GENE),]
scrollYVal <- 300
}
else
{
tableData <- coexpressionData[coexpressionData$GENE == input$coExpSelect,]
scrollYVal <- 300
}
}
tableData <- tableData[,!c("GWAS","LOC_NUM")]
colnames(tableData)[colnames(tableData)=='GENE']<-'Gene'
datatable(tableData, rownames = F, escape = F, options = list(processing = F, searching = F, paginate = F, dom = 't', scrollY = paste0(scrollYVal,"px"), scrollX = T,
columnDefs = list(list(
render = JS(
"function(data, type, row, meta) {",
"return (data==='') ? 'none' : data;",
"}"
),
width = '40%',
targets = c(1,2,3)))))
})
}