diff --git a/workflows/no_CWL_yet/shiny_plots.Rmd b/workflows/no_CWL_yet/shiny_plots.Rmd deleted file mode 100644 index 08e245ce822eb7f053f76ec7148c92dad73be27c..0000000000000000000000000000000000000000 --- a/workflows/no_CWL_yet/shiny_plots.Rmd +++ /dev/null @@ -1,106 +0,0 @@ ---- -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) - - - }), - - - ) -) - - - -``` diff --git a/workflows/shiny_plots.Rmd b/workflows/shiny_plots.Rmd new file mode 100644 index 0000000000000000000000000000000000000000..ecc2e1ef9878a1d09bb4dd5aa4efbfe0fc66fe0a --- /dev/null +++ b/workflows/shiny_plots.Rmd @@ -0,0 +1,78 @@ +--- +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/shiny_prep/shiny_prep.RData") +``` + + +```{r load_libraries, message=TRUE, warning=TRUE, include=FALSE} +# Load libraries + +library(kableExtra) +library(shiny) +library(RColorBrewer) +library(tidyverse) +``` + + +```{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 = condition, y = tpm, group = condition)) + + 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};}") + ) + ) + ), + mainPanel( + renderPlot({ + plot_set <- subset(expression_data, target_id %in% input$target) + + ## Facetted by gene only + + ggplot(plot_set, aes(x = condition, 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) + }), + ) +) +```