Skip to content

Instantly share code, notes, and snippets.

@keqiang
Last active April 12, 2018 21:18
Show Gist options
  • Save keqiang/f37f1e535c725bfea6beae9576b9366a to your computer and use it in GitHub Desktop.
Save keqiang/f37f1e535c725bfea6beae9576b9366a to your computer and use it in GitHub Desktop.
Using 'RDAVIDWebService' Package in A Shiny App
library(shiny)
library(RDAVIDWebService)
# To install 'RDAVIDWebService' package
# source("https://bioconductor.org/biocLite.R") #
# biocLite("RDAVIDWebService")
ui <- fluidPage(fluidRow(
sliderInput(
"clusterNumber",
label = "Cluster",
value = 1,
min = 1,
max = 5
),
plotOutput("clusterPlot"),
verbatimTextOutput("debug")
))
server <- function(input, output, session) {
# you must have registered your email on DAVID's website https://david.ncifcrf.gov/webservice/register.htm
# connect to david web service
david <-
DAVIDWebService$new(email = "YOUR_EMAIL", url = "https://david.ncifcrf.gov/webservice/services/DAVIDWebService.DAVIDWebServiceHttpSoap12Endpoint/")
# you can use some input to make the reactive a useful reactive, such as let the use to choose what annotation to get
termCluster <- reactive({
data("demoList1") # a demo gene list comes with 'RDAVIDWebService' package
# upload this list to david
addList(
david,
demoList1,
idType = "AFFYMETRIX_3PRIME_IVT_ID",
listName = "demoList1",
listType = "Gene"
)
# get the cluster report for the upload
getClusterReport(david, type = "Term")
})
observe({
req(termCluster())
# retrieve the number of clusters
updateSliderInput(session, "clusterNumber", max = nrow(summary(termCluster())))
})
output$clusterPlot <- renderPlot({
req(termCluster())
# plot the input$clusterNumber(th) cluster
plot2D(termCluster(), input$clusterNumber)
})
output$debug <- renderPrint({
req(termCluster())
summary(termCluster())
})
}
shinyApp(ui, server)
@sdhutchins
Copy link

Any desire to turn this into a full fledged app?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment