changeset 2:b5a576fc2a7c draft

update
author mingchen0919
date Sat, 03 Mar 2018 12:21:18 -0500
parents a76288e18d85
children 75a55316ff32
files star.Rmd star_render.R
diffstat 2 files changed, 27 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/star.Rmd	Fri Mar 02 13:21:57 2018 -0500
+++ b/star.Rmd	Sat Mar 03 12:21:18 2018 -0500
@@ -5,7 +5,7 @@
 
 ```{r setup, include=FALSE, warning=FALSE, message=FALSE}
 knitr::opts_chunk$set(
-  echo = as.logical(), 
+  echo = as.logical(opt$X_e), 
   error = TRUE
 )
 ```
@@ -28,9 +28,16 @@
   > /dev/null 2>&1
 EOF
 
-grep -v None temp.sh > star-job.sh
+grep -v None temp.sh > index-genome.sh
 
 # run star
-sh star-job.sh
+sh index-genome.sh
 ```
 
+
+```{r}
+# display skewer job script
+index_genome_sh = paste0(opt$X_d, '/index-genome.sh')
+tags$code(tags$pre(readChar(index_genome_sh, file.info(index_genome_sh)$size )))
+```
+
--- a/star_render.R	Fri Mar 02 13:21:57 2018 -0500
+++ b/star_render.R	Sat Mar 03 12:21:18 2018 -0500
@@ -10,16 +10,27 @@
 
 library(getopt)
 library(rmarkdown)
+library(htmltools)
 #------------------------------------------------
 
 
 #------------get arguments into R--------------------
 # library(dplyr)
-# getopt_specification_matrix(extract_short_flags('')) %>%
+# getopt_specification_matrix(extract_short_flags('star.xml')) %>%
 #   write.table(file = 'spec.txt', sep = ',', row.names = FALSE, col.names = TRUE, quote = FALSE)
 
 
-spec_matrix = as.matrix()
+spec_matrix = as.matrix(
+  data.frame(stringsAsFactors=FALSE,
+              long_flags = c("X_e", "X_o", "X_d", "X_s", "X_t", "X_A", "X_B",
+                             "X_C"),
+             short_flags = c("e", "o", "d", "s", "t", "A", "B", "C"),
+     argument_mask_flags = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L),
+         data_type_flags = c("character", "character", "character", "character",
+                             "character", "character", "character",
+                             "character")
+  )
+)
 opt = getopt(spec_matrix)
 #----------------------------------------------------
 
@@ -32,16 +43,16 @@
 #---------- often used variables ----------------
 # OUTPUT_DIR: path to the output associated directory, which stores all outputs
 # TOOL_DIR: path to the tool installation directory
-OUTPUT_DIR = ''
-TOOL_DIR =   ''
-RMD_NAME = ''
+OUTPUT_DIR = opt$X_d
+TOOL_DIR =   opt$X_t
+RMD_NAME = 'star.Rmd'
 OUTPUT_REPORT = opt$X_o
 
 # create the output associated directory to store all outputs
 dir.create(OUTPUT_DIR, recursive = TRUE)
 
 #-----------------render Rmd--------------
-render(paste0(TOOL_DIR, RMD_NAME, sep = '/'), output_file = OUTPUT_REPORT)
+render(paste0(TOOL_DIR, '/', RMD_NAME), output_file = OUTPUT_REPORT)
 #------------------------------------------
 
 #==============the end==============