# HG changeset patch
# User mingchen0919
# Date 1522643524 14400
# Node ID 5838300fc1aab0cd75b635a8d275216b2bc4ec40
# Parent 391394c022b8d5f147fa80e75fdb65022f5fd3d3
add expose individuals
diff -r 391394c022b8 -r 5838300fc1aa elastic_expose_individuals.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/elastic_expose_individuals.xml Mon Apr 02 00:32:04 2018 -0400
@@ -0,0 +1,73 @@
+
+
+
+ elastic_tool_wrappers_macros.xml
+
+
+
+
+
+
+ '$report.files_path/options_and_arguments.txt' &&
+
+
+
+ ####################################################
+ ## loop through repeats to get option/argument pairs
+ ####################################################
+
+
+ ############ option_argument_path_relative_to_a_tool
+ #for i in $option_argument_path_relative_to_a_tool_repeat:
+ #set $item = str($i.a_tool_output_dir) + "|" + str($i.value)
+ echo '$item' >> '$report.files_path/options_and_arguments.txt' &&
+ #end for
+
+
+ ############ output_set
+ ## '$report'
+ ## '$report.files_path'
+ #######################
+ export REPORT='$report' &&
+ export TOOL_LOG='$tool_log' &&
+ export REPORT_FILES_PATH='$report.files_path' &&
+
+
+ ############ run render R script to render R markdowns
+ Rscript '${__tool_directory__}/paired_render.R'
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 391394c022b8 -r 5838300fc1aa elastic_expose_to_list_collection.xml
--- a/elastic_expose_to_list_collection.xml Sat Mar 31 21:32:17 2018 -0400
+++ b/elastic_expose_to_list_collection.xml Mon Apr 02 00:32:04 2018 -0400
@@ -1,5 +1,5 @@
-
+
elastic_tool_wrappers_macros.xml
diff -r 391394c022b8 -r 5838300fc1aa elastic_expose_to_list_paired_collection.xml
--- a/elastic_expose_to_list_paired_collection.xml Sat Mar 31 21:32:17 2018 -0400
+++ b/elastic_expose_to_list_paired_collection.xml Mon Apr 02 00:32:04 2018 -0400
@@ -1,5 +1,5 @@
-
+
elastic_tool_wrappers_macros.xml
diff -r 391394c022b8 -r 5838300fc1aa elastic_expose_to_paired_collection.xml
--- a/elastic_expose_to_paired_collection.xml Sat Mar 31 21:32:17 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-
-
-
- elastic_tool_wrappers_macros.xml
-
-
-
-
-
-
- '$report.files_path/options_and_arguments.txt' &&
-
-
-
- ####################################################
- ## loop through repeats to get option/argument pairs
- ####################################################
-
-
- ############ option_argument_path_relative_to_a_tool
- #for i in $option_argument_path_relative_to_a_tool_repeat:
- #set $item = str($i.a_tool_output_dir) + "|" + str($i.value)
- echo '$item' >> '$report.files_path/options_and_arguments.txt' &&
- #end for
-
-
- ############ output_set
- ## '$report'
- ## '$report.files_path'
- #######################
- export REPORT='$report' &&
- export TOOL_LOG='$tool_log' &&
- export REPORT_FILES_PATH='$report.files_path' &&
-
-
- ############ run render R script to render R markdowns
- Rscript '${__tool_directory__}/paired_render.R'
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff -r 391394c022b8 -r 5838300fc1aa individuals.Rmd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/individuals.Rmd Mon Apr 02 00:32:04 2018 -0400
@@ -0,0 +1,53 @@
+---
+title: 'Expose data (paired)'
+output: html_document
+---
+
+
+
+```{r setup, include=FALSE, warning=FALSE, message=FALSE}
+knitr::opts_chunk$set(error = TRUE)
+```
+
+## User input
+
+```{r, echo=FALSE, eval=TRUE}
+##-------- build script files -----------
+
+# build script file: script.sh
+df = read.table(paste0(Sys.getenv('REPORT_FILES_PATH'), '/options_and_arguments.txt'),
+ sep = '|', header = TRUE)
+
+
+knitr::kable(df)
+```
+
+```{r, echo=FALSE}
+# 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'])
+ if (dir.exists(full_path)) {
+ from_files = list.files(full_path, full.names = TRUE)
+ to_files = paste0(Sys.getenv('individual_outputs/'), list.files(full_path))
+ file.copy(from = from_files, to = to_files)
+ }
+ if (file.exists(full_path)) {
+ file.copy(from = full_path, to = paste0(Sys.getenv('individual_outputs/'), df[i, 'relative_path']))
+ }
+ # command_line = paste0('cp -r ', full_path, ' paired')
+ # write(command_line, append = TRUE,
+ # file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/script.sh'))
+ }
+}
+```
+
+
diff -r 391394c022b8 -r 5838300fc1aa individuals_render.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/individuals_render.R Mon Apr 02 00:32:04 2018 -0400
@@ -0,0 +1,38 @@
+##============ Sink warnings and errors to a file ==============
+## use the sink() function to wrap all code within it.
+##==============================================================
+zz = file(Sys.getenv('TOOL_LOG'))
+sink(zz)
+sink(zz, type = 'message')
+
+#------------import libraries--------------------
+options(stringsAsFactors = FALSE)
+
+library(rmarkdown)
+#------------------------------------------------
+
+#------------------------------------------------
+options_and_arguments = read.table(paste0(Sys.getenv('REPORT_FILES_PATH'), '/options_and_arguments.txt'),
+ sep = '|', header = TRUE)
+
+#------------------------------------------------
+# create three folders within working directory
+dir.create('individual_outputs')
+
+#-----------------render Rmd--------------
+# copy R markdown file to working directory and render it within the working directory.
+render(paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/paired.Rmd'),
+ output_file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/report.html'))
+
+# for some unknow reason, directly using REPORT as the input value for output_file parameter
+# in the render function can cause empty report file when the tool runs in batch mode.
+# 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')
+#------------------------------------------
+
+
+##--------end of code rendering .Rmd templates----------------
+sink()
+##=========== End of sinking output=============================
\ No newline at end of file
diff -r 391394c022b8 -r 5838300fc1aa paired.Rmd
--- a/paired.Rmd Sat Mar 31 21:32:17 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
----
-title: 'Expose data (paired)'
-output: html_document
----
-
-
-
-```{r setup, include=FALSE, warning=FALSE, message=FALSE}
-knitr::opts_chunk$set(error = TRUE)
-```
-
-## User input
-
-```{r, echo=FALSE, eval=TRUE}
-##-------- build script files -----------
-
-# build script file: script.sh
-df = read.table(paste0(Sys.getenv('REPORT_FILES_PATH'), '/options_and_arguments.txt'),
- sep = '|', header = TRUE)
-
-
-knitr::kable(df)
-```
-
-```{r, echo=FALSE}
-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, ' paired')
- write(command_line, append = TRUE,
- file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/script.sh'))
- }
-}
-```
-
-
diff -r 391394c022b8 -r 5838300fc1aa paired_render.R
--- a/paired_render.R Sat Mar 31 21:32:17 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-##============ Sink warnings and errors to a file ==============
-## use the sink() function to wrap all code within it.
-##==============================================================
-zz = file(Sys.getenv('TOOL_LOG'))
-sink(zz)
-sink(zz, type = 'message')
-
-#------------import libraries--------------------
-options(stringsAsFactors = FALSE)
-
-library(rmarkdown)
-#------------------------------------------------
-
-#------------------------------------------------
-options_and_arguments = read.table(paste0(Sys.getenv('REPORT_FILES_PATH'), '/options_and_arguments.txt'),
- sep = '|', header = TRUE)
-
-#------------------------------------------------
-# create three folders within working directory
-dir.create('paired')
-
-#-----------------render Rmd--------------
-# copy R markdown file to working directory and render it within the working directory.
-render(paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/paired.Rmd'),
- output_file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/report.html'))
-
-# for some unknow reason, directly using REPORT as the input value for output_file parameter
-# in the render function can cause empty report file when the tool runs in batch mode.
-# 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')
-#------------------------------------------
-
-
-##--------end of code rendering .Rmd templates----------------
-sink()
-##=========== End of sinking output=============================
\ No newline at end of file