annotate htseq_count_render.R @ 7:63cde8d7f89c draft

remove kableextra package
author mingchen0919
date Wed, 18 Apr 2018 16:11:31 -0400
parents 7c54fd452b8e
children 1696f5ee0fe7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
1 ##============ Sink warnings and errors to a file ==============
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
2 ## use the sink() function to wrap all code within it.
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
3 ##==============================================================
5
mingchen0919
parents: 4
diff changeset
4 zz = file(paste0(Sys.getenv('REPORT_FILES_PATH'), '/.r_rendering.log.txt'))
0
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
5 sink(zz)
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
6 sink(zz, type = 'message')
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
7
5
mingchen0919
parents: 4
diff changeset
8 #-------------------preparation -----------------
0
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
9 options(stringsAsFactors = FALSE)
5
mingchen0919
parents: 4
diff changeset
10 # import libraries
0
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
11 library(getopt)
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
12 library(rmarkdown)
2
db9da9716914 add r-dt
mingchen0919
parents: 1
diff changeset
13 library(htmltools)
6
7c54fd452b8e add kableExtra package
mingchen0919
parents: 5
diff changeset
14 library(kableExtra)
7c54fd452b8e add kableExtra package
mingchen0919
parents: 5
diff changeset
15 library(magrittr)
5
mingchen0919
parents: 4
diff changeset
16 # load helper functions
mingchen0919
parents: 4
diff changeset
17 source(paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/helper.R'))
mingchen0919
parents: 4
diff changeset
18 # import getopt specification matrix from a csv file
mingchen0919
parents: 4
diff changeset
19 opt = getopt(getopt_specification_matrix('getopt_specification.csv',
mingchen0919
parents: 4
diff changeset
20 tool_dir=Sys.getenv('TOOL_INSTALL_DIR')))
mingchen0919
parents: 4
diff changeset
21 # define a unix variable versions for all input values. this is useful when we
mingchen0919
parents: 4
diff changeset
22 # want to use input values by other programming language in r markdown
mingchen0919
parents: 4
diff changeset
23 do.call(Sys.setenv, opt[-1])
0
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
24 #------------------------------------------------
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
25
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
26
5
mingchen0919
parents: 4
diff changeset
27 #-----------------render Rmd files --------------
mingchen0919
parents: 4
diff changeset
28 # NOTICE:
mingchen0919
parents: 4
diff changeset
29 # we should copy all rmarkdown files from tool install directory to REPORT_FILES_PATH directory.
mingchen0919
parents: 4
diff changeset
30 # and render rmarkdown files in the REPORT_FILES_PATH directory.
mingchen0919
parents: 4
diff changeset
31 file.copy(from = paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/vakata-jstree-3.3.5'),
mingchen0919
parents: 4
diff changeset
32 to = Sys.getenv('REPORT_FILES_PATH'), recursive = TRUE)
mingchen0919
parents: 4
diff changeset
33 system(command = 'cp -r ${TOOL_INSTALL_DIR}/*.Rmd ${REPORT_FILES_PATH}')
mingchen0919
parents: 4
diff changeset
34 # render Rmd files in order
mingchen0919
parents: 4
diff changeset
35 render(input = paste0(Sys.getenv('REPORT_FILES_PATH'), '/htseq_count.Rmd'))
mingchen0919
parents: 4
diff changeset
36 # add more lines below if there are more Rmd files to be rendered
mingchen0919
parents: 4
diff changeset
37
mingchen0919
parents: 4
diff changeset
38 #------------------------------------------
0
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
39
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
40
5
mingchen0919
parents: 4
diff changeset
41 #---------------- copy the output html to REPORT ----
mingchen0919
parents: 4
diff changeset
42 system(command = 'cp ${REPORT_FILES_PATH}/htseq_count.html ${REPORT}')
mingchen0919
parents: 4
diff changeset
43 # add more lines below if there are more output html files
0
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
44
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
45 #==============the end==============
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
46
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
47
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
48 ##--------end of code rendering .Rmd templates----------------
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
49 sink()
10a460f61ac2 planemo upload
mingchen0919
parents:
diff changeset
50 ##=========== End of sinking output=============================