Mercurial > repos > yating-l > jbrowsearchivecreator
comparison jbrowseArchiveCreator.xml @ 6:237707a6b74d draft
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
author | yating-l |
---|---|
date | Thu, 15 Feb 2018 17:05:05 -0500 |
parents | |
children | 5d5fdcb798da |
comparison
equal
deleted
inserted
replaced
5:e762f4b9e4bd | 6:237707a6b74d |
---|---|
1 <tool id="jbrowse_hub" name="JBrowse Archive Creator" version="2.0.1"> | |
2 <description> | |
3 This Galaxy tool is used to prepare your files to be ready for displaying on JBrowse with Apollo plugin | |
4 </description> | |
5 <macros> | |
6 <import>macros.xml</import> | |
7 </macros> | |
8 <requirements> | |
9 <requirement type="package" version="1.2">samtools</requirement> | |
10 <requirement type="package" version="1.9">numpy</requirement> | |
11 <requirement type="package" version="1.68">biopython</requirement> | |
12 <requirement type="package" version="340">ucsc_hac</requirement> | |
13 <requirement type="package" version="1.12.4">jbrowse_tools</requirement> | |
14 </requirements> | |
15 | |
16 <stdio> | |
17 </stdio> | |
18 | |
19 <command detect_errors="exit_code"><![CDATA[ | |
20 mkdir -p $output.extra_files_path; | |
21 | |
22 ## Dump the tool parameters into a JSON file | |
23 python $json_file parameters.json; | |
24 | |
25 python $__tool_directory__/jbrowseArchiveCreator.py --data_json parameters.json -o $output | |
26 ]]></command> | |
27 <configfiles> | |
28 <configfile name="json_file"> | |
29 import json | |
30 import sys | |
31 | |
32 file_path = sys.argv[1] | |
33 #set global data_parameter_dict = {} | |
34 | |
35 ## Ask the user to enter the genome name | |
36 #silent $data_parameter_dict.update({"genome_name": str($genome_name)}) | |
37 | |
38 ## Function to retrieve the data of the inputs | |
39 #def prepare_json($datatype, $input_to_prepare, $order_index, $extra_data_dict={}) | |
40 #set false_path = str($input_to_prepare) | |
41 #set $data_dict = {"false_path": $false_path} | |
42 | |
43 #set name = str($input_to_prepare.name) | |
44 #silent $data_dict.update({"name": $name}) | |
45 #silent $data_dict.update($extra_data_dict) | |
46 ## Add the ordering by taking the tool form indexes | |
47 #silent $data_dict.update({"order_index": $order_index}) | |
48 | |
49 #if $datatype in $data_parameter_dict | |
50 #silent $data_parameter_dict[$datatype].append($data_dict) | |
51 #else | |
52 #set array_inputs = [] | |
53 #silent $array_inputs.append($data_dict) | |
54 #silent $data_parameter_dict.update({$datatype: $array_inputs}) | |
55 #end if | |
56 #end def | |
57 | |
58 ## Get the number of digits from tracks, to have a unique integer from group index and track index | |
59 | |
60 #set temp_max_digit = 0 | |
61 | |
62 #for $g in $group | |
63 #if len($g.format) > $temp_max_digit | |
64 #silent temp_max_digit = len($g.format) | |
65 #end if | |
66 #end for | |
67 | |
68 #set nb_digits_max_track = len(str($temp_max_digit)) | |
69 | |
70 ## END Get the number of digits | |
71 | |
72 #for $i_g, $g in enumerate( $group ) | |
73 #for $i, $f in enumerate( $g.format ) | |
74 ## Create the order index using index_group+1 concatenated with index_track | |
75 #set index_group_final = str($i_g + 1) | |
76 #set index_track_final = str($index_group_final) + str($i).zfill($nb_digits_max_track) | |
77 | |
78 ## For each format, we have a few mandatory fields we store in a dict | |
79 #set track_color = str($f.formatChoice.track_color) | |
80 #set group_name = str($g.group_name) | |
81 #set longLabel = str($f.formatChoice.longLabel) | |
82 #set extra_data_dict = {"track_color": $track_color, | |
83 "group_name": $group_name, | |
84 "long_label": $longLabel} | |
85 #if $f.formatChoice.format_select == "bam" | |
86 #set bam_index = $f.formatChoice.BAM.metadata.bam_index | |
87 | |
88 ## Add Bam format specific fields | |
89 #silent $extra_data_dict.update({"index": $bam_index}) | |
90 | |
91 #silent $prepare_json("Bam", $f.formatChoice.BAM, $index_track_final, $extra_data_dict) | |
92 #end if | |
93 #if $f.formatChoice.format_select == "bed" | |
94 #if $f.formatChoice.bedChoice.bed_select == "bed_generic" | |
95 #silent $prepare_json("Bed", $f.formatChoice.bedChoice.BED_generic, $index_track_final, | |
96 $extra_data_dict) | |
97 #end if | |
98 #if $f.formatChoice.bedChoice.bed_select == "bed_simple_repeats_option" | |
99 #silent $prepare_json("BedSimpleRepeats", $f.formatChoice.bedChoice.BED_simple_repeats, $index_track_final, | |
100 $extra_data_dict) | |
101 #end if | |
102 #if $f.formatChoice.bedChoice.bed_select == "bed_splice_junctions_option" | |
103 #silent $prepare_json("BedSpliceJunctions", $f.formatChoice.bedChoice.BED_splice_junctions, $index_track_final, | |
104 $extra_data_dict) | |
105 #end if | |
106 #if $f.formatChoice.bedChoice.bed_select == "bed_blast_alignment_option" | |
107 ##set database = str($f.formatChoice.bedChoice.database) | |
108 ##silent $extra_data_dict.update({"database": $database}) | |
109 #silent $prepare_json("BedBlastAlignments", $f.formatChoice.bedChoice.BED_blast_alignment, $index_track_final, | |
110 $extra_data_dict) | |
111 #end if | |
112 #if $f.formatChoice.bedChoice.bed_select == "bed_blat_alignment_option" | |
113 ##set database = str($f.formatChoice.bedChoice.database) | |
114 ##silent $extra_data_dict.update({"database": $database}) | |
115 #silent $prepare_json("BedBlatAlignments", $f.formatChoice.bedChoice.BED_blat_alignment, $index_track_final, | |
116 $extra_data_dict) | |
117 #end if | |
118 #end if | |
119 #if $f.formatChoice.format_select == "blastxml" | |
120 #silent $prepare_json("BlastXml", $f.formatChoice.BlastXML, $index_track_final, | |
121 extra_data_dict) | |
122 #end if | |
123 #if $f.formatChoice.format_select == "bigwig" | |
124 #silent $prepare_json("BigWig", $f.formatChoice.BIGWIG, $index_track_final, | |
125 $extra_data_dict) | |
126 #end if | |
127 #if $f.formatChoice.format_select == 'gff3' | |
128 #silent $prepare_json("Gff3", $f.formatChoice.GFF3, $index_track_final, | |
129 $extra_data_dict) | |
130 #end if | |
131 #if $f.formatChoice.format_select == "gtf" | |
132 ## Add also GTF from Agustus? See https://github.com/ENCODE-DCC/kentUtils/issues/8 | |
133 #silent $prepare_json("Gtf", $f.formatChoice.GTF, $index_track_final, | |
134 $extra_data_dict) | |
135 #end if | |
136 #end for | |
137 #end for | |
138 | |
139 ## We combine the fasta file dataset name with his false path in a JSON object | |
140 #set fasta_json = {"false_path": str($fasta_file), "name": str($fasta_file.name)} | |
141 $data_parameter_dict.update({"fasta": $fasta_json}) | |
142 | |
143 ## Retrieve the user email | |
144 #silent $data_parameter_dict.update({"user_email": str($__user_email__)}) | |
145 | |
146 #silent $data_parameter_dict.update({"tool_directory": str($__tool_directory__)}) | |
147 | |
148 #silent $data_parameter_dict.update({"extra_files_path": str($output.extra_files_path)}) | |
149 | |
150 #silent $data_parameter_dict.update({"debug_mode": str($advanced_options.debug_mode)}) | |
151 | |
152 with open(file_path, 'w') as f: | |
153 json.dump($data_parameter_dict, f) | |
154 </configfile> | |
155 </configfiles> | |
156 | |
157 <inputs> | |
158 <param | |
159 name="genome_name" | |
160 type="text" | |
161 size="30" | |
162 value="unknown" | |
163 label="JBrowse Hub Name" | |
164 /> | |
165 <param | |
166 format="fasta" | |
167 name="fasta_file" | |
168 type="data" | |
169 label="Reference genome" | |
170 /> | |
171 <repeat name="group" title="New group"> | |
172 <param type="text" name="group_name" label="Group name" value="Default group"/> | |
173 <repeat name="format" title="New track"> | |
174 <conditional name="formatChoice"> | |
175 <param name="format_select" type="select" label="Format"> | |
176 <option value="bam" selected="true">BAM</option> | |
177 <option value="bed">BED</option> | |
178 <option value="blastxml">BlastXML</option> | |
179 <option value="bigwig">BigWig</option> | |
180 <option value="gff3">GFF3</option> | |
181 <option value="gtf">GTF</option> | |
182 </param> | |
183 | |
184 <when value="bam"> | |
185 <param | |
186 format="bam" | |
187 name="BAM" | |
188 type="data" | |
189 label="BAM File" | |
190 /> | |
191 <param name="longLabel" type="text" size="30" value = "Sequence Alignment" label="Track label" /> | |
192 <param name="track_color" type="color" label="Track color" value="#000000"> | |
193 <sanitizer> | |
194 <valid initial="string.letters,string.digits"> | |
195 <add value="#"/> | |
196 </valid> | |
197 </sanitizer> | |
198 </param> | |
199 </when> | |
200 <when value="bed"> | |
201 <conditional name="bedChoice"> | |
202 <param name="bed_select" type="select" label="Bed Choice"> | |
203 <option value="bed_generic">BED format</option> | |
204 <option value="bed_simple_repeats_option">BED Simple repeat (bed4+12 / simpleRepeat.as)</option> | |
205 <option value="bed_splice_junctions_option">BED Splice junctions (bed12+1 / spliceJunctions.as)</option> | |
206 <option value="bed_blast_alignment_option">Blast alignments (bed12+12 / bigPsl.as)</option> | |
207 <option value="bed_blat_alignment_option">BLAT alignments (bigPsl / bigPsl.as)</option> | |
208 </param> | |
209 <when value="bed_generic"> | |
210 <param | |
211 format="bed" | |
212 name="BED_generic" | |
213 type="data" | |
214 label="Bed File" | |
215 /> | |
216 </when> | |
217 <when value="bed_simple_repeats_option"> | |
218 <param | |
219 format="bed" | |
220 name="BED_simple_repeats" | |
221 type="data" | |
222 label="Bed Simple Repeats (Bed4+12) File" | |
223 /> | |
224 </when> | |
225 <when value="bed_splice_junctions_option"> | |
226 <param | |
227 format="bed" | |
228 name="BED_splice_junctions" | |
229 type="data" | |
230 label="Bed Splice Junctions (Bed12+1) File" | |
231 /> | |
232 </when> | |
233 <when value="bed_blast_alignment_option"> | |
234 <param | |
235 format="bed" | |
236 name="BED_blast_alignment" | |
237 type="data" | |
238 label="Bed Blast Alignments (Bed12+12) File" | |
239 /> | |
240 </when> | |
241 <when value="bed_blat_alignment_option"> | |
242 <param | |
243 format="bed" | |
244 name="BED_blat_alignment" | |
245 type="data" | |
246 label="Bed BLAT Alignments (bigPsl) File" | |
247 /> | |
248 </when> | |
249 </conditional> | |
250 <param name="longLabel" type="text" size="30" label="Track label" /> | |
251 <param name="track_color" type="color" label="Track color" value="#000000"> | |
252 <sanitizer> | |
253 <valid initial="string.letters,string.digits"> | |
254 <add value="#"/> | |
255 </valid> | |
256 </sanitizer> | |
257 </param> | |
258 </when> | |
259 <when value="blastxml"> | |
260 <param | |
261 format="blastxml" | |
262 name="BlastXML" | |
263 type="data" | |
264 label="Blast Alignments File" | |
265 /> | |
266 <param name="longLabel" type="text" size="30" value="Blast Alignment" label="Track label" /> | |
267 <param name="track_color" type="color" label="Track color" value="#000000"> | |
268 <sanitizer> | |
269 <valid initial="string.letters,string.digits"> | |
270 <add value="#"/> | |
271 </valid> | |
272 </sanitizer> | |
273 </param> | |
274 </when> | |
275 <when value="bigwig"> | |
276 <param | |
277 format="bigwig" | |
278 name="BIGWIG" | |
279 type="data" | |
280 label="BIGWIG File" | |
281 /> | |
282 <param name="longLabel" type="text" size="30" value="Sequence Coverage" label="Track label" /> | |
283 <param name="track_color" type="color" label="Track color" value="#000000"> | |
284 <sanitizer> | |
285 <valid initial="string.letters,string.digits"> | |
286 <add value="#"/> | |
287 </valid> | |
288 </sanitizer> | |
289 </param> | |
290 </when> | |
291 <when value="gff3"> | |
292 <param | |
293 format="gff3" | |
294 name="GFF3" | |
295 type="data" | |
296 label="GFF3 File" | |
297 /> | |
298 <param name="longLabel" type="text" size="30" value="Gene Prediction" label="Track name" /> | |
299 <param name="track_color" type="color" label="Track color" value="#000000"> | |
300 <sanitizer> | |
301 <valid initial="string.letters,string.digits"> | |
302 <add value="#"/> | |
303 </valid> | |
304 </sanitizer> | |
305 </param> | |
306 </when> | |
307 <when value="gtf"> | |
308 <param | |
309 format="gtf" | |
310 name="GTF" | |
311 type="data" | |
312 label="GTF File" | |
313 /> | |
314 <param name="longLabel" type="text" size="30" value="Assembled Transcripts" label="Track name" /> | |
315 <param name="track_color" type="color" label="Track color" value="#000000"> | |
316 <sanitizer> | |
317 <valid initial="string.letters,string.digits"> | |
318 <add value="#"/> | |
319 </valid> | |
320 </sanitizer> | |
321 </param> | |
322 </when> | |
323 </conditional> | |
324 </repeat> | |
325 </repeat> | |
326 <conditional name="advanced_options"> | |
327 <param name="advanced_options_selector" type="select" label="Advanced options"> | |
328 <option value="off" selected="true">Hide advanced options</option> | |
329 <option value="on">Display advanced options</option> | |
330 </param> | |
331 <!-- TODO: Avoid redundancy here --> | |
332 <when value="on"> | |
333 <param name="debug_mode" type="select" label="Activate debug mode"> | |
334 <option value="false" selected="true">No</option> | |
335 <option value="true">Yes</option> | |
336 <help> | |
337 Use this option if you are a G-OnRamp developer | |
338 </help> | |
339 </param> | |
340 </when> | |
341 <when value="off"> | |
342 <param name="debug_mode" type="hidden" | |
343 value="false"> | |
344 </param> | |
345 </when> | |
346 </conditional> | |
347 </inputs> | |
348 | |
349 <outputs> | |
350 <data format="jbrowsehub" name="output" label="${tool.name}" /> | |
351 </outputs> | |
352 <tests> | |
353 <test> | |
354 <param name="genome_name" value="Dbia3"/> | |
355 <param name="fasta_file" value="common/dbia3.fa"/> | |
356 <output name="output" file="only_genome/only_genome.html"> | |
357 <!-- Use macro to check the whole common structure without repeated code --> | |
358 <expand macro="verify_hub_structure_no_track" test="only_genome" /> | |
359 </output> | |
360 </test> | |
361 </tests> | |
362 <help> | |
363 This Galaxy tool will create a jbrowse hub which including binary datasets and json datasets that can be used for | |
364 JBrowse visualization. | |
365 </help> | |
366 <citations> | |
367 </citations> | |
368 </tool> |