Mercurial > repos > mingchen0919 > elastic_expose_data
comparison list_paired_render.R @ 6:52ecc1cfd205 draft
planemo upload commit 979e0f1c28c74ca7df02ef20c2208e9677bc820a-dirty
author | mingchen0919 |
---|---|
date | Mon, 02 Apr 2018 10:21:30 -0400 |
parents | 4f9f1e76f7e6 |
children |
comparison
equal
deleted
inserted
replaced
5:4f9f1e76f7e6 | 6:52ecc1cfd205 |
---|---|
18 | 18 |
19 #------------------------------------------------ | 19 #------------------------------------------------ |
20 # create three folders within working directory | 20 # create three folders within working directory |
21 dir.create('list_paired') | 21 dir.create('list_paired') |
22 | 22 |
23 job_working_dir = getwd() | |
24 list_paired_path = paste0(job_working_dir, '/list_paired/') | |
25 | |
26 #-----------------render Rmd-------------- | 23 #-----------------render Rmd-------------- |
27 # copy R markdown file to working directory and render it within the working directory. | 24 # copy R markdown file to working directory and render it within the working directory. |
28 render(paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/list_paired.Rmd'), | 25 render(paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/list_paired.Rmd'), |
29 output_file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/report.html')) | 26 output_file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/report.html')) |
30 | 27 |
31 # for some unknow reason, directly using REPORT as the input value for output_file parameter | 28 # for some unknow reason, directly using REPORT as the input value for output_file parameter |
32 # in the render function can cause empty report file when the tool runs in batch mode. | 29 # in the render function can cause empty report file when the tool runs in batch mode. |
33 # the solution is to render the rmarkdown to a explicitly specified file and then copy the | 30 # the solution is to render the rmarkdown to a explicitly specified file and then copy the |
34 # file to ${REPORT} | 31 # file to ${REPORT} |
35 system(command = 'cp ${REPORT_FILES_PATH}/report.html ${REPORT}') | 32 system(command = 'cp ${REPORT_FILES_PATH}/report.html ${REPORT}') |
36 # system(command = 'sh ${REPORT_FILES_PATH}/script.sh') | 33 system(command = 'sh ${REPORT_FILES_PATH}/script.sh') |
37 | 34 |
38 # rename files so that all files have the name pattern BASENAME_forward.EXT and BASENAME_reverse.EXT | 35 # rename files so that all files have the name pattern BASENAME_forward.EXT and BASENAME_reverse.EXT |
39 from_files = list.files('list_paired', full.names = TRUE) | 36 from_files = list.files('list_paired', full.names = TRUE) |
40 to_files = str_replace_all(from_files, c('_1', '_2'), c('_forward', '_reverse')) | 37 to_files = str_replace_all(from_files, c('_1', '_2'), c('_forward', '_reverse')) |
41 file.rename(from = from_files, to = to_files) | 38 file.rename(from = from_files, to = to_files) |