Mercurial > repos > mingchen0919 > rmarkdown_i_adhore
annotate i_adhore_configure_render.R @ 9:2b33a6d5211d draft
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit a204fdb1b6f8a3859f8aefefe367b6a9deb6811d-dirty
author | mingchen0919 |
---|---|
date | Fri, 25 Aug 2017 14:47:41 -0400 |
parents | f8bedb407e5c |
children |
rev | line source |
---|---|
0
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
1 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
2 ##======= Handle arguments from command line ======== |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
3 # setup R error handline to go to stderr |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
4 options(show.error.messages=FALSE, |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
5 error=function(){ |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
6 cat(geterrmessage(), file=stderr()) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
7 quit("no", 1, F) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
8 }) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
9 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
10 # we need that to not crash galaxy with an UTF8 error on German LC settings. |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
11 loc = Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
12 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
13 # suppress warning |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
14 options(warn = -1) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
15 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
16 options(stringsAsFactors=FALSE, useFancyQuotes=FALSE) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
17 args = commandArgs(trailingOnly=TRUE) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
18 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
19 suppressPackageStartupMessages({ |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
20 library(getopt) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
21 library(tools) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
22 }) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
23 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
24 # column 1: the long flag name |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
25 # column 2: the short flag alias. A SINGLE character string |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
26 # column 3: argument mask |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
27 # 0: no argument |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
28 # 1: argument required |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
29 # 2: argument is optional |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
30 # column 4: date type to which the flag's argument shall be cast. |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
31 # possible values: logical, integer, double, complex, character. |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
32 spec_list=list() |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
33 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
34 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
35 ##------- 1. input data --------------------- |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
36 spec_list$ECHO = c('echo', 'e', '1', 'character') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
37 spec_list$G_ANALYSIS_FILES = c('g_analysis_files', 'G', '1', 'character') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
38 spec_list$BLAST_TABLE = c('blast_table', 'b', '1', 'character') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
39 spec_list$GAP_SIZE = c('gap_size', 'g', '1', 'character') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
40 spec_list$CLUSTER_GAP = c('cluster_gap', 'c', '1', 'character') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
41 spec_list$Q_VALUE = c('q_value', 'q', '1', 'character') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
42 spec_list$PROB_CUTOFF = c('prob_cutoff', 'p', '1', 'character') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
43 spec_list$ANCHOR_POINTS = c('anchor_points', 'a', '1', 'character') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
44 spec_list$ALIGNMENT_METHOD = c('alignment_method', 'm', '1', 'character') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
45 spec_list$LEVEL2ONLY = c('level2only', 'l', '1', 'character') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
46 spec_list$TABLE_TYPE = c('table_type', 'T', '1', 'character') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
47 spec_list$MULTI_HYPOTHESIS_CORRECTION = c('multi_hypothesis_correction', 'h', '1', 'character') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
48 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
49 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
50 ##--------2. output report and report site directory -------------- |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
51 spec_list$I_ADHORE_CONFIGURE_TXT = c('i_adhore_configure_txt', 'x', '1', 'character') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
52 spec_list$OUTPUT_HTML = c('i_adhore_configure_html', 'o', '1', 'character') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
53 spec_list$OUTPUT_DIR = c('i_adhore_configure_dir', 'd', '1', 'character') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
54 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
55 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
56 ##--------3. Rmd templates sitting in the tool directory ---------- |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
57 spec_list$I_ADHORE_CONFIGURE_RMD = c('i_adhore_configure_rmd', '-t', '1', 'character') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
58 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
59 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
60 spec = t(as.data.frame(spec_list)) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
61 opt = getopt(spec) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
62 # arguments are accessed by long flag name (the first column in the spec matrix) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
63 # NOT by element name in the spec_list |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
64 # example: opt$help, opt$expression_file |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
65 ##====== End of arguments handling ========== |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
66 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
67 #------ Load libraries --------- |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
68 library(rmarkdown) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
69 library(plyr) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
70 library(dplyr) |
8
f8bedb407e5c
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit cc2f473d151c0de971c760a9aec9d09ff073ad85-dirty
mingchen0919
parents:
0
diff
changeset
|
71 library(htmltools) |
0
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
72 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
73 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
74 #----- 1. create the report directory ------------------------ |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
75 system(paste0('mkdir -p ', opt$i_adhore_configure_dir)) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
76 # set working directory to output files directory |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
77 setwd(opt$i_adhore_configure_dir) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
78 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
79 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
80 #----- 2. generate Rmd files with Rmd templates -------------- |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
81 # a. templates without placeholder variables: |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
82 # copy templates from tool directory to the working directory. |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
83 # b. templates with placeholder variables: |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
84 # substitute variables with user input values and place them in the working directory. |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
85 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
86 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
87 #----- 01 i_adhore_configure.Rmd ----------------------- |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
88 readLines(opt$i_adhore_configure_rmd) %>% |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
89 (function(x) { |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
90 gsub('ECHO', opt$echo, x) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
91 }) %>% |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
92 (function(x) { |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
93 gsub('I_ADHORE_CONFIGURE_TXT', opt$i_adhore_configure_txt, x) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
94 }) %>% |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
95 (function(x) { |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
96 fileConn = file('i_adhore_configure.Rmd') |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
97 writeLines(x, con=fileConn) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
98 close(fileConn) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
99 }) |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
100 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
101 |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
102 #------ 3. render all Rmd files -------- |
9755ce6ac4d5
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit b6ef011f29d6c75775be9cc0e0abe53e19981d1d-dirty
mingchen0919
parents:
diff
changeset
|
103 render('i_adhore_configure.Rmd', output_file = opt$i_adhore_configure_html) |