Mercurial > repos > bgruening > hicexplorer_hicconvertformat
comparison hicConvertFormat.xml @ 0:e136f22c2a0f draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hicexplorer commit 3b41d687ff30583540d055f6995de00530cca81d-dirty"
author | bgruening |
---|---|
date | Mon, 16 Dec 2019 15:28:54 -0500 |
parents | |
children | 2f62a87d4017 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e136f22c2a0f |
---|---|
1 <tool id="hicexplorer_hicconvertformat" name="@BINARY@" version="@WRAPPER_VERSION@.0"> | |
2 <description>Convert between different file formats</description> | |
3 <macros> | |
4 <token name="@BINARY@">hicConvertFormat</token> | |
5 <token name="@SINGLE_INPUT@"> | |
6 #if $xml_path.inputFormat_selector == 'optionCool': | |
7 --matrices 'matrix.cool' | |
8 --inputFormat cool | |
9 #if $xml_path.correctionName: | |
10 --correction_name '$xml_path.correctionName' | |
11 #end if | |
12 | |
13 #if $xml_path.correctionDivision: | |
14 --correction_division | |
15 #end if | |
16 | |
17 #if $xml_path.chromosome: | |
18 #set $chromosome = ' '.join([ '\'%s\'' % $chrom for $chrom in str($xml_path.chromosome).split(' ') ]) | |
19 | |
20 --chromosome $chromosome | |
21 #end if | |
22 | |
23 #if $xml_path.loadRawValues: | |
24 --load_raw_values | |
25 #end if | |
26 #end if | |
27 #if $xml_path.inputFormat_selector == 'optionH5': | |
28 --matrices "matrix.h5" | |
29 --inputFormat h5 | |
30 | |
31 #end if | |
32 #if $xml_path.inputFormat_selector == 'optionHomer': | |
33 --matrices "matrix.homer" | |
34 --inputFormat homer | |
35 | |
36 #end if | |
37 #if $xml_path.inputFormat_selector == 'optionHicpro': | |
38 --matrices "matrix.hicpro" | |
39 --bedFileHicpro "matrix.bed" | |
40 --inputFormat hicpro | |
41 #end if | |
42 #if $xml_path.inputFormat_selector == 'optionHic': | |
43 --matrices "matrix.hic" | |
44 #if $xml_path.resolutions: | |
45 #set $resolutions = ' '.join([ '"%s"' % $resolution for $resolution in str($xml_path.resolutions).split(" ") ]) | |
46 | |
47 --resolutions $resolutions | |
48 #end if | |
49 --inputFormat hic | |
50 #end if | |
51 </token> | |
52 <import>macros.xml</import> | |
53 </macros> | |
54 | |
55 <expand macro="requirements" /> | |
56 <command detect_errors="exit_code"><![CDATA[ | |
57 | |
58 | |
59 ## single to single case | |
60 | |
61 | |
62 #if $outputSingleMultiple_conditional.outputSingleMultiple_selector == 'singleMatrix': | |
63 #set xml_path = $outputSingleMultiple_conditional.inputFormat_conditional | |
64 | |
65 #if $xml_path.inputFormat_selector == 'optionCool': | |
66 ln -s "$xml_path.matrix_h5_cooler" "matrix.cool" && | |
67 | |
68 #end if | |
69 #if $xml_path.inputFormat_selector == 'optionH5': | |
70 ln -s "$xml_path.matrix_h5_cooler" "matrix.h5" && | |
71 | |
72 #end if | |
73 #if $xml_path.inputFormat_selector == 'optionHomer': | |
74 ln -s "$xml_path.matrixHomer" "matrix.homer" && | |
75 | |
76 #end if | |
77 | |
78 #if $xml_path.inputFormat_selector == 'optionHicpro': | |
79 ln -s "$xml_path.matrixHicpro" "matrix.hicpro" && | |
80 ln -s "$xml_path.bedHicpro" "matrix.bed" && | |
81 #end if | |
82 | |
83 #if $xml_path.inputFormat_selector == 'optionHic': | |
84 ln -s "$xml_path.matrixHic" "matrix.hic" && | |
85 #end if | |
86 | |
87 | |
88 | |
89 @BINARY@ | |
90 @SINGLE_INPUT@ | |
91 | |
92 | |
93 --outputFormat $outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector | |
94 --outFileName 'matrix.$outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector' | |
95 | |
96 #if $outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector == 'ginteractions': | |
97 && mv 'matrix.${outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector}.tsv' matrix_out | |
98 | |
99 #else: | |
100 && mv "matrix.$outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector" matrix_out | |
101 #end if | |
102 #end if | |
103 | |
104 | |
105 ### Set up links to matrices to have correct ending | |
106 #if $outputSingleMultiple_conditional.outputSingleMultiple_selector == 'multipleMatrix': | |
107 #if $outputSingleMultiple_conditional.resolutionOrManyToOne_conditional.resolutionOrManyToOne_selector == 'resolution_option': | |
108 #set xml_path = $outputSingleMultiple_conditional.resolutionOrManyToOne_conditional.inputFormat_conditional | |
109 #if $xml_path.inputFormat_selector == 'optionCool': | |
110 ln -s "$xml_path.matrix_h5_cooler" "matrix.cool" && | |
111 #end if | |
112 | |
113 #if $xml_path.inputFormat_selector == 'optionH5': | |
114 ln -s "$xml_path.matrix_h5_cooler" "matrix.h5" && | |
115 | |
116 #end if | |
117 | |
118 #if $xml_path.inputFormat_selector == 'optionHomer': | |
119 ln -s "$xml_path.matrix_h5_cooler" "matrix.homer" && | |
120 | |
121 #end if | |
122 | |
123 #if $xml_path.inputFormat_selector == 'optionHicpro': | |
124 ln -s "$xml_path.matrix_h5_cooler" "matrix.hicpro" && | |
125 ln -s "$xml_path.bedHicpro" "matrix.bed" && | |
126 | |
127 #end if | |
128 #if $xml_path.inputFormat_selector == 'optionHic': | |
129 ln -s "$xml_path.matrix_h5_cooler" "matrix.hic" && | |
130 | |
131 #end if | |
132 #else: | |
133 #set xml_manyToOne = $outputSingleMultiple_conditional.resolutionOrManyToOne_conditional | |
134 #if $xml_manyToOne.inputFormat_conditional.inputFormat_selector == 'optionCool': | |
135 #for $counter, $m in enumerate($xml_manyToOne.matrix_h5_cooler_multiple): | |
136 ln -s '$m' "${counter}_matrix.cool" && | |
137 #end for | |
138 #set $m = ' '.join([ '"%s_matrix"' % $counter for $counter, $matrix in enumerate($xml_manyToOne.matrix_h5_cooler_multiple) ]) | |
139 | |
140 #end if | |
141 #if $xml_manyToOne.inputFormat_conditional.inputFormat_selector == 'optionH5': | |
142 #for $counter, $m in enumerate($xml_manyToOne.matrix_h5_cooler_multiple): | |
143 ln -s '$m' "${counter}_matrix.h5" && | |
144 #end for | |
145 #set $m = ' '.join([ '"%s_matrix"' % $counter for $counter, $matrix in enumerate($xml_manyToOne.matrix_h5_cooler_multiple) ]) | |
146 #end if | |
147 #if $xml_manyToOne.inputFormat_conditional.inputFormat_selector == 'optionHomer': | |
148 #for $counter, $m in enumerate($xml_manyToOne.matrixHomer): | |
149 ln -s '$m' "${counter}_matrix.homer" && | |
150 #end for | |
151 #set $m = ' '.join([ '"%s_matrix.homer"' % $counter for $counter, $matrix in enumerate($xml_manyToOne.matrixHomer) ]) | |
152 #end if | |
153 #if $xml_manyToOne.inputFormat_conditional.inputFormat_selector == 'optionHicpro': | |
154 #for $counter, $m in enumerate($xml_manyToOne.matrixHicpro): | |
155 ln -s '$m' "${counter}_matrix.hicpro" && | |
156 #end for | |
157 #set $m = ' '.join([ '"%s_matrix.hicpro"' % $counter for $counter, $matrix in enumerate($xml_manyToOne.matrixHicpro) ]) | |
158 | |
159 #for $counter, $bed in enumerate($xml_manyToOne.bedHicpro): | |
160 ln -s '$bed' "${counter}_matrix.bed" && | |
161 #end for | |
162 #set $bed = ' '.join([ '"%s_matrix.bed"' % $counter for $counter, $matrix in enumerate($xml_manyToOne.bedHicpro) ]) | |
163 --bedFileHicpro '$bed' | |
164 #end if | |
165 #end if | |
166 | |
167 | |
168 @BINARY@ | |
169 --outputFormat mcool | |
170 | |
171 #if $outputSingleMultiple_conditional.resolutionOrManyToOne_conditional.resolutionOrManyToOne_selector == 'resolution_option': | |
172 #set $resolutions = ' '.join([ '"%s"' % $resolution for $resolution in str($outputSingleMultiple_conditional.resolutionOrManyToOne_conditional.resolutions).split(" ") ]) | |
173 | |
174 --resolutions $resolutions | |
175 #if $xml_path.inputFormat_selector == 'optionCool': | |
176 --matrices "matrix.cool" | |
177 --inputFormat cool | |
178 #end if | |
179 #if $xml_path.inputFormat_selector == 'optionH5': | |
180 --matrices "matrix.h5" | |
181 --inputFormat h5 | |
182 | |
183 #end if | |
184 #if $xml_path.inputFormat_selector == 'optionHomer': | |
185 --matrices "matrix.homer" | |
186 --inputFormat homer | |
187 | |
188 #end if | |
189 #if $xml_path.inputFormat_selector == 'optionHicpro': | |
190 --matrices "matrix.hicpro" | |
191 --bedFileHicpro "matrix.bed" | |
192 --inputFormat hicpro | |
193 #end if | |
194 #if $xml_path.inputFormat_selector == 'optionHic': | |
195 --matrices "matrix.hic" | |
196 --inputFormat hic | |
197 #end if | |
198 #end if | |
199 | |
200 #if $outputSingleMultiple_conditional.resolutionOrManyToOne_conditional.resolutionOrManyToOne_selector == 'manyToOne_option': | |
201 #if $xml_manyToOne.inputFormat_conditional.inputFormat_selector == 'optionCool': | |
202 --inputFormat cool | |
203 #end if | |
204 | |
205 #if $xml_manyToOne.inputFormat_conditional.inputFormat_selector == 'optionH5': | |
206 --inputFormat h5 | |
207 #end if | |
208 | |
209 | |
210 #if $xml_manyToOne.inputFormat_conditional.inputFormat_selector == 'optionHomer': | |
211 --inputFormat homer | |
212 #end if | |
213 | |
214 #if $xml_manyToOne.inputFormat_conditional.inputFormat_selector == 'optionHicpro': | |
215 --inputFormat hicpro | |
216 --bedFileHicpro '$bed' | |
217 #end if | |
218 | |
219 --matrices $m | |
220 #end if | |
221 --outFileName matrix.mcool | |
222 && mv matrix.mcool matrix_out | |
223 | |
224 #end if | |
225 | |
226 | |
227 ]]> | |
228 </command> | |
229 <inputs> | |
230 | |
231 <conditional name="outputSingleMultiple_conditional"> | |
232 <param name="outputSingleMultiple_selector" type="select" label="Choose output matrix type"> | |
233 <option value="singleMatrix" selected="True">single matrix</option> | |
234 <option value="multipleMatrix">multiple matrix</option> | |
235 </param> | |
236 <when value='singleMatrix'> | |
237 <expand macro='convertFormat_single_macro' /> | |
238 <expand macro='convertFormat_single_output_macro' /> | |
239 </when> | |
240 <when value='multipleMatrix'> | |
241 <conditional name="resolutionOrManyToOne_conditional"> | |
242 <param name="resolutionOrManyToOne_selector" type="select" label="Choose input file type"> | |
243 <option value='resolution_option' >Create out of one matrix a multi matrix with diffrerent resolutions</option> | |
244 <option value='manyToOne_option'>Create out of n matrices one multi matrix </option> | |
245 </param> | |
246 <when value='resolution_option'> | |
247 <param name='resolutions' type='text' label='To be stored resolutions'/> | |
248 <expand macro='convertFormat_single_macro' /> | |
249 </when> | |
250 <when value='manyToOne_option'> | |
251 <expand macro='convertFormat_multiple_macro' /> | |
252 </when> | |
253 </conditional> | |
254 <param name='storeAppliedCorrection' type="boolean" truevalue="yes" falsevalue="" label='Store applied correction factors in column count'/> | |
255 <param name='enforceInteger' type="boolean" truevalue="yes" falsevalue="" label='Enforce integer for count column'/> | |
256 </when> | |
257 </conditional> | |
258 </inputs> | |
259 <outputs> | |
260 | |
261 <data name='output_converted_matrix' from_work_dir='matrix_out' format='cool' label='Converted matrix'> | |
262 <filter>outputSingleMultiple_conditional.outputSingleMultiple_selector == 'singleMatrix'</filter> | |
263 <change_format> | |
264 <when input="outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector" value="h5" format="h5" /> | |
265 <when input="outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector" value="homer" format="zip" /> | |
266 <when input="outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector" value="ginteractions" format="tsv" /> | |
267 </change_format> | |
268 </data> | |
269 <data name='output_converted_matrix_multi' from_work_dir='matrix_out' format='mcool' label='Converted matrix mcool'> | |
270 <filter>outputSingleMultiple_conditional.outputSingleMultiple_selector == 'multipleMatrix'</filter> | |
271 </data> | |
272 </outputs> | |
273 <tests> | |
274 <test> | |
275 <conditional name='outputSingleMultiple_conditional'> | |
276 <param name='outputSingleMultiple_selector' value='singleMatrix'/> | |
277 <conditional name='inputFormat_conditional'> | |
278 <param name='inputFormat_selector' value='optionCool'/> | |
279 <param name='matrix_h5_cooler' value='small_test_matrix.cool'/> | |
280 </conditional> | |
281 | |
282 <conditional name='outputFormat_conditional'> | |
283 <param name='outputFormat_selector' value='h5'/> | |
284 </conditional> | |
285 </conditional> | |
286 <output name="output_converted_matrix" ftype="h5"> | |
287 <assert_contents> | |
288 <has_h5_keys keys='intervals,matrix,nan_bins'/> | |
289 </assert_contents> | |
290 </output> | |
291 </test> | |
292 <test> | |
293 <conditional name='outputSingleMultiple_conditional'> | |
294 <param name='outputSingleMultiple_selector' value='singleMatrix'/> | |
295 <conditional name='inputFormat_conditional'> | |
296 <param name='inputFormat_selector' value='optionH5'/> | |
297 <param name='matrix_h5_cooler' value='small_test_matrix.h5'/> | |
298 </conditional> | |
299 | |
300 <conditional name='outputFormat_conditional'> | |
301 <param name='outputFormat_selector' value='cool'/> | |
302 </conditional> | |
303 </conditional> | |
304 <output name="output_converted_matrix" ftype="cool"> | |
305 <assert_contents> | |
306 <has_h5_keys keys='bins,chroms,indexes,pixels'/> | |
307 </assert_contents> | |
308 </output> | |
309 </test> | |
310 <test> | |
311 <conditional name='outputSingleMultiple_conditional'> | |
312 <param name='outputSingleMultiple_selector' value='singleMatrix'/> | |
313 <conditional name='inputFormat_conditional'> | |
314 <param name='inputFormat_selector' value='optionCool'/> | |
315 <param name='matrix_h5_cooler' value='hicConvertFormat/small_test_matrix_chr4.cool'/> | |
316 </conditional> | |
317 | |
318 <conditional name='outputFormat_conditional'> | |
319 <param name='outputFormat_selector' value='homer'/> | |
320 </conditional> | |
321 </conditional> | |
322 <output name="output_converted_matrix" file="hicConvertFormat/small_test_matrix_chr4.homer" ftype="zip" compare="sim_size" delta="40000"/> | |
323 </test> | |
324 <test> | |
325 <conditional name='outputSingleMultiple_conditional'> | |
326 <param name='outputSingleMultiple_selector' value='singleMatrix'/> | |
327 <conditional name='inputFormat_conditional'> | |
328 <param name='inputFormat_selector' value='optionCool'/> | |
329 <param name='matrix_h5_cooler' value='hicConvertFormat/small_test_matrix_chr4.cool'/> | |
330 </conditional> | |
331 | |
332 <conditional name='outputFormat_conditional'> | |
333 <param name='outputFormat_selector' value='ginteractions'/> | |
334 </conditional> | |
335 </conditional> | |
336 <output name="output_converted_matrix" file="hicConvertFormat/small_test_matrix_chr4.ginteractions.tsv" ftype="tsv" compare="sim_size" delta="40000"/> | |
337 | |
338 </test> | |
339 <test> | |
340 <conditional name='outputSingleMultiple_conditional'> | |
341 <param name='outputSingleMultiple_selector' value='multipleMatrix'/> | |
342 <conditional name='resolutionOrManyToOne_conditional'> | |
343 <param name='resolutionOrManyToOne_selector' value='resolution_option'/> | |
344 <param name='resolutions' value='5000 10000 20000'/> | |
345 <conditional name='inputFormat_conditional'> | |
346 <param name='inputFormat_selector' value='optionH5'/> | |
347 <param name='matrix_h5_cooler' value='small_test_matrix.h5'/> | |
348 </conditional> | |
349 </conditional> | |
350 </conditional> | |
351 <output name="output_converted_matrix" ftype="cool"> | |
352 <assert_contents> | |
353 <has_h5_keys keys='resolutions'/> | |
354 </assert_contents> | |
355 </output> | |
356 </test> | |
357 </tests> | |
358 <help><![CDATA[ | |
359 Converting between different Hi-C interaction formats | |
360 ===================================================== | |
361 | |
362 Conversion of Hi-C matrices of different file formats. We support the conversion of hic to cool format via hic2cool, | |
363 and homer, HicPro, h5 and cool format to h5, cool, homer or ginteractions format. Moreover, hicConvertFormat accepts multiple input files | |
364 from one format with different resolutions and creates a mcool file. Each original file is stored under the path e.g. ::/resolutions/10000. | |
365 A batch computation is possible, the number of input files and output files needs to match, all input files need to be of the same format type and | |
366 all output files too. | |
367 For input and output of cooler files special options are available, for all other formats they will be ignored. | |
368 HiCPro file format needs an additional bed file as input. | |
369 | |
370 | For more information about HiCExplorer please consider our documentation on readthedocs.io_ | |
371 | |
372 .. _readthedocs.io: http://hicexplorer.readthedocs.io/en/latest/index.html | |
373 ]]></help> | |
374 <expand macro="citations" /> | |
375 </tool> |