annotate DESeq_visualization_render.R @ 2:a0d37b034e45 draft

planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
author mingchen0919
date Tue, 08 Aug 2017 10:56:49 -0400
parents 7231d7e8d3ed
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
1 ##======= Handle arguments from command line ========
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
2 # setup R error handline to go to stderr
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
3 options(show.error.messages=FALSE,
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
4 error=function(){
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
5 cat(geterrmessage(), file=stderr())
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
6 quit("no", 1, F)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
7 })
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
8
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
9 # we need that to not crash galaxy with an UTF8 error on German LC settings.
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
10 loc = Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
11
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
12 # suppress warning
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
13 options(warn = -1)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
14
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
15 options(stringsAsFactors=FALSE, useFancyQuotes=FALSE)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
16 args = commandArgs(trailingOnly=TRUE)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
17
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
18 suppressPackageStartupMessages({
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
19 library(getopt)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
20 library(tools)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
21 })
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
22
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
23 # column 1: the long flag name
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
24 # column 2: the short flag alias. A SINGLE character string
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
25 # column 3: argument mask
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
26 # 0: no argument
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
27 # 1: argument required
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
28 # 2: argument is optional
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
29 # column 4: date type to which the flag's argument shall be cast.
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
30 # possible values: logical, integer, double, complex, character.
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
31 spec_list=list()
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
32
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
33 ##------- 1. input data ---------------------
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
34 spec_list$ECHO = c('echo', 'e', '1', 'character')
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
35 spec_list$DESEQ_WORKSPACE = c('deseq_workspace', 'w', '1', 'character')
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
36 spec_list$SAMPLE_TABLE = c('sample_table', 's', '1', 'character')
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
37 spec_list$INTGROUPS_PCA = c('intgroups_pca', 'p', '1', 'character')
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
38 spec_list$INTGROUPS_MDS = c('intgroups_mds', 'm', '1', 'character')
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
39
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
40 ##--------2. output report and report site directory --------------
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
41 spec_list$OUTPUT_HTML = c('deseq_visualization_html', 'o', '1', 'character')
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
42 spec_list$OUTPUT_DIR = c('deseq_visualization_dir', 'd', '1', 'character')
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
43
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
44 ##--------3. Rmd templates sitting in the tool directory ----------
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
45
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
46 spec_list$DESEQ_VISUALIZATION_RMD = c('deseq_visualization_rmd', 'D', '1', 'character')
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
47
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
48
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
49
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
50 ##------------------------------------------------------------------
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
51
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
52 spec = t(as.data.frame(spec_list))
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
53 opt = getopt(spec)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
54 # arguments are accessed by long flag name (the first column in the spec matrix)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
55 # NOT by element name in the spec_list
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
56 # example: opt$help, opt$expression_file
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
57 ##====== End of arguments handling ==========
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
58
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
59 #------ Load libraries ---------
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
60 library(rmarkdown)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
61 library(plyr)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
62 library(stringr)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
63 library(dplyr)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
64 library(highcharter)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
65 library(DT)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
66 library(reshape2)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
67 # library(Kmisc)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
68 library(plotly)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
69 library(formattable)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
70 library(htmltools)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
71
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
72
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
73 #----- 1. create the report directory ------------------------
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
74 system(paste0('mkdir -p ', opt$deseq_visualization_dir))
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
75
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
76
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
77 #----- 2. generate Rmd files with Rmd templates --------------
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
78 # a. templates without placeholder variables:
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
79 # copy templates from tool directory to the working directory.
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
80 # b. templates with placeholder variables:
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
81 # substitute variables with user input values and place them in the working directory.
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
82
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
83
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
84 #----- 01 DESeq_visualization.Rmd -----------------------
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
85 readLines(opt$deseq_visualization_rmd) %>%
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
86 (function(x) {
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
87 gsub('ECHO', opt$echo, x)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
88 }) %>%
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
89 (function(x) {
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
90 gsub('DESEQ_WORKSPACE', opt$deseq_workspace, x)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
91 }) %>%
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
92 (function(x) {
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
93 gsub('INTGROUPS_PCA', opt$intgroups_pca, x)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
94 }) %>%
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
95 (function(x) {
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
96 gsub('INTGROUPS_MDS', opt$intgroups_mds, x)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
97 }) %>%
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
98 (function(x) {
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
99 gsub('OUTPUT_DIR', opt$deseq_visualization_dir, x)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
100 }) %>%
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
101 (function(x) {
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
102 fileConn = file('DESeq_visualization.Rmd')
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
103 writeLines(x, con=fileConn)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
104 close(fileConn)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
105 })
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
106
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
107
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
108 #------ 3. render all Rmd files --------
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
109 render('DESeq_visualization.Rmd', output_file = opt$deseq_visualization_html)
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
110
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
111
7231d7e8d3ed planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff changeset
112 #-------4. manipulate outputs -----------------------------