I have 6 tabs each tab taking one R function and giving one type of output results, i'm having difficulty in downloading the files from these 6 tabs individually in csv file format. i'm new to r shiny , if any one knows please help me
library("shiny")
library("htmltools")
library("bsplus")
library("DT")
library("shinyalert")
library("shinyjs")
library("shinycssloaders")
library("dplyr")
library("data.table")
library("reshape2")
library("ggplot2")
library("plotly")
library("tools")
library("readxl")
library("writexl")
library("seqinr")
library(BiocManager)
library(seqTools)
library(Biostrings)
library(entropy)
source("GS_source.R")
ui <- fluidPage(
tabsetPanel(
#1st Tab ##HOME
tabPanel(h3("HOME"),
mainPanel(
)
),
# 2nd Tab Genomic Signatures
tabPanel(h3("Genomic Signatures"),
sidebarLayout(
sidebarPanel(
fileInput('file', HTML('<p style="color:white; font-size: 12pt"> Choose file to upload the expression data </p>'),accept = c('text/csv','text/comma-separated-values', 'text/tab-separated-values','text/plain','.csv', '.tsv','.fasta')),
numericInput("num1",label = "Choose X", value = 5),
numericInput("num2", label = "Choose y", value = 70),
useShinyalert(),
actionButton("action", tags$b("Submit")), width = 3, style="color: #fff; background-color: #337ab7; border-color: #2e6da4"),
mainPanel(
tabsetPanel(
tabPanel("GC-Content", verbatimTextOutput("res1")),
tabPanel("Amino Acid Content",verbatimTextOutput("res2")),
tabPanel("SCU", verbatimTextOutput("res3")),
tabPanel("Di-Odd Ratio", verbatimTextOutput("res4")),
tabPanel("CGR",plotOutput("res5")),
tabPanel("AMIP",verbatimTextOutput("res6"))
)
)
)
),
tabPanel(h4("HELP"), style = "Background-color: #E7F541;"),
tabPanel(h4("ABOUT"), style = "Background-color: #E7F541;" ),
tabPanel(h4("CONTACT US"), style= "Background-color: #E7F541;")
) )
server <- function(input, output, session){
df1 <- eventReactive(input$action, {
GC_content7(input$file$datapath)
})
output$res1 <- renderPrint({
df1()
})
df2= eventReactive(input$action, {
extractAAC_mod(input$file$datapath)
})
output$res2 <- renderPrint({
df2()
})
df3 <- eventReactive(input$action, {
RSCU(input$file$datapath)
})
output$res3 <- renderPrint({
df3()
})
observeEvent(input$action, {
shinyalert(title = "Please wait for the results...", type = "success")
})
df4 <- eventReactive(input$action, {
zscore_cal(input$file$datapath)
})
output$res4 <- renderPrint({
df4()
})
df5 <- eventReactive(input$action, {
cgr_res(input$file$datapath)
})
output$res5 <- renderPlot({
df5()
})
df6 <- eventReactive(input$action, {
AMIP(input$file$datapath,input$num1,input$num2)
})
output$res6 <- renderPrint({
df6()
})
observeEvent(input$action, {
shinyalert(title = "Please wait for the results...", type = "success")
})
}
shinyApp(ui, server)