I wrote a Rshiny app. Here, the user inputs a list of genes and the app creates a biological network out of it. The example input is shown below. The code works out of shinyapp as a R script. The input is text and not numeric.
Researched similar questions on SO here but not much useful, my input is text.
Any help is greatly appreciated.
library(shiny)
library(shinydashboard)
library(STRINGdb)
sidebar <- dashboardSidebar(
sidebarMenu(
menuItem("Analysis", tabName = "analysis")
))
body <- dashboardBody(
tabItems(
# Text Area Input for gene list
tabItem(tabName = "analysis",
fluidRow(
box(
title = "Input gene list here", status = "warning", width
= 6, textAreaInput("title1","",value = "", width =
'100%',rows=5),
actionButton("submit", "Submit")
)
),
fluidRow(
box(
title = "Stirng DB network", status = "warning", width = 8, plotOutput("stringplot")
)
)
)))
# User interface --
ui <- dashboardPage(
dashboardHeader(title = "Analysis", titleWidth = 300),
sidebar,
body
)
# Server logic
server <- function(input, output) {
subset_dataset <- eventReactive(input$submit,
{data.frame(strsplit(input$title1,split='[\r\n]'),col.names='genes')})
output$stringplot <- renderPlot({
string_db <- STRINGdb$new()
mapped_genes <- string_db$map(subset_dataset,subset_dataset()$genes,removeUnmappedRows = TRUE)
hits_2<-mapped_genes$STRING_id
string_db$plot_network(hits_2)})
}
shinyApp(ui = ui, server = server)
The example input is:
BRAF
NF1
NRAS
ERBB3
FLT3
PIK3CA
PTEN
TP53
CTNNB1
APC
SMAD4
NCOR1
