# Module UI
#' @title mod_uploadTree_ui and mod_uploadTree_server
#' @description A shiny Module. This module will upload a newick tree and is read in by treeio package with the function read.newick
#'
#' @param id shiny id
#' @param input internal
#' @param output internal
#' @param session internal
#'
#' @rdname mod_uploadTree
#'
#' @keywords internal
#' @export
#' @importFrom shiny NS tagList
mod_uploadTree_ui <- function(id){
ns <- NS(id)
tagList(
fileInput(ns("treefile"), label="Upload a newick file, please"))
}
# Module Server
#' @rdname mod_uploadTree
#' @export
#' @keywords internal
mod_uploadTree_server <- function(input, output, session){
ns <- session$ns
treeFile <- reactive({
req(input$treefile)
treeio::read.newick(input$treefile$datapath)
})
return(treeFile)
}
## To be copied in the UI
# mod_uploadTree_ui("uploadTree_ui_1")
## To be copied in the server
# callModule(mod_uploadTree_server, "uploadTree_ui_1")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.