Skip to content
Snippets Groups Projects
Commit 9aeae2a0 authored by Dominik Brilhaus's avatar Dominik Brilhaus
Browse files

update shiny app

parent 67f5c42c
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,6 @@ runtime: shiny
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
......@@ -14,30 +13,17 @@ knitr::opts_chunk$set(echo = TRUE)
# Load data
load(file = "../runs/kallisto_sleuth/run2/05_shinyPrep.RData")
load(file = "../runs/shiny_prep/shiny_prep.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 load_libraries, message=TRUE, warning=TRUE, include=FALSE}
# Load libraries
library(kableExtra)
library(shiny)
library(RColorBrewer)
library(tidyverse)
```
......@@ -50,12 +36,11 @@ 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()
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()
```
......@@ -64,43 +49,30 @@ ggplot(plot_set, aes(x = Photosynthesis.mode, y = tpm, group = Photosynthesis.mo
# 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")
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 = Photosynthesis.mode, y = tpm)) +
stat_summary(fun = 'mean', geom = 'bar') +
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() +
facet_wrap(~target_id, scales = "free") +
theme_minimal() +
theme(aspect.ratio = 1)
}),
)
)
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment