Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Alpha Module Server function
- #Helper Function in order to load Rda without names
- loadRData <- function(fileName){
- #loads an RData file, and returns it
- load(fileName)
- get(ls()[ls() != "fileName"])
- }
- alphaServer <- function(input, output, session) {
- # TODO: Put Server logic here
- userData<-reactiveValues()
- observeEvent(input$file1, {
- userData$df <- loadRData(input$file1$datapath)
- })
- output$phylo <- renderPlot({
- title <- "Alpha Diversity Metrics"
- selected_theme<-switch(input$plotTheme,
- "Grey theme" = theme_gray() ,
- "Black & White theme" =theme_bw(),
- "Classic theme" = theme_classic()
- )
- theme_set(selected_theme)
- have_input<-input$file1 #Check if user input exists
- if(!is.null(have_input)){
- validate(need(class(userData$df)!="phyloseq","Only phyloseq files are currently supported"))
- plot_richness(userData$df, measures = c("Observed", input$groupSelection))
- }
- else if (input$dataSelection == "global") {
- data("GlobalPatterns")
- plot_richness(GlobalPatterns, measures = c("Observed", input$groupSelection))
- } else if (input$dataSelection == "esophagus") {
- data("esophagus")
- plot_richness(esophagus, measures = c("Observed", input$groupSelection))
- }
- })
- }
Add Comment
Please, Sign In to add comment