Commit 885ff605 authored by Sandra Derozier's avatar Sandra Derozier
Browse files

V1 - Upload Biom & TSV files / ASV selection

parent 93850786
#' @import shiny
app_server <- function(input, output,session) {
app_server <- function(input, output, session) {
# Load package data in the session (for testing purpose)
# data("physeq", package = "affiliationExplorer")
# data("affi", package = "affiliationExplorer")
# data("otu_dictionary", package = "affiliationExplorer")
# List the first level callModules here
}
observeEvent(input$tsv, {
# Read the biom file --> phyloseq
biomfile <- read_frogs_biom(input$biom$datapath)
# Read the tsv file --> readr
multihits <- read_multihits(input$tsv$datapath)
#
all <- sanitize_physeq_and_affi(biomfile, multihits)
# Add ASV Select Input
insertUI(
selector = "#tmp",
where = "beforeEnd",
ui = selectInput("asv",
label = "Select ASV",
choices = all$otu_dictionary$OTU,
multiple = FALSE)
)
observeEvent(input$asv, {
# Extract Affiliation for a given OTU
data <- extract_affiliation(all$affi, input$asv)
amb <- find_level(data)
output$txt <- renderUI({paste(input$asv, "- ", nrow(data) ," affiliation, ambiguity at rank ", amb)})
output$table <- renderTable({data})
# output$table <- renderFlexTable({
# mymtcars$Name <- paste0('<label><input type="radio" id="name', seq_along(names(data)), '"> <span>', names(data), '</span></label>')
# })
})
})
}
\ No newline at end of file
#' @import shiny
#' @import shinycssloaders
#' @import shinydashboard
app_ui <- function() {
tagList(
# Leave this function for adding external resources
golem_add_external_resources(),
# List the first level UI elements here
fluidPage(
h1("affiliationExplorer")
dashboardPage(skin = "purple",
# DashBooard Header
dashboardHeader(
title = "Affiliation explorer"
),
# DashBooard Sidebar
dashboardSidebar(
fileInput("biom",
"Upload Biom File",
accept = c(".biom")
),
fileInput("tsv",
"Upload MultiHits TSV File",
accept = c("text/csv", ".tsv")
),
textOutput("tmp")
),
# DashBooard Body
dashboardBody(
fluidPage(
fluidRow(
box(title = "Affiliation selection",
width = NULL,
status = "primary",
solidHeader = T,
htmlOutput("txt"),
HTML("<br/>"),
tableOutput("table")
)
)
)
)
)
)
}
......@@ -13,6 +45,8 @@ app_ui <- function() {
#' @import shiny
golem_add_external_resources <- function(){
tags$link(rel="stylesheet", type="text/css", href="www/custom.css")
addResourcePath(
'www', system.file('app/www', package = 'affiliationExplorer')
)
......
......@@ -7,14 +7,16 @@
## 2.1 Add modules
##
golem::add_module( name = "my_first_module" ) # Name of the module
golem::add_module( name = "my_other_module" ) # Name of the module
golem::add_module( name = "Main" ) # Name of the module
## 2.2 Add dependencies
## Allow pipe use
usethis::use_pipe()
usethis::use_package("shinydashboard")
#usethis::use_package("shinycssloaders")
#usethis::use_package("ReporteRs")
usethis::use_package( "phyloseq" ) # To call each time you need a new package
usethis::use_package( "biomformat" )
usethis::use_package( "dplyr" )
......
# Set options here
options(golem.app.prod = FALSE) # TRUE = production mode, FALSE = development mode
options(shiny.maxRequestSize = 80 * 1024^2)
options(spinner.color="#0275D8", spinner.color.background="#ffffff", spinner.size=2)
# Detach all loaded packages and clean your environment
golem::detach_all_attached()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment