Commit 3b055699 authored by gohr's avatar gohr
Browse files

adds expression_explorer.yml with minimal Conda env; changes expression...

adds expression_explorer.yml with minimal Conda env; changes expression explorer to not depend enymore on devtools; adapts script to run with shinyjqui unitl version 0.4.0
parent 97105f91
#!/usr/bin/env bash
# expression_explorer.yml contains definition of minimal Conda environment to run this script.
export SCRIPT_DIRECTORY="$(dirname "$0")/"
$(which Rscript) -<<"EOF" ${SCRIPT_DIRECTORY}
args = commandArgs(trailingOnly = TRUE)
# LOAD packages --------------------------------------------------------------------------------------------------------
if(!"devtools" %in% installed.packages()[,"Package"]) {
install.packages("devtools")
}
devtools::source_url("https://raw.githubusercontent.com/holgerbrandl/datautils/v1.44/R/core_commons.R")
load_pack(shiny)
load_pack(shinyFiles)
load_pack(DT)
load_pack(plotly)
load_pack(shinyjqui)
$(which Rscript) -<<"EOF" ${SCRIPT_DIRECTORY}
args = commandArgs(trailingOnly = TRUE)
# Setting browser avoids: Error in utils::browseURL(hu$url) : 'browser' must be a non-empty character string
# Set browser to chrome for Chrome, or ie or "path/to/IE" for Internet explorer, or safari for Safari...
options(browser = 'firefox')
# Determine data directory from execution context ---------------------------------------------------------------------
dataPath= args[1]
dataPath= args[1] #%>% dirname()%>% dirname()%>% dirname()
## https://stackoverflow.com/questions/1815606/rscript-determine-path-of-the-executing-script
#initial.options <- commandArgs(trailingOnly = FALSE)
#file.arg.name <- "--file="
#script.name <- sub(file.arg.name, "", initial.options[grep(file.arg.name, initial.options)])
## script.name="/Volumes/cerebral-organoids/RNA-Seq/data/hsap/dge_analysis/expression_explorer.app/Contents/MacOS/expression_explorer"
#dataPath= script.name %>% dirname() %>% dirname()%>% dirname() %>% dirname()
# LOAD packages --------------------------------------------------------------------------------------------------------
library(shiny)
library(shinyFiles)
library(DT)
library(plotly)
library(shinyjqui)
library(readr)
library(grid)
library(scales)
library(readxl)
library(forcats)
library(stringr)
library(magrittr)
library(dplyr)
library(tidyr)
# FUNCTIONS ------------------------------------------------------------------------------------------------------------
calc_ci = function(df, variable, ci_interval=0.95){
variable <- enquo(variable)
......@@ -216,8 +219,13 @@ app <- shinyApp(
pd <- position_dodge(0.3)
plot_data <- all %>% filter(gene_name %in% input$gene_name & grepl(input$method, method))
# plot_data <- all %>% filter(gene_name %in% c("Gnai3", "Cdc45") & grepl("fpkm", method))
plot_data$condition <- factor(plot_data$condition, levels = input$sample_order)
# The library shinyjqui has changes the data structure of the output in version 0.4.0.
# This hack is to make the script running with the previous and current (v0.4.0) data structures.
sample_order_vector=input$sample_order
if(class(input$sample_order)=='data.frame'){sample_order_vector=as.character(input$sample_order$text)}
plot_data$condition <- factor(plot_data$condition, levels = sample_order_vector)
plot <- ggplot(plot_data, aes(condition, rep_values, color = gene_name)) +
geom_point(position=pd) +
......
......@@ -3,39 +3,40 @@
# we need to use an absolute path here to make it runnable from the finder
## #!/usr/bin/env Rscript
# expression_explorer.yml contains definition of minimal Conda environment to run this script.
# run shiny app from a bash file: Rscript -e "shiny::runApp('expression_explorer/', launch.browser=TRUE)"
# https://shiny.rstudio.com/reference/shiny/1.0.5/
# http://rstudio.github.io/DT/
# cd /Volumes/cerebral-organoids/RNA-Seq/data/hsap/dge_analysis; R
# args = commandArgs(trailingOnly = TRUE)
# LOAD packages --------------------------------------------------------------------------------------------------------
if(!"devtools" %in% installed.packages()[,"Package"]) {
install.packages("devtools")
}
devtools::source_url("https://raw.githubusercontent.com/holgerbrandl/datautils/v1.44/R/core_commons.R")
load_pack(shiny)
load_pack(shinyFiles)
load_pack(DT)
load_pack(plotly)
load_pack(shinyjqui)
# Setting browser avoids: Error in utils::browseURL(hu$url) : 'browser' must be a non-empty character string
# Set browser to chrome for Chrome, or ie or "path/to/IE" for Internet explorer, or safari for Safari...
options(browser = 'firefox')
# Determine data directory from execution context ---------------------------------------------------------------------
# When this script is run inside the DGE folder with Rscript, then
# the dataPath should be '.'. Otherwise change this variable to
# where Expression Eplorer can find the output files from the DGE
# workflow.
dataPath="."
# dataPath= args[1] %>% dirname()%>% dirname()%>% dirname()
# # https://stackoverflow.com/questions/1815606/rscript-determine-path-of-the-executing-script
# initial.options <- commandArgs(trailingOnly = FALSE)
# file.arg.name <- "--file="
# script.name <- sub(file.arg.name, "", initial.options[grep(file.arg.name, initial.options)])
# # script.name="/Volumes/cerebral-organoids/RNA-Seq/data/hsap/dge_analysis/expression_explorer.app/Contents/MacOS/expression_explorer"
# dataPath= script.name %>% dirname() %>% dirname()%>% dirname() %>% dirname()
# LOAD packages --------------------------------------------------------------------------------------------------------
library(shiny)
library(shinyFiles)
library(DT)
library(plotly)
library(shinyjqui)
library(readr)
library(grid)
library(scales)
library(readxl)
library(forcats)
library(stringr)
library(magrittr)
library(dplyr)
library(tidyr)
dataPath="."
# FUNCTIONS ------------------------------------------------------------------------------------------------------------
......@@ -117,7 +118,7 @@ app <- shinyApp(
# USER INTERFACE -------------------------------------------------------------------------------------------------------
ui <- fixedPage(
ui <- fixedPage(
headerPanel("Expression Explorer"),
......@@ -223,8 +224,13 @@ ui <- fixedPage(
pd <- position_dodge(0.3)
plot_data <- all %>% filter(gene_name %in% input$gene_name & grepl(input$method, method))
# plot_data <- all %>% filter(gene_name %in% c("Gnai3", "Cdc45") & grepl("fpkm", method))
plot_data$condition <- factor(plot_data$condition, levels = input$sample_order)
# The library shinyjqui has changes the data structure of the output in version 0.4.0.
# This hack is to make the script running with the previous and current (v0.4.0) data structures.
sample_order_vector=input$sample_order
if(class(input$sample_order)=='data.frame'){sample_order_vector=as.character(input$sample_order$text)}
plot_data$condition <- factor(plot_data$condition, levels = sample_order_vector)
plot <- ggplot(plot_data, aes(condition, rep_values, color = gene_name)) +
geom_point(position=pd) +
......@@ -268,4 +274,4 @@ ui <- fixedPage(
#runApp(app)
runApp(app, launch.browser=TRUE)
#shinyApp(ui = ui, server = server)
\ No newline at end of file
#shinyApp(ui = ui, server = server)
# conda env create -n expression_explorer -f expression_explorer.yml
name: null
channels:
- ii-bioinfo
- conda-forge
- bioconda
- defaults
dependencies:
- r-base=3.6
- r-shinyjqui=0.4.0
- r-shinyFiles=0.9.0
- r-shiny=1.4.0
- r-plotly=4.9.2.1
- r-dt=0.12
- r-scales=1.1.0
- r-ggplot2=3.2.1
- r-digest=0.6.25
- r-readxl=1.3.1
- r-forcats=0.4.0
- r-readr=1.3.1
- r-stringr=1.4.0
- r-tidyr=1.0.2
- r-magrittr=1.5
- r-dplyr=0.8.4
- r-tibble=2.1.3
- r-purrr=0.3.3
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment