annotate rmarkdown_report_render.R @ 2:e08dd15646c6 draft

planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1-dirty
author mingchen0919
date Thu, 13 Dec 2018 23:45:31 -0500
parents 803f4888f36a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
1 ##============ Sink warnings and errors to a file ==============
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
2 ## use the sink() function to wrap all code within it.
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
3 ##==============================================================
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
4 zz = file(paste0(Sys.getenv('REPORT_FILES_PATH'), '/.r_rendering.log.txt'))
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
5 sink(zz)
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
6 sink(zz, type = 'message')
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
7
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
8 #============== preparation ====================================
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
9 # import libraries
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
10 #------------------------------------------------------------------
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
11 # ADD MORE LIBRARIES HERE IF YOUR TOOL DEPENDS ON OTHER R LIBRARIES
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
12 #------------------------------------------------------------------
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
13 library('getopt')
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
14 library('rmarkdown')
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
15 library('htmltools')
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
16 library(knitr)
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
17 #------------------------------------------------------------------
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
18 options(stringsAsFactors = FALSE)
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
19
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
20
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
21 # define two helper functions
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
22 #-----: helper function 1
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
23 #' \code{getopt_specification_matrix} returns a getopt specification matrix.
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
24 #'
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
25 #' @param specification_file a cvs file within the \code{galaxy_tool_directory} which stores getopt specification matrix data.
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
26 #' The first column are short flags, the second column are argument masks, the third column
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
27 #' is data types. The fourth column are variable names used in the tool XML. These three columns are required.
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
28 #' @param gtg_name the name of a running GTG.
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
29 getopt_specification_matrix = function(specification_file,
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
30 gtg_name = 'gtg',
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
31 tool_dir = Sys.getenv('TOOL_INSTALL_DIR')) {
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
32 df = read.csv(
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
33 paste0(tool_dir, '/', specification_file),
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
34 header = TRUE,
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
35 stringsAsFactors = FALSE
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
36 )
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
37 # check if there are duplicated short flags
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
38 short_flags = df[, 1]
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
39 if (length(unique(short_flags)) < length(short_flags)) {
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
40 cat('----Duplicated short flags found ----\n')
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
41 cat('short flags: ', df[, 1][duplicated(df[, 1])], '\n')
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
42 stop('Duplicated short flags are not allowed.')
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
43 }
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
44
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
45 # use short flags to generate long flags
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
46 long_flags = paste0('X_', df[, 1])
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
47
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
48 # specification matrix
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
49 df2 = data.frame(
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
50 long_flags = long_flags,
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
51 short_flags = df[, 1],
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
52 argument_mask = df[, 2],
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
53 data_type = df[, 3]
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
54 )
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
55
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
56 as.matrix(df2)
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
57 }
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
58
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
59 #-----: helper function 2
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
60 #' \code{file_tree} generate file tree of a directory in the format of HTML lists.
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
61 #'
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
62 #' @param dir the path to the directory for generating the file tree.
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
63 #' @param output_dir the REPORT_FILES_PATH folder name, which has the name style: dataset_NUMBER_files.
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
64 # define a recursive function to build html string of the file tree
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
65 file_tree = function(dir = '.') {
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
66 # get the OUTPUT_DIR folder data: dataset_NUMBER_files
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
67 report_files_path = Sys.getenv('REPORT_FILES_PATH')
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
68 output_dir = tail(strsplit(report_files_path, '/')[[1]], 1)
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
69
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
70 files = list.files(path = dir,
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
71 recursive = FALSE,
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
72 full.names = TRUE)
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
73 # files also include directorys, need to remove directorys
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
74 files = files[!dir.exists(files)]
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
75 dirs = list.dirs(path = dir,
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
76 recursive = FALSE,
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
77 full.names = TRUE)
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
78 tags$ul({
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
79 if (length(files) > 0) {
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
80 lapply(files, function(x) {
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
81 path_end = tail(strsplit(x, '/')[[1]], 1)
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
82 href_path = strsplit(x, paste0(output_dir, '/'))[[1]][2]
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
83 li_item = tags$li(tags$a(path_end, href = href_path))
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
84 li_item$attribs = list('data-jstree' = '{"icon":"jstree-file"}')
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
85 li_item
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
86 })
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
87 }
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
88 },
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
89 {
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
90 if (length(dirs) > 0) {
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
91 lapply(dirs, function(x) {
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
92 path_end = tail(strsplit(x, '/')[[1]], 1)
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
93 # hide vakata-jstree-3.3.5 folder
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
94 if (!(path_end %in% c('vakata-jstree-3.3.5', 'rmarkdown_report_files', 'site_libs'))) {
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
95 # x_path = strsplit(x, paste0(output_dir, '/'))[[1]][2]
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
96 li_item = tags$li(path_end, file_tree(x))
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
97 li_item$attribs = list('data-jstree' = '{"icon":"jstree-folder"}')
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
98 li_item
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
99 }
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
100 })
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
101 }
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
102 })
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
103 }
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
104 #----------------- end of help functions -------------------------
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
105
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
106
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
107 # import getopt specification matrix from a csv file
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
108 opt = getopt(getopt_specification_matrix('command-line-arguments.csv',
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
109 tool_dir = Sys.getenv('TOOL_INSTALL_DIR')))
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
110 # define environment variables for all input values. this is useful when we
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
111 # want to use input values by other programming language in r markdown
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
112 do.call(Sys.setenv, opt[-1])
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
113 #===============================================================
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
114
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
115
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
116 #======================== render Rmd files =========================
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
117 # copy jstree javascript library to tool output directory
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
118 file.copy(
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
119 from = paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/vakata-jstree-3.3.5'),
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
120 to = Sys.getenv('REPORT_FILES_PATH'),
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
121 recursive = TRUE
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
122 )
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
123
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
124 # if '_site.yml' file exists, this tool is assumed to render a website.
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
125 # otherwise, it renders a single html.
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
126 if (file.exists(paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/_site.yml'))) {
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
127 # render a website
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
128 system(command = 'cp -r ${TOOL_INSTALL_DIR}/*.Rmd ${REPORT_FILES_PATH}')
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
129 system(command = 'cp -r ${TOOL_INSTALL_DIR}/_site.yml ${REPORT_FILES_PATH}')
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
130 render_site(input = Sys.getenv('REPORT_FILES_PATH'))
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
131 } else {
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
132 # render a single html
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
133 system(command = 'cp -r ${TOOL_INSTALL_DIR}/rmarkdown_report.Rmd ${REPORT_FILES_PATH}')
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
134 # add a few lines to 'rmarkdown_report.Rmd' to generate file tree outputs
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
135 jstree_lines = '
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
136 ## Outputs
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
137
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
138 ```{r, echo=FALSE}
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
139 tags$div(id="jstree", file_tree(Sys.getenv(\'REPORT_FILES_PATH\')))
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
140 ```'
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
141 write(
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
142 x = jstree_lines,
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
143 append = TRUE,
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
144 file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/rmarkdown_report.Rmd')
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
145 )
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
146 render(input = paste0(Sys.getenv('REPORT_FILES_PATH'), '/rmarkdown_report.Rmd'))
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
147 }
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
148 #===============================================================
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
149
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
150
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
151 #============== expose outputs to galaxy history ===============
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
152 system(command = 'sh ${TOOL_INSTALL_DIR}/expose-outputs-to-galaxy-history.sh')
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
153 #===============================================================
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
154
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
155
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
156 ##--------end of code rendering .Rmd templates----------------
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
157 sink()
803f4888f36a planemo upload commit 004a320fc0619c234164b44c64ba5dce205734e1
mingchen0919
parents:
diff changeset
158 ##=========== End of sinking output=============================