Mercurial > repos > mingchen0919 > statonlab_interprocan
comparison interproscan_render.R @ 1:035457a30aea draft
update
| author | mingchen0919 |
|---|---|
| date | Tue, 03 Apr 2018 15:02:39 -0400 |
| parents | 59d780043157 |
| children |
comparison
equal
deleted
inserted
replaced
| 0:59d780043157 | 1:035457a30aea |
|---|---|
| 8 #------------import libraries-------------------- | 8 #------------import libraries-------------------- |
| 9 options(stringsAsFactors = FALSE) | 9 options(stringsAsFactors = FALSE) |
| 10 | 10 |
| 11 library(getopt) | 11 library(getopt) |
| 12 library(rmarkdown) | 12 library(rmarkdown) |
| 13 library(htmltools) | |
| 13 #------------------------------------------------ | 14 #------------------------------------------------ |
| 14 | 15 |
| 15 | 16 |
| 16 #------------get arguments into R-------------------- | 17 #------------get arguments into R-------------------- |
| 17 # load helper function | 18 # load helper function |
| 18 source(paste0(Sys.getenv('TOOL_DIR'), '/helper.R')) | 19 source(paste0(Sys.getenv('TOOL_DIR'), '/helper.R')) |
| 19 # import getopt specification matrix from a csv file | 20 # import getopt specification matrix from a csv file |
| 20 opt = getopt(getopt_specification_matrix(specification_file = 'getopt_specification.csv', | 21 opt = getopt(getopt_specification_matrix(specification_file = '/getopt_specification.csv', |
| 21 tool_dir = Sys.getenv('TOOL_DIR'))) | 22 tool_dir = Sys.getenv('TOOL_DIR'))) |
| 22 opt$X_t = Sys.getenv('TOOL_DIR') | 23 opt$X_t = Sys.getenv('TOOL_DIR') |
| 23 #---------------------------------------------------- | 24 #---------------------------------------------------- |
| 24 | 25 |
| 25 | 26 |
| 43 # for some unknow reason, directly using REPORT as the input value for output_file parameter | 44 # for some unknow reason, directly using REPORT as the input value for output_file parameter |
| 44 # in the render function can cause empty report file when the tool runs in batch mode. | 45 # in the render function can cause empty report file when the tool runs in batch mode. |
| 45 # the solution is to render the rmarkdown to a explicitly specified file and then copy the | 46 # the solution is to render the rmarkdown to a explicitly specified file and then copy the |
| 46 # file to ${REPORT} | 47 # file to ${REPORT} |
| 47 render(paste0(TOOL_DIR, '/', RMD_NAME), | 48 render(paste0(TOOL_DIR, '/', RMD_NAME), |
| 48 output_file = paste0(Sys.getenv('OUTPUT_DIR'), '/report.html')) | 49 output_file = paste0(OUTPUT_DIR, '/report.html')) |
| 49 system(command = 'cp ${OUTPUT_DIR}/report.html ${OUTPUT_REPORT}') | 50 system(command = 'cp ${X_d}/report.html ${X_o}') |
| 50 #------------------------------------------ | 51 #------------------------------------------ |
| 51 | 52 |
| 52 #==============the end============== | 53 #==============the end============== |
| 53 | 54 |
| 54 | 55 |
