initial commit
This commit is contained in:
commit
6f2cb5bb70
1 changed files with 126 additions and 0 deletions
126
tb_host/app.R
Normal file
126
tb_host/app.R
Normal file
|
@ -0,0 +1,126 @@
|
|||
#
|
||||
# This is a Shiny web application. You can run the application by clicking
|
||||
# the 'Run App' button above.
|
||||
#
|
||||
# Find out more about building applications with Shiny here:
|
||||
#
|
||||
# http://shiny.rstudio.com/
|
||||
#
|
||||
|
||||
library(shiny)
|
||||
library(shinyjs)
|
||||
library(shinydashboard)
|
||||
#library("wesanderson") # ayyyy lmao hipster af
|
||||
library(dplyr)
|
||||
library(DT)
|
||||
library(ggplot2)
|
||||
library(grid) # for the info box
|
||||
library(plotly)
|
||||
library(shinycssloaders)
|
||||
library(NGLVieweR)
|
||||
|
||||
# make shiny non-stupid
|
||||
options(shiny.launch.browser = FALSE) # i am a big girl and can tie my own laces
|
||||
options(shiny.port = 8000) # don't change the port every time
|
||||
options(shiny.host = '0.0.0.0') # This means "listen to all addresses on all interfaces"
|
||||
|
||||
genes = c("Gene 1", "Gene 2", "Gene 3", "Gene 4", "Gene 5")
|
||||
|
||||
# Define UI for application that draws a histogram
|
||||
ui=dashboardPage(skin="purple",
|
||||
dashboardHeader(title="Tuberculosis Host"),
|
||||
dashboardSidebar(
|
||||
radioButtons("gene",
|
||||
label="Gene",
|
||||
choices = genes,
|
||||
selected="Gene 1" # "none" is a value
|
||||
)
|
||||
),
|
||||
dashboardBody(
|
||||
useShinyjs(),
|
||||
fluidRow(
|
||||
box(
|
||||
title="Crystallised Structure",
|
||||
column(
|
||||
NGLVieweROutput("structure"),
|
||||
width=12
|
||||
)
|
||||
),
|
||||
box(
|
||||
title="AlphaFold Structure",
|
||||
column(
|
||||
NGLVieweROutput("af_structure"),
|
||||
width=12
|
||||
)
|
||||
)
|
||||
),
|
||||
fluidRow(
|
||||
column(
|
||||
DT::dataTableOutput('table'),
|
||||
width=12
|
||||
)
|
||||
),
|
||||
verbatimTextOutput("debug")
|
||||
)
|
||||
)
|
||||
|
||||
# Define server logic required to draw a histogram
|
||||
server <- function(input, output) {
|
||||
|
||||
output$distPlot <- renderPlot({
|
||||
# generate bins based on input$bins from ui.R
|
||||
x <- faithful[, 2]
|
||||
bins <- seq(min(x), max(x), length.out = input$bins + 1)
|
||||
|
||||
# draw the histogram with the specified number of bins
|
||||
hist(x, breaks = bins, col = 'darkgray', border = 'white',
|
||||
xlab = 'Waiting time to next eruption (in mins)',
|
||||
main = 'Histogram of waiting times')
|
||||
})
|
||||
### NGLViewer ####
|
||||
# Structure Viewer WebGL/NGLViewR window
|
||||
output$structure <- renderNGLVieweR({
|
||||
#ngl_gene=isolate(input$switch_target)
|
||||
#ngl_gene=input$switch_target
|
||||
#ngl_drug=target_map[[ngl_gene]]
|
||||
#ngl_pdb_file=paste0(load_dir, "Data/", ngl_drug, '/output/depth/', ngl_gene, '_complex.pdb')
|
||||
#print(ngl_pdb_file)
|
||||
#NGLVieweR(ngl_pdb_file) %>%
|
||||
NGLVieweR("3pl1") %>%
|
||||
addRepresentation("cartoon",
|
||||
param = list(name = "cartoon",
|
||||
color="tan"
|
||||
#, colorScheme = "chainid"
|
||||
)
|
||||
) %>%
|
||||
stageParameters(backgroundColor = "lightgrey") %>%
|
||||
setQuality("high") %>%
|
||||
setFocus(0) %>%
|
||||
setSpin(FALSE)
|
||||
})
|
||||
output$af_structure <- renderNGLVieweR({
|
||||
#ngl_gene=isolate(input$switch_target)
|
||||
#ngl_gene=input$switch_target
|
||||
#ngl_drug=target_map[[ngl_gene]]
|
||||
#ngl_pdb_file=paste0(load_dir, "Data/", ngl_drug, '/output/depth/', ngl_gene, '_complex.pdb')
|
||||
#print(ngl_pdb_file)
|
||||
#NGLVieweR(ngl_pdb_file) %>%
|
||||
NGLVieweR("3pl1") %>%
|
||||
addRepresentation("cartoon",
|
||||
param = list(name = "cartoon",
|
||||
color="tan"
|
||||
#, colorScheme = "chainid"
|
||||
)
|
||||
) %>%
|
||||
stageParameters(backgroundColor = "lightgrey") %>%
|
||||
setQuality("high") %>%
|
||||
setFocus(0) %>%
|
||||
setSpin(FALSE)
|
||||
})
|
||||
output$table = DT::renderDataTable(mtcars)
|
||||
|
||||
|
||||
}
|
||||
|
||||
# Run the application
|
||||
shinyApp(ui = ui, server = server)
|
Loading…
Add table
Add a link
Reference in a new issue