|
0
|
1 ##============ Sink warnings and errors to a file ==============
|
|
|
2 ## use the sink() function to wrap all code within it.
|
|
|
3 ##==============================================================
|
|
|
4 zz = file('warnings_and_errors.txt')
|
|
|
5 sink(zz)
|
|
|
6 sink(zz, type = 'message')
|
|
|
7
|
|
|
8 library(getopt)
|
|
|
9 library(rmarkdown)
|
|
|
10 library(htmltools)
|
|
|
11 library(plyr)
|
|
|
12 library(dplyr)
|
|
|
13 library(stringr)
|
|
|
14 library(DT)
|
|
|
15 library(reshape2)
|
|
|
16 library(plotly)
|
|
|
17 options(stringsAsFactors = FALSE)
|
|
|
18
|
|
|
19 # getopt_specification_matrix(extract_short_flags('fastqc_report.xml')) %>%
|
|
|
20 # write.table(file = 'spec.txt', sep = ',', row.names = FALSE, col.names = TRUE, quote = FALSE)
|
|
|
21
|
|
|
22 spec_matrix = as.matrix(
|
|
|
23 data.frame(stringsAsFactors=FALSE,
|
|
|
24 long_flags = c("X_e", "X_r", "X_n", "X_R", "X_N", "X_c", "X_l",
|
|
|
25 "X_o", "X_d", "X_s", "X_p"),
|
|
|
26 short_flags = c("e", "r", "n", "R", "N", "c", "l", "o", "d", "s",
|
|
|
27 "p"),
|
|
|
28 argument_mask_flags = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L),
|
|
|
29 data_type_flags = c("character", "character", "character", "character",
|
|
|
30 "character", "character", "character",
|
|
|
31 "character", "character", "character", "character")
|
|
|
32 )
|
|
|
33 )
|
|
|
34 # get arguments into R
|
|
|
35 opt = getopt(spec_matrix)
|
|
|
36 # define system environment variables
|
|
|
37 do.call(Sys.setenv, opt[-1])
|
|
|
38
|
|
|
39 # render website
|
|
|
40 # render(input = opt$X_p, output_file = opt$X_o)
|
|
|
41 render_site()
|
|
|
42 file.copy(paste0(opt$X_d, '/index.html'), opt$X_o, recursive = TRUE)
|
|
|
43
|
|
|
44 ##--------end of code rendering .Rmd templates----------------
|
|
|
45 sink()
|
|
|
46 ##=========== End of sinking output============================= |