diff collection_list_render.R @ 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 e43cbef7ba64
line wrap: on
line diff
--- 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)