annotate fastqc_site_render.R @ 0:f74fdae99053 draft

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