comparison fastqc_report_render.R @ 16:1710b0e874f1 draft

fix file name issue
author mingchen0919
date Sat, 21 Oct 2017 09:25:49 -0400
parents d1d20f341632
children 8c79e5b7cfc0
comparison
equal deleted inserted replaced
15:d1d20f341632 16:1710b0e874f1
7 library(highcharter) 7 library(highcharter)
8 library(DT) 8 library(DT)
9 library(reshape2) 9 library(reshape2)
10 library(plotly) 10 library(plotly)
11 library(formattable) 11 library(formattable)
12 options(stringsAsFactors=FALSE, useFancyQuotes=FALSE)
12 13
13 ##============ Sink warnings and errors to a file ============== 14 ##============ Sink warnings and errors to a file ==============
14 ## use the sink() function to wrap all code within it. 15 ## use the sink() function to wrap all code within it.
15 ##============================================================== 16 ##==============================================================
16 zz = file('warnings_and_errors.txt') 17 zz = file('warnings_and_errors.txt')
37 # for example, one name is "ECHO", if another name is "ECHO_XXX", it will cause problems. 38 # for example, one name is "ECHO", if another name is "ECHO_XXX", it will cause problems.
38 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 39 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
39 args_list=list() 40 args_list=list()
40 ##------- 1. input data --------------------- 41 ##------- 1. input data ---------------------
41 args_list$ECHO = c('echo', 'e', '1', 'character') 42 args_list$ECHO = c('echo', 'e', '1', 'character')
42 args_list$READS = c('reads', 'r', '1', 'character') 43 args_list$READS_1 = c('reads_1', 'r', '1', 'character')
43 args_list$NAMES = c('names', 'n', '1', 'character') 44 args_list$NAME_1 = c('name_1', 'n', '1', 'character')
45 args_list$READS_2 = c('reads_2', 'R', '1', 'character')
46 args_list$NAME_2 = c('name_2', 'N', '1', 'character')
47 args_list$CONTAMINANTS = c('contaminants', 'c', '1', 'character')
48 args_list$LIMITS = c('limits', 'l', '1', 'character')
44 ##--------2. output report and outputs -------------- 49 ##--------2. output report and outputs --------------
45 args_list$REPORT_HTML = c('report_html', 'o', '1', 'character') 50 args_list$REPORT_HTML = c('report_html', 'o', '1', 'character')
46 args_list$REPORT_DIR = c('report_dir', 'd', '1', 'character') 51 args_list$REPORT_DIR = c('report_dir', 'd', '1', 'character')
47 args_list$SINK_MESSAGE = c('sink_message', 's', '1', 'character') 52 args_list$SINK_MESSAGE = c('sink_message', 's', '1', 'character')
48 ##--------3. .Rmd templates in the tool directory ---------- 53 ##--------3. .Rmd templates in the tool directory ----------
64 readLines(opt$fastqc_report_rmd) %>% 69 readLines(opt$fastqc_report_rmd) %>%
65 (function(x) { 70 (function(x) {
66 gsub('ECHO', opt$echo, x) 71 gsub('ECHO', opt$echo, x)
67 }) %>% 72 }) %>%
68 (function(x) { 73 (function(x) {
69 gsub('READS', opt$reads, x) 74 gsub('READS_1', opt$reads_1, x)
75 }) %>%
76 (function(x) {
77 gsub('NAME_1', opt$name_1, x)
78 }) %>%
79 (function(x) {
80 gsub('READS_2', opt$reads_2, x)
81 }) %>%
82 (function(x) {
83 gsub('NAME_2', opt$name_1, x)
84 }) %>%
85 (function(x) {
86 gsub('CONTAMINANTS', opt$contaminants, x)
87 }) %>%
88 (function(x) {
89 gsub('LIMITS', opt$limits, x)
70 }) %>% 90 }) %>%
71 (function(x) { 91 (function(x) {
72 gsub('REPORT_DIR', opt$report_dir, x) 92 gsub('REPORT_DIR', opt$report_dir, x)
73 }) %>% 93 }) %>%
74 (function(x) { 94 (function(x) {