I have a shiny like below, where I can add genomic coordinate and separate them by Space
. I would like to know, how can I save data in a .bed
format.
Code:
ui <- fluidPage(
textAreaInput("list", "Input List"),
actionButton("submit", "Submit", style="color: white; background-color: gray; border-color: black"),
downloadButton("download", "Download results", style="color: white; background-color: gray; border-color: black"),
mainPanel( textOutput("out") )
)
server <- function(input, output, session) {
my_text <- reactive({
data.matrix(input$list)
}) %>%
shiny::bindCache(input$list
) %>%
shiny::bindEvent(input$submit)
output$out <- renderText({
my_text()
})
## Download results
shinyjs::disable("download")
observeEvent(my_text(), {
shinyjs::enable("download")
})
output$download <- downloadHandler(
filename = ".csv",
content = function(file) {
write.csv(my_text(), file, row.names = FALSE,sep="\t")
}
)
}
shinyApp(ui, server)
I would like to save them like below, each region in a given row and separated by Tab
chr1 10 20
chr2 20 30