changeset 11:670e1591cc65 draft

update
author mingchen0919
date Sat, 24 Feb 2018 10:44:30 -0500
parents 49cabfe55b61
children 9cf29b2374a6
files extract_fields.xml tool_template.Rmd tool_template_render.R
diffstat 3 files changed, 6 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/extract_fields.xml	Fri Feb 23 15:58:55 2018 -0500
+++ b/extract_fields.xml	Sat Feb 24 10:44:30 2018 -0500
@@ -5,7 +5,6 @@
     <requirement type="package" version="1.3">r-rmarkdown</requirement>
     <requirement type="package" version="0.3.5">r-htmltools</requirement>
     <requirement type="package" version="0.5.0">r-dplyr</requirement>
-    <requirement type="package" version="0.9.10">xorg-libxrender</requirement>
   </requirements>
   <description>some descriptions about the tool.</description>
   <stdio>
--- a/tool_template.Rmd	Fri Feb 23 15:58:55 2018 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-
-## R Markdown
-
-This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
-
-When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
-
-
-## Including Plots
-
-You can also embed plots, for example:
-
-
-Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
--- a/tool_template_render.R	Fri Feb 23 15:58:55 2018 -0500
+++ b/tool_template_render.R	Sat Feb 24 10:44:30 2018 -0500
@@ -2,6 +2,7 @@
 sink(zz)
 sink(zz, type = "message")
 
+
 # bring user inputs and command line arguments to R
 spec_matrix = as.matrix(
   data.frame(stringsAsFactors=FALSE,
@@ -17,6 +18,10 @@
 opt = getopt::getopt(spec_matrix)
 opt
 
-rmarkdown::render(input = opt$X_t, output_file = opt$X_O)
+# build command: awk '{print $1,$2}' > output.txt and run
+X_A = paste0(paste0('$', trimws(strsplit(opt$X_A, ',')[[1]])), collapse = ',')
+extract_field_command = paste0("awk '{print ", X_A, " }' ", opt$X_B, " > ", opt$X_O)
+system(command = extract_field_command)
+
 
 sink()