0
|
1 <?xml version="1.0" encoding="UTF-8"?>
|
|
2 <macros>
|
|
3 <xml name="rmarkdown_requirements">
|
|
4 <requirement type="package" version="1.15.0.6-0">pandoc</requirement>
|
|
5 <requirement type="package" version="1.6">r-rmarkdown</requirement>
|
|
6 </xml>
|
|
7 <xml name="stdio">
|
|
8 <stdio>
|
|
9 <regex match="XXX" source="stderr" level="warning" description="Check the tool log output file for more details."/>
|
|
10 </stdio>
|
|
11 </xml>
|
|
12 <!--Tool name-->
|
|
13 <xml name="tool_name">
|
|
14 <param type="select" name="tool_name" multiple="false" label="Tool name">
|
|
15 <option value="cp" selected="false">cp</option></param>
|
|
16 </xml>
|
|
17 <!--OPTION/ARGUMENT PAIRS and INPUT types-->
|
|
18 <!--input files-->
|
|
19 <xml name="option_argument_single_dataset">
|
|
20 <repeat name="option_argument_single_dataset_repeat" title="INPUT DATA FROM HISTORY: single data set" min="0" default="0">
|
|
21 <param type="text" name="flag" optional="true" label="flag"/>
|
|
22 <param name="value" type="data" optional="false" multiple="false" label="value"/>
|
|
23 </repeat>
|
|
24 </xml>
|
|
25 <xml name="option_argument_multiple_datasets">
|
|
26 <repeat name="option_argument_multiple_datasets_repeat" title="INPUT DATA FROM HISTORY: multiple data sets" min="0" default="0">
|
|
27 <param type="text" name="flag" optional="true" label="flag"/>
|
|
28 <param name="value" type="data" optional="false" multiple="true" label="value"/>
|
|
29 <param type="select" name="delimiter" multiple="false" label="file delimiter">
|
|
30 <option value=" " selected="false">space</option>
|
|
31 <option value="," selected="false">comma</option>
|
|
32 </param>
|
|
33 </repeat>
|
|
34 </xml>
|
|
35 <!--input path-->
|
|
36 <xml name="option_argument_path_relative_to_a_tool">
|
|
37 <repeat name="option_argument_path_relative_to_a_tool_repeat" title="INPUT DATA PATH: relative to a tool output directory" min="0" default="0">
|
|
38 <param type="text" name="flag" optional="true" label="flag"/>
|
|
39 <param name="a_tool_output_dir" type="data" optional="false" multiple="false" label="a tool output directory"/>
|
|
40 <param type="text" name="value" optional="true" label="value"/>
|
|
41 </repeat>
|
|
42 </xml>
|
|
43 <xml name="option_argument_path_relative_to_this_tool">
|
|
44 <repeat name="option_argument_path_relative_to_this_tool_repeat" title="OUTPUT PATH: relative to this tool output directory" min="0" default="0">
|
|
45 <param type="text" name="flag" optional="true" label="flag"/>
|
|
46 <param type="text" name="value" optional="false" label="value"/>
|
|
47 <param type="select" name="path_type" multiple="false" label="path type">
|
|
48 <option value="file_path" selected="false">file path</option>
|
|
49 <option value="dir_path" selected="false">directory path</option>
|
|
50 </param>
|
|
51 </repeat>
|
|
52 </xml>
|
|
53 <!--input values: string, float and integer-->
|
|
54 <xml name="option_argument_string_float_integer">
|
|
55 <repeat name="option_argument_string_float_integer_repeat" title="INPUT VALUE: string/float/integer" min="0" default="0">
|
|
56 <param type="text" name="flag" label="flag"/>
|
|
57 <param type="text" name="value" label="value"/>
|
|
58 </repeat>
|
|
59 </xml>
|
|
60 <!--output set-->
|
|
61 <xml name="output_set">
|
|
62 <data format="html" name="report" label="${tool.name} report"/>
|
|
63 <data format="txt" name="tool_help_doc" label="${tool.name} help doc"/>
|
|
64 <data format="txt" name="tool_output_dir" label="${tool.name} output directory"/>
|
|
65 <data format="txt" name="tool_log" label="${tool.name} log"/>
|
|
66 <data name="asis">
|
|
67 <discover_datasets pattern="__name_and_ext__" directory="${report.files_path}/asis_dir"/>
|
|
68 </data>
|
|
69 <collection type="list" name="expose_to_list">
|
|
70 <discover_datasets pattern="__name_and_ext__" directory="${report.files_path}/list_dir" />
|
|
71 </collection>
|
|
72 <collection type="paired" name="expose_to_pair">
|
|
73 <discover_datasets pattern="__name_and_ext__" directory="${report.files_path}/pair_dir" />
|
|
74 </collection>
|
|
75 <collection type="list:paired" name="expose_to_list_pairs">
|
|
76 <discover_datasets pattern="(?P<identifier_0>[^_]+)_(?P<identifier_1>[^_]+)\.(?P<ext>[^\._]+)?"
|
|
77 directory="${report.files_path}/list_pairs_dir"/>
|
|
78 </collection>
|
|
79 </xml>
|
|
80 <!--shell command fragment-->
|
|
81 <xml name="shell_command">
|
|
82 <command><![CDATA[
|
|
83
|
|
84 ############ first, create a directory to store all files
|
|
85 mkdir -p $report.files_path && cd $report.files_path &&
|
|
86
|
|
87
|
|
88 ############ save the tool installation directory to an environment variable
|
|
89 export TOOL_INSTALL_DIR='${__tool_directory__}' &&
|
|
90
|
|
91
|
|
92 #########################
|
|
93 ##
|
|
94 ## save user input option/argument pairs into a file
|
|
95 ##
|
|
96 #########################
|
|
97
|
|
98 ## first line will be the header
|
|
99 echo 'type|flag|value|path_type' > options_and_arguments.txt &&
|
|
100
|
|
101 ############ tool_name
|
|
102 ##-t '$tool_name'
|
|
103 echo "tool_name|not available|${tool_name}|not available" >> options_and_arguments.txt &&
|
|
104
|
|
105 ####################################################
|
|
106 ## loop through repeats to get option/argument pairs
|
|
107 ####################################################
|
|
108
|
|
109 ############ option_argument_single_dataset
|
|
110 #for i in $option_argument_single_dataset_repeat:
|
|
111 #set $item = 'single_dataset|' + str($i.flag) + "|" + str($i.value) + "|"
|
|
112 echo '$item' >> options_and_arguments.txt &&
|
|
113 #end for
|
|
114
|
|
115 ############ option_argument_multiple_datasets
|
|
116 #for i in $option_argument_multiple_datasets_repeat:
|
|
117 #set $item = 'multiple_datasets|' + str($i.flag) + "|" + str($i.value).replace(',', str($i.delimiter)) + "|"
|
|
118 echo '$item' >> options_and_arguments.txt &&
|
|
119 #end for
|
|
120
|
|
121
|
|
122 ############ option_argument_path_relative_to_a_tool
|
|
123 #for i in $option_argument_path_relative_to_a_tool_repeat:
|
|
124 #set $item = 'path_relative_to_a_tool|' + str($i.flag) + "|" + str($i.value) + "|" + str($i.a_tool_output_dir)
|
|
125 echo '$item' >> options_and_arguments.txt &&
|
|
126 #end for
|
|
127
|
|
128 ############ option_argument_path_relative_to_this_tool
|
|
129 #for i in $option_argument_path_relative_to_this_tool_repeat:
|
|
130 #set $item = 'path_relative_to_this_tool|' + str($i.flag) + "|" + str($i.value) + "|" + str($i.path_type)
|
|
131 echo '$item' >> options_and_arguments.txt &&
|
|
132 #end for
|
|
133
|
|
134 ############ option_argument_string_float_integer
|
|
135 #for i in $option_argument_string_float_integer_repeat:
|
|
136 #set $item = 'value|' + str($i.flag) + "|" + str($i.value) + "|"
|
|
137 echo '$item' >> options_and_arguments.txt &&
|
|
138 #end for
|
|
139
|
|
140 ############ output_set
|
|
141 ## '$report'
|
|
142 ## '$report.files_path'
|
|
143 ## '$tool_help_doc'
|
|
144 ## '$tool_output_dir'
|
|
145 ## '$tool_log'
|
|
146 #######################
|
|
147 export REPORT='$report' &&
|
|
148 export REPORT_FILES_PATH='$report.files_path' &&
|
|
149 export TOOL_HELP_DOC='$tool_help_doc' &&
|
|
150 export TOOL_OUTPUT_DIR='$tool_output_dir' &&
|
|
151 export TOOL_LOG='$tool_log' &&
|
|
152
|
|
153
|
|
154 ############ run render R script to render R markdowns
|
|
155 Rscript '${__tool_directory__}/elastic_tool_render.R'
|
|
156
|
|
157 ]]></command>
|
|
158 </xml>
|
|
159 <!--tool citations-->
|
|
160 <xml name="citations">
|
|
161 <citation type="bibtex"><![CDATA[
|
|
162 @article{allaire2016rmarkdown,
|
|
163 title={rmarkdown: Dynamic Documents for R, 2016},
|
|
164 author={Allaire, J and Cheng, Joe and Xie, Yihui and McPherson, Jonathan and Chang, Winston and Allen, Jeff
|
|
165 and Wickham, Hadley and Atkins, Aron and Hyndman, Rob},
|
|
166 journal={R package version 0.9},
|
|
167 volume={6},
|
|
168 year={2016}
|
|
169 }
|
|
170 ]]></citation>
|
|
171 <citation type="bibtex"><![CDATA[
|
|
172 @book{xie2015elastic,
|
|
173 title={Dynamic Documents with R and knitr},
|
|
174 author={Xie, Yihui},
|
|
175 volume={29},
|
|
176 year={2015},
|
|
177 publisher={CRC Press}
|
|
178 }
|
|
179 ]]></citation>
|
|
180 </xml>
|
|
181 </macros>
|