# HG changeset patch
# User mingchen0919
# Date 1506370792 14400
# Node ID 6be61cb4a1d5387df1ef10b0c99b9158e9197263
# Parent 78018b735124e10f5a43ea21fce2251554a77ca2
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_collection_builder commit 6df7b8ef3a603f7792ed5815ff324ede8a7b2b0b-dirty
diff -r 78018b735124 -r 6be61cb4a1d5 collection_list.Rmd
--- a/collection_list.Rmd Mon Sep 25 14:28:52 2017 -0400
+++ b/collection_list.Rmd Mon Sep 25 16:19:52 2017 -0400
@@ -14,16 +14,27 @@
)
```
-```{r}
+# Command line arguments
+
+```{r 'command line arguments'}
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
+```{r 'rename files'}
+# create directory
+dir.create('./files_directory')
+# get full paths of original files
+from_files = strsplit("FILE_LIST", ',')[[1]]
+# copy files to the created directory.
+file.copy(from_files, './files_directory')
+# get original file names
+original_files = list.files('./files_directory')
+# create new files names from original file names
+new_files = gsub('\\.dat', '\\.FORMAT', original_files)
+# rename files
+file.copy(paste0('./files_directory/', original_files),
+ paste0('./files_directory/', new_files))
+```
+
+# End
diff -r 78018b735124 -r 6be61cb4a1d5 collection_list.xml
--- a/collection_list.xml Mon Sep 25 14:28:52 2017 -0400
+++ b/collection_list.xml Mon Sep 25 16:19:52 2017 -0400
@@ -7,16 +7,17 @@
r-getopt
r-rmarkdown
r-htmltools
+ r-dplyr
@@ -24,11 +25,12 @@
+
-
+
\ No newline at end of file
diff -r 78018b735124 -r 6be61cb4a1d5 collection_list_render.R
--- a/collection_list_render.R Mon Sep 25 14:28:52 2017 -0400
+++ b/collection_list_render.R Mon Sep 25 16:19:52 2017 -0400
@@ -32,8 +32,8 @@
spec_list=list()
spec_list$FILE_LIST = c('file_list', 'l', '1', 'character')
spec_list$ECHO = c('echo', 'e', '1', 'character')
+spec_list$FORMAT = c('echo', 'f', '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 ----------
@@ -46,6 +46,7 @@
#------ Load libraries ---------
library(rmarkdown)
library(htmltools)
+library(dplyr)
#----- 1. create the report directory ------------------------
system(paste0('mkdir -p ', opt$list_collection_dir))
@@ -62,6 +63,9 @@
gsub('ECHO', opt$echo, x)
}) %>%
(function(x) {
+ gsub('FORMAT', opt$echo, x)
+ }) %>%
+ (function(x) {
gsub('FILE_LIST', opt$file_list, x)
}) %>%
(function(x) {
@@ -74,6 +78,6 @@
})
#------ 3. render all Rmd files --------
-render('list_collection.Rmd', output_file = opt$list_collection_html)
+render('list_collection.Rmd', output_file = opt$report)
#-------4. manipulate outputs -----------------------------