From 11a1e15037ae86982efdac04d554c6b01066af72 Mon Sep 17 00:00:00 2001
From: Dominik <dominik.brilhaus@hhu.de>
Date: Thu, 24 Mar 2022 14:08:31 +0100
Subject: [PATCH] wrapped in workflow, moved outputs

---
 .../05_plotshinyPrep/05_plot_shinyPrep.R      | 16 ----------
 workflows/05_plotshinyPrep/plot_shinyPrep.cwl | 31 -------------------
 workflows/05_plotshinyPrep/plot_shinyPrep.yml |  6 ----
 .../{ => kallisto_sleuth}/01_KallistoQuant.sh |  0
 .../02_InstallPackages.R                      |  0
 .../03_KallistoCollect.R                      |  0
 workflows/{ => kallisto_sleuth}/04_Sleuth.R   |  0
 .../{ => kallisto_sleuth}/05_plot_shinyPrep.R |  0
 ..._wrapper.sh => kallisto_sleuth_wrapper.sh} | 18 ++++++-----
 ...06_plot_shinyApp.Rmd => plot_shinyApp.Rmd} | 11 +++----
 10 files changed, 15 insertions(+), 67 deletions(-)
 delete mode 100644 workflows/05_plotshinyPrep/05_plot_shinyPrep.R
 delete mode 100644 workflows/05_plotshinyPrep/plot_shinyPrep.cwl
 delete mode 100644 workflows/05_plotshinyPrep/plot_shinyPrep.yml
 rename workflows/{ => kallisto_sleuth}/01_KallistoQuant.sh (100%)
 rename workflows/{ => kallisto_sleuth}/02_InstallPackages.R (100%)
 rename workflows/{ => kallisto_sleuth}/03_KallistoCollect.R (100%)
 rename workflows/{ => kallisto_sleuth}/04_Sleuth.R (100%)
 rename workflows/{ => kallisto_sleuth}/05_plot_shinyPrep.R (100%)
 rename workflows/{_workflow_wrapper.sh => kallisto_sleuth_wrapper.sh} (50%)
 rename workflows/{06_plot_shinyApp.Rmd => plot_shinyApp.Rmd} (85%)

diff --git a/workflows/05_plotshinyPrep/05_plot_shinyPrep.R b/workflows/05_plotshinyPrep/05_plot_shinyPrep.R
deleted file mode 100644
index 664bf39..0000000
--- a/workflows/05_plotshinyPrep/05_plot_shinyPrep.R
+++ /dev/null
@@ -1,16 +0,0 @@
-
-########################
-# Prep data for shiny app
-########################
-
-
-install.packages("openxlsx",dependencies=TRUE, lib='./lib',repos='http://cran.rstudio.com/')
-library(openxlsx, lib.loc = "./lib")
-
-options <- commandArgs(trailingOnly = TRUE)
-wd <- getwd()
-
-expression_data <- read.csv(file = options[1])
-available_genes <- unique(expression_data$target_id)
-
-save(expression_data, available_genes, file = paste0(wd, "/05_shinyPrep.RData"))
diff --git a/workflows/05_plotshinyPrep/plot_shinyPrep.cwl b/workflows/05_plotshinyPrep/plot_shinyPrep.cwl
deleted file mode 100644
index 04ffba6..0000000
--- a/workflows/05_plotshinyPrep/plot_shinyPrep.cwl
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env cwl-runner
-
-cwlVersion: v1.2
-class: CommandLineTool
-hints:
-  DockerRequirement:
-    dockerPull: rocker/tidyverse:4.1
-requirements:
-  - class: NetworkAccess
-    networkAccess: true  
-  - class: InlineJavascriptRequirement
-  - class: InitialWorkDirRequirement
-    listing:
-      - entry: "$({class: 'Directory', listing: []})"
-        entryname: "./lib"
-        writable: true
-baseCommand: Rscript
-inputs:
-  rScript:
-    type: File
-    inputBinding:
-      position: 1
-  kallistoResults:
-    type: File
-    inputBinding:
-      position: 2
-outputs:
-  outFile:
-    type: File
-    outputBinding:
-      glob: "*05_shinyPrep.RData"
\ No newline at end of file
diff --git a/workflows/05_plotshinyPrep/plot_shinyPrep.yml b/workflows/05_plotshinyPrep/plot_shinyPrep.yml
deleted file mode 100644
index 426ca84..0000000
--- a/workflows/05_plotshinyPrep/plot_shinyPrep.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-rScript:
-  class: File
-  path: ./05_plot_shinyPrep.R
-kallistoResults:
-  class: File
-  path: ./../../runs/run1/03_kallisto_df.csv
\ No newline at end of file
diff --git a/workflows/01_KallistoQuant.sh b/workflows/kallisto_sleuth/01_KallistoQuant.sh
similarity index 100%
rename from workflows/01_KallistoQuant.sh
rename to workflows/kallisto_sleuth/01_KallistoQuant.sh
diff --git a/workflows/02_InstallPackages.R b/workflows/kallisto_sleuth/02_InstallPackages.R
similarity index 100%
rename from workflows/02_InstallPackages.R
rename to workflows/kallisto_sleuth/02_InstallPackages.R
diff --git a/workflows/03_KallistoCollect.R b/workflows/kallisto_sleuth/03_KallistoCollect.R
similarity index 100%
rename from workflows/03_KallistoCollect.R
rename to workflows/kallisto_sleuth/03_KallistoCollect.R
diff --git a/workflows/04_Sleuth.R b/workflows/kallisto_sleuth/04_Sleuth.R
similarity index 100%
rename from workflows/04_Sleuth.R
rename to workflows/kallisto_sleuth/04_Sleuth.R
diff --git a/workflows/05_plot_shinyPrep.R b/workflows/kallisto_sleuth/05_plot_shinyPrep.R
similarity index 100%
rename from workflows/05_plot_shinyPrep.R
rename to workflows/kallisto_sleuth/05_plot_shinyPrep.R
diff --git a/workflows/_workflow_wrapper.sh b/workflows/kallisto_sleuth_wrapper.sh
similarity index 50%
rename from workflows/_workflow_wrapper.sh
rename to workflows/kallisto_sleuth_wrapper.sh
index f34687e..d0bbe31 100755
--- a/workflows/_workflow_wrapper.sh
+++ b/workflows/kallisto_sleuth_wrapper.sh
@@ -6,20 +6,22 @@
 
 # This is supposed to wrap the workflow from kallisto quantification to sleuth diff gene expression
 # Execute within <ARC root>/workflows: 
