library(shiny)
ui <- fluidPage(
titlePanel("Arabidopsis EcosGEx"),
sidebarLayout(
sidebarPanel(
textInput("agi", "Entre your AGI ID:"),
actionButton("find", "Find"),
helpText("It will take some time. Be patient after you hit Find.")
),
mainPanel(
h3("Ecotype specific Gene Expression", align = "center"),
#Display Table
DT::dataTableOutput("mytable")
)
)
)
#############################################################################
server <- function(input, output) {
#Load packages
library(data.table)
library(maptools)
library(maps)
library(ggmap)
library(ggplot2)
library(DT)
observeEvent(input$find, {
#Read data.
expr <- read.csv("expr.csv", sep = "\t", row.names = 1)
cord <- read.csv("665_cord.csv")
#Taking the AGI ID and process the table.
agi_id <- toupper(input$agi)
gene <- t(expr[agi_id,])
gene_df <- as.data.frame(gene)
gene_expr <- setDT(gene_df, keep.rownames = TRUE)[]
colnames(gene_expr)[1] <- "gene_id"
all <- merge(x=gene_expr, y=cord, by= "gene_id", all=TRUE)
all_combined <- na.omit(all)
colnames(all_combined)[1] <- "Ecotype_ID"
#Printing the table to screen
output$mytable = DT::renderDataTable({
all_combined
})
})
}
shinyApp(ui = ui, server = server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.