Skip to content

Instantly share code, notes, and snippets.

@freshbiostats

freshbiostats/server.R Secret

Created Jun 14, 2013
Embed
What would you like to do?
SNP association shiny app
library(shiny)
library(SNPassoc)
data(SNPs)
SNPs <- SNPs[,1:15]
dataset <- setupSNP(data = SNPs, colSNPs = 6:15,sep = "")
shinyServer(function(input, output) {
datasetInput <- reactive({
switch(input$dataset,
"snp10001" = dataset$snp10001,
"snp10002" = dataset$snp10002,
"snp10003" = dataset$snp10003,
"snp10004" = dataset$snp10004,
"snp10005" = dataset$snp10005,
"snp10006" = dataset$snp10006,
"snp10007" = dataset$snp10007,
"snp10008" = dataset$snp10008,
"snp10009" = dataset$snp10009,
"snp100010" = dataset$snp100010)
})
output$summary <- renderPrint({
summary(dataset)
})
output$summary <- renderPrint({
summary(dataset)
})
output$snp_association <-renderPrint({
SNP <- datasetInput()
assoc <- association(casco~SNP, data=dataset)
print(assoc)
})
output$snpPlot<-renderPlot({
SNP <- datasetInput()
SNP_plot <- plot(SNP)
print(SNP_plot)
})
})
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("SNP association analysis"),
sidebarPanel(
selectInput("dataset", "Choose a SNP:",
choices = c("snp10001", "snp10002", "snp10003",
"snp10004", "snp10005", "snp10006",
"snp10007", "snp10008", "snp10009",
"snp100010"))),
mainPanel(
h3("Dataset summary"),
verbatimTextOutput("summary"),
h3("Single SNP summary"),
plotOutput("snpPlot"),
h3("Single SNP association results"),
verbatimTextOutput("snp_association")
)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment