Mercurial > repos > mingchen0919 > aurora_deseq2
annotate deseq2_render.R @ 9:f8c7138cfc35 draft
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
author | mingchen0919 |
---|---|
date | Thu, 26 Apr 2018 11:47:37 -0400 |
parents | 32ed0a8df05c |
children |
rev | line source |
---|---|
2 | 1 ##============ Sink warnings and errors to a file ============== |
2 ## use the sink() function to wrap all code within it. | |
3 ##============================================================== | |
9
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
4 zz = file(paste0(Sys.getenv('REPORT_FILES_PATH'), '/.r_rendering.log.txt')) |
2 | 5 sink(zz) |
6 sink(zz, type = 'message') | |
7 | |
9
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
8 #============== preparation ==================================== |
2 | 9 options(stringsAsFactors = FALSE) |
9
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
10 # import libraries |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
11 #------------------------------------------------------------------ |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
12 # ADD MORE LIBRARIES HERE IF YOUR TOOL DEPENDS ON OTHER R LIBRARIES |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
13 #------------------------------------------------------------------ |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
14 library('getopt') |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
15 library('rmarkdown') |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
16 library('htmltools') |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
17 library('ggplot2') |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
18 library('plotly') |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
19 library('DESeq2') |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
20 library('pheatmap') |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
21 library('DT') |
2 | 22 |
9
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
23 # load helper functions |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
24 source(paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/helper.R')) |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
25 # import getopt specification matrix from a csv file |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
26 opt = getopt(getopt_specification_matrix('getopt_specification.csv', |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
27 tool_dir=Sys.getenv('TOOL_INSTALL_DIR'))) |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
28 # define environment variables for all input values. this is useful when we |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
29 # want to use input values by other programming language in r markdown |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
30 do.call(Sys.setenv, opt[-1]) |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
31 #=============================================================== |
2 | 32 |
33 | |
9
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
34 #======================== render Rmd files ========================= |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
35 # NOTICE: |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
36 # we should copy all rmarkdown files from tool install directory to REPORT_FILES_PATH directory. |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
37 # and render rmarkdown files in the REPORT_FILES_PATH directory. |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
38 file.copy(from = paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/vakata-jstree-3.3.5'), |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
39 to = Sys.getenv('REPORT_FILES_PATH'), recursive = TRUE) |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
40 system(command = 'cp -r ${TOOL_INSTALL_DIR}/*.Rmd ${REPORT_FILES_PATH}') |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
41 |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
42 #----------------BELOW IS WHERE YOU NEED TO CUSTOMIZE --------------------- |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
43 render(input = paste0(Sys.getenv('REPORT_FILES_PATH'), '/deseq2.Rmd')) |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
44 # add more lines below if there are more Rmd files to be rendered |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
45 |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
46 #=============================================================== |
2 | 47 |
48 | |
9
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
49 #============== expose outputs to galaxy history =============== |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
50 system(command = 'sh ${TOOL_INSTALL_DIR}/expose-outputs.sh') |
f8c7138cfc35
planemo upload commit 92144072ce2bd29bf437bde994b9700e03d79f1b-dirty
mingchen0919
parents:
8
diff
changeset
|
51 #=============================================================== |
2 | 52 |
53 | |
54 ##--------end of code rendering .Rmd templates---------------- | |
55 sink() | |
56 ##=========== End of sinking output============================= |