Mercurial > repos > mingchen0919 > dynamic_star
annotate 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 |
| rev | line source |
|---|---|
| 0 | 1 ##============ Sink warnings and errors to a file ============== |
| 2 ## use the sink() function to wrap all code within it. | |
| 3 ##============================================================== | |
| 4 zz = file(Sys.getenv('TOOL_LOG')) | |
| 5 sink(zz) | |
| 6 sink(zz, type = 'message') | |
| 7 | |
| 8 #------------import libraries-------------------- | |
| 9 options(stringsAsFactors = FALSE) | |
| 10 | |
| 11 library(rmarkdown) | |
| 12 #------------------------------------------------ | |
| 13 | |
| 14 #------------------------------------------------ | |
| 15 options_and_arguments = read.table(paste0(Sys.getenv('REPORT_FILES_PATH'), '/options_and_arguments.txt'), | |
| 16 sep = '|', header = TRUE) | |
| 17 | |
| 18 | |
| 19 #-----------------render Rmd-------------- | |
|
2
a9579c344a90
planemo upload commit 8f84e3911c6ff4103c0ad5fb8dd774f80d9b2559
mingchen0919
parents:
0
diff
changeset
|
20 render(paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/dynamic_tool.Rmd'), |
|
a9579c344a90
planemo upload commit 8f84e3911c6ff4103c0ad5fb8dd774f80d9b2559
mingchen0919
parents:
0
diff
changeset
|
21 output_file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/report.html')) |
|
a9579c344a90
planemo upload commit 8f84e3911c6ff4103c0ad5fb8dd774f80d9b2559
mingchen0919
parents:
0
diff
changeset
|
22 |
|
a9579c344a90
planemo upload commit 8f84e3911c6ff4103c0ad5fb8dd774f80d9b2559
mingchen0919
parents:
0
diff
changeset
|
23 # for some unknow reason, directly using REPORT as the input value for output_file parameter |
|
a9579c344a90
planemo upload commit 8f84e3911c6ff4103c0ad5fb8dd774f80d9b2559
mingchen0919
parents:
0
diff
changeset
|
24 # in the render function can cause empty report file when the tool runs in batch mode. |
|
a9579c344a90
planemo upload commit 8f84e3911c6ff4103c0ad5fb8dd774f80d9b2559
mingchen0919
parents:
0
diff
changeset
|
25 # the solution is to render the rmarkdown to a explicitly specified file and then copy the |
|
a9579c344a90
planemo upload commit 8f84e3911c6ff4103c0ad5fb8dd774f80d9b2559
mingchen0919
parents:
0
diff
changeset
|
26 # file to ${REPORT} |
|
a9579c344a90
planemo upload commit 8f84e3911c6ff4103c0ad5fb8dd774f80d9b2559
mingchen0919
parents:
0
diff
changeset
|
27 system(command = 'cp ${REPORT_FILES_PATH}/report.html ${REPORT}') |
| 0 | 28 #------------------------------------------ |
| 29 | |
| 30 | |
| 31 ##--------end of code rendering .Rmd templates---------------- | |
| 32 sink() | |
| 33 ##=========== End of sinking output============================= |
