diff dynamic_tool_render.R @ 2:a9579c344a90 draft default tip

planemo upload commit 8f84e3911c6ff4103c0ad5fb8dd774f80d9b2559
author mingchen0919
date Fri, 23 Mar 2018 21:50:16 -0400
parents d79569f269c7
children
line wrap: on
line diff
--- a/dynamic_tool_render.R	Fri Mar 23 02:01:52 2018 -0400
+++ b/dynamic_tool_render.R	Fri Mar 23 21:50:16 2018 -0400
@@ -8,7 +8,6 @@
 #------------import libraries--------------------
 options(stringsAsFactors = FALSE)
 
-library(getopt)
 library(rmarkdown)
 #------------------------------------------------
 
@@ -18,8 +17,14 @@
 
 
 #-----------------render Rmd--------------
-render(paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/dynamic_tool.Rmd'), 
-       output_file = Sys.getenv('REPORT'))
+render(paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/dynamic_tool.Rmd'),
+       output_file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/report.html'))
+
+# for some unknow reason, directly using REPORT as the input value for output_file parameter
+# in the render function can cause empty report file when the tool runs in batch mode.
+# the solution is to render the rmarkdown to a explicitly specified file and then copy the
+# file to ${REPORT}
+system(command = 'cp ${REPORT_FILES_PATH}/report.html ${REPORT}')
 #------------------------------------------