Mercurial > repos > mingchen0919 > rmarkdown_collection_builder
changeset 1:f85a6bcf940e draft
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_collection_builder commit fecb83fd1c7b99c3672a61222f3822637eff2571-dirty
author | mingchen0919 |
---|---|
date | Mon, 25 Sep 2017 14:03:44 -0400 |
parents | 87c21e14f221 |
children | f8d0ad99fe9b |
files | collection_list.Rmd collection_list.xml collection_list_render.R |
diffstat | 3 files changed, 23 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/collection_list.Rmd Mon Sep 25 12:15:23 2017 -0400 +++ b/collection_list.Rmd Mon Sep 25 14:03:44 2017 -0400 @@ -17,3 +17,13 @@ ```{r} str(opt) ``` + + +```{bash 'copy data to working directory', echo=FALSE} +mkdir files_directory +# Copy uploaded data to the working directory +for f in $(echo FILE_LIST | sed "s/,/ /g") +do + cp $f ./files_directory +done +``` \ No newline at end of file
--- a/collection_list.xml Mon Sep 25 12:15:23 2017 -0400 +++ b/collection_list.xml Mon Sep 25 14:03:44 2017 -0400 @@ -16,6 +16,7 @@ -r $report -o $list_collection + -d $list_collection.files_path -t '${__tool_directory__}/collection_list.Rmd' ]]> @@ -26,6 +27,8 @@ </inputs> <outputs> <data format="html" name="report" label="fastqc report" /> - <collection type="list" name="list_collection" /> + <collection type="list" name="list_collection"> + <discover_datasets pattern="(?P<name>.*)" directory="files_directory" /> + </collection> </outputs> </tool> \ No newline at end of file
--- a/collection_list_render.R Mon Sep 25 12:15:23 2017 -0400 +++ b/collection_list_render.R Mon Sep 25 14:03:44 2017 -0400 @@ -30,11 +30,12 @@ # possible values: logical, integer, double, complex, character. ##------- 1. input data --------------------- spec_list=list() -spec_list$READS = c('file_list', 'l', '1', 'character') +spec_list$FILE_LIST = c('file_list', 'l', '1', 'character') spec_list$ECHO = c('echo', 'e', '1', 'character') ##--------2. output report and outputs -------------- spec_list$LIST_COLLECTION = c('list_collection', 'o', '1', 'character') spec_list$REPORT = c('report', 'r', '1', 'character') +spec_list$OUTPUT_DIR = c('list_collection_dir', 'd', '1', 'character') ##--------3. Rmd templates in the tool directory ---------- spec_list$LIST_COLLECTION_RMD = c('list_collection_rmd', 't', '1', 'character') @@ -47,7 +48,7 @@ library(htmltools) #----- 1. create the report directory ------------------------ -# this tool does not require an report directory +system(paste0('mkdir -p ', opt$list_collection_dir)) #----- 2. generate Rmd files with Rmd templates -------------- # a. templates without placeholder variables: @@ -61,6 +62,12 @@ gsub('ECHO', opt$echo, x) }) %>% (function(x) { + gsub('FILE_LIST', opt$file_list, x) + }) %>% + (function(x) { + gsub('OUTPUT_DIR', opt$list_collection_dir, x) + }) %>% + (function(x) { fileConn = file('list_collection.Rmd') writeLines(x, con=fileConn) close(fileConn)