-## change rights: `chmod a+x _workflow_wrapper.sh`
-## execute script: `./_workflow_wrapper.sh <run_name> <arc_root>`
-## Example: ./_workflow_wrapper.sh "run1" "~/03DataPLANT_gitlab/samplearc_rnaseq/"
+## change rights: `chmod a+x kallisto_sleuth_wrapper.sh`
+## execute script: `./kallisto_sleuth_wrapper.sh <run_name> <arc_root>`
+## Example: ./kallisto_sleuth_wrapper.sh "run2" "~/03DataPLANT_gitlab/samplearc_rnaseq/"
 
-run_name=$1
+run_name='kallisto_sleuth/'$1
 arc_root=$2
 
+mkdir $arc_root'/workflows/'$run_name
+
 # chmod a+x 01_KallistoQuant.sh 
 # ./01_KallistoQuant.sh $run_name $arc_root
 
-Rscript 02_InstallPackages.R
-Rscript 03_KallistoCollect.R $run_name $arc_root
-Rscript 04_Sleuth.R $run_name $arc_root
-Rscript 05_plot_shinyPrep.R $run_name $arc_root
+# Rscript 02_InstallPackages.R
+# Rscript 03_KallistoCollect.R $run_name $arc_root
+# Rscript 04_Sleuth.R $run_name $arc_root
+# Rscript 05_plot_shinyPrep.R $run_name $arc_root
 
 # store variables for test runs in R
 # run_name="run1"
diff --git a/workflows/06_plot_shinyApp.Rmd b/workflows/plot_shinyApp.Rmd
similarity index 85%
rename from workflows/06_plot_shinyApp.Rmd
rename to workflows/plot_shinyApp.Rmd
index 09b641d..19b2916 100644
--- a/workflows/06_plot_shinyApp.Rmd
+++ b/workflows/plot_shinyApp.Rmd
@@ -14,8 +14,7 @@ knitr::opts_chunk$set(echo = TRUE)
 
 # Load data
 
-ARC_root="~/03_DataPLANT_gitlab/samplearc_rnaseq/"
-load(file = paste0(ARC_root, 'runs/05_shinyPrep.RData'))
+load(file = "../runs/run1/05_shinyPrep.RData")
 
 ```
 
@@ -24,9 +23,9 @@ load(file = paste0(ARC_root, 'runs/05_shinyPrep.RData'))
 
 # Setup plot environment 
 
-required.packages <- c('knitr', 'kableExtra', ## RMarkdown, 
+required.packages <- c('kableExtra', ## RMarkdown, 
                       "shiny", "tidyverse", ## data loading and shaping
-                       "RColorBrewer", "shiny" ## plotting
+                       "RColorBrewer" ## plotting
                        )
 
 for(package in required.packages)
@@ -51,7 +50,7 @@ current_selection <- sample(expression_data$target_id, 10)
 
 plot_set <- subset(expression_data, target_id %in% current_selection)
 
-ggplot(plot_set, aes(x = Group, y = tpm, group = Group)) + 
+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") + 
@@ -87,7 +86,7 @@ sidebarLayout(
       
       ## Facetted by gene only
       
-      ggplot(plot_set, aes(x = Group, y = tpm)) + 
+      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") + 
-- 
GitLab