--- title: "Plot Talinum RNASeq data" output: html_document runtime: shiny --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ```{r load_data, include=FALSE} # Load data load(file = "../runs/kallisto_sleuth/run2/05_shinyPrep.RData") ``` ```{r plot_setup, message=TRUE, warning=TRUE, include=FALSE} # Setup plot environment required.packages <- c('kableExtra', ## RMarkdown, "shiny", "tidyverse", ## data loading and shaping "RColorBrewer" ## plotting ) for(package in required.packages) { print(package) ## Check if package is installed. If not, install if(!package %in% row.names(installed.packages())) {install.packages(package, repos ="https://cran.uni-muenster.de/")} ## Load package library(package, character.only = T) } ``` ```{r, eval = FALSE, echo = FALSE} # Non-interactive test current_selection <- sample(expression_data$target_id, 10) plot_set <- subset(expression_data, target_id %in% current_selection) ggplot(plot_set, aes(x = Photosynthesis.mode, y = tpm, group = Photosynthesis.mode)) + stat_summary(fun = 'mean', geom = 'bar') + geom_point(size = 0.5) + facet_wrap(~ target_id , scales = "free") + theme_minimal() ``` ```{r shiny_part, echo=FALSE, message = F, error = FALSE, warning=FALSE} # Let it shine sidebarLayout( sidebarPanel( selectizeInput(multiple = T, "target", label = "Select Gene by target id", choices = available_genes, selected = sample(available_genes, size = 3), options = list(delimiter = ' ', create = I("function(input, callback){return {value: input, text: input};}")) ), helpText("You can copy/paste target ids from excel") ), mainPanel( renderPlot({ plot_set <- subset(expression_data, target_id %in% input$target) ## Facetted by gene only ggplot(plot_set, aes(x = Photosynthesis.mode, y = tpm)) + stat_summary(fun = 'mean', geom = 'bar') + geom_point(size = 0.5) + facet_wrap( ~ target_id, scales = "free") + theme_minimal() + theme(aspect.ratio = 1) }), ) ) ```