-
Dominik Brilhaus authoredDominik Brilhaus authored
shiny_plots.Rmd 2.25 KiB
title: "Plot Talinum RNASeq data"
output: html_document
runtime: shiny
knitr::opts_chunk$set(echo = TRUE)
# Load data
load(file = "../runs/kallisto_sleuth/run2/05_shinyPrep.RData")
# 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)
}
# 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()
# 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)
}),
)
)