# HG changeset patch # User mingchen0919 # Date 1522674977 14400 # Node ID 4f9f1e76f7e6ed7cf02f049264d035edcf744ac1 # Parent 9ff33a3631fa7bc59b653eeab22912eb05f53215 planemo upload commit 979e0f1c28c74ca7df02ef20c2208e9677bc820a-dirty diff -r 9ff33a3631fa -r 4f9f1e76f7e6 individuals.Rmd --- a/individuals.Rmd Mon Apr 02 08:32:59 2018 -0400 +++ b/individuals.Rmd Mon Apr 02 09:16:17 2018 -0400 @@ -44,7 +44,6 @@ if (file.exists(full_path)) { # to_files = list.files(full_path) to_file = tail(strsplit(full_path, '/')[[1]], 1) - print(to_file) file.copy(from = full_path, to = paste0(individual_outputs_path, to_file)) } # command_line = paste0('cp -r ', full_path, ' paired') diff -r 9ff33a3631fa -r 4f9f1e76f7e6 list.Rmd --- a/list.Rmd Mon Apr 02 08:32:59 2018 -0400 +++ b/list.Rmd Mon Apr 02 09:16:17 2018 -0400 @@ -30,14 +30,25 @@ ``` ```{r, echo=FALSE} -write('', file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/script.sh')) +# write('', file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/script.sh')) if (nrow(df) > 0) { for (i in 1:nrow(df)) { tool_output_dir = readLines(df[i, 'tool_output_dir'])[1] full_path = paste0(tool_output_dir, '/', df[i, 'relative_path']) - command_line = paste0('cp -r ', full_path, ' list') - write(command_line, append = TRUE, - file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/script.sh')) + if (dir.exists(full_path)) { + from_files = list.files(full_path, full.names = TRUE) + to_files = list.files(full_path) + to_files = paste0(list_path, to_files) + file.copy(from = from_files, to = to_files) + } + if (file.exists(full_path)) { + # to_files = list.files(full_path) + to_file = tail(strsplit(full_path, '/')[[1]], 1) + file.copy(from = full_path, to = paste0(list_path, to_file)) + } + # command_line = paste0('cp -r ', full_path, ' paired') + # write(command_line, append = TRUE, + # file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/script.sh')) } } ``` diff -r 9ff33a3631fa -r 4f9f1e76f7e6 list_paired.Rmd --- a/list_paired.Rmd Mon Apr 02 08:32:59 2018 -0400 +++ b/list_paired.Rmd Mon Apr 02 09:16:17 2018 -0400 @@ -30,14 +30,25 @@ ``` ```{r, echo=FALSE} -write('', file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/script.sh')) +# write('', file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/script.sh')) if (nrow(df) > 0) { for (i in 1:nrow(df)) { tool_output_dir = readLines(df[i, 'tool_output_dir'])[1] full_path = paste0(tool_output_dir, '/', df[i, 'relative_path']) - command_line = paste0('cp -r ', full_path, ' list_paired') - write(command_line, append = TRUE, - file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/script.sh')) + if (dir.exists(full_path)) { + from_files = list.files(full_path, full.names = TRUE) + to_files = list.files(full_path) + to_files = paste0(list_paired_path, to_files) + file.copy(from = from_files, to = to_files) + } + if (file.exists(full_path)) { + # to_files = list.files(full_path) + to_file = tail(strsplit(full_path, '/')[[1]], 1) + file.copy(from = full_path, to = paste0(list_paired_path, to_file)) + } + # command_line = paste0('cp -r ', full_path, ' paired') + # write(command_line, append = TRUE, + # file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/script.sh')) } } ``` diff -r 9ff33a3631fa -r 4f9f1e76f7e6 list_paired_render.R --- a/list_paired_render.R Mon Apr 02 08:32:59 2018 -0400 +++ b/list_paired_render.R Mon Apr 02 09:16:17 2018 -0400 @@ -20,6 +20,9 @@ # create three folders within working directory dir.create('list_paired') +job_working_dir = getwd() +list_paired_path = paste0(job_working_dir, '/list_paired/') + #-----------------render Rmd-------------- # copy R markdown file to working directory and render it within the working directory. render(paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/list_paired.Rmd'), @@ -30,7 +33,7 @@ # 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}') -system(command = 'sh ${REPORT_FILES_PATH}/script.sh') +# system(command = 'sh ${REPORT_FILES_PATH}/script.sh') # rename files so that all files have the name pattern BASENAME_forward.EXT and BASENAME_reverse.EXT from_files = list.files('list_paired', full.names = TRUE) diff -r 9ff33a3631fa -r 4f9f1e76f7e6 list_render.R --- a/list_render.R Mon Apr 02 08:32:59 2018 -0400 +++ b/list_render.R Mon Apr 02 09:16:17 2018 -0400 @@ -19,6 +19,9 @@ # create three folders within working directory dir.create('list') +job_working_dir = getwd() +list_path = paste0(job_working_dir, '/list/') + #-----------------render Rmd-------------- # copy R markdown file to working directory and render it within the working directory. render(paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/list.Rmd'), @@ -29,7 +32,7 @@ # 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}') -system(command = 'sh ${REPORT_FILES_PATH}/script.sh') +# system(command = 'sh ${REPORT_FILES_PATH}/script.sh') #------------------------------------------