# HG changeset patch # User mingchen0919 # Date 1519487070 18000 # Node ID 670e1591cc6566eecbda8d55799b593f6771afdc # Parent 49cabfe55b615ec9d50ef75cffad61490e8014ff update diff -r 49cabfe55b61 -r 670e1591cc65 extract_fields.xml --- 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 @@ r-rmarkdown r-htmltools r-dplyr - xorg-libxrender some descriptions about the tool. diff -r 49cabfe55b61 -r 670e1591cc65 tool_template.Rmd --- 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 . - -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. diff -r 49cabfe55b61 -r 670e1591cc65 tool_template_render.R --- 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()