comparison snipit.xml @ 1:9f23fe0cb70b draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snipit commit ec96004a9f92c601a3e6474efbe1bd408bed088d
author iuc
date Fri, 28 Oct 2022 20:58:45 +0000
parents 20b4c59bec12
children 92b9fd5f1f9f
comparison
equal deleted inserted replaced
0:20b4c59bec12 1:9f23fe0cb70b
1 <tool id="snipit" name="snipit" version="@TOOL_VERSION@+galaxy0"> 1 <tool id="snipit" name="snipit" version="@TOOL_VERSION@+galaxy0">
2 <description>Summarise snps relative to a reference sequence</description> 2 <description>Summarise snps relative to a reference sequence</description>
3 <macros> 3 <macros>
4 <token name="@TOOL_VERSION@">1.0.5</token> 4 <token name="@TOOL_VERSION@">1.0.7</token>
5 <xml name="handle_background" tokens="format">
6 <when value="@FORMAT@">
7 <param argument="--solid-background" name="transparent_background" type="boolean" truevalue="" falsevalue="--solid-background" label="Plot on transparent background?" />
8 </when>
9 </xml>
5 </macros> 10 </macros>
6 <requirements> 11 <requirements>
7 <requirement type="package" version="@TOOL_VERSION@">snipit</requirement> 12 <requirement type="package" version="@TOOL_VERSION@">snipit</requirement>
8 </requirements> 13 </requirements>
9 <command detect_errors="exit_code"><![CDATA[ 14 <command detect_errors="exit_code"><![CDATA[
10 snipit '$alignment' 15 MPLCONFIGDIR=.matplotlib snipit '$alignment'
11 #if $opt.reference 16 #if str($ref.select) == 'by_id'
12 -r '$opt.reference' 17 -r '$ref.id'
13 #end if 18 #end if
14 #if $opt.labels 19 #if str($style.labels.choose)
15 -l '$opt.labels' 20 -l '$style.labels.source'
16 #end if 21 #if str($style.labels.choose) == 'custom_csv'
17 --l-header '$opt.l_header' 22 --l-header '${style.labels.names_column},${style.labels.labels_column}'
18 -f '$opt.format' 23 #end if
19 --height '$opt.height' 24 #end if
20 --width '$opt.width' 25 -f $plot.format
21 --size-option '$opt.size_option' 26 #if str($plot.format) in ['png', 'svg', 'tiff']
22 $opt.flip_vertical 27 $plot.transparent_background
23 #if $opt.exclude_positions 28 #end if
24 --exclude-positions '$opt.exclude_positions' 29 $write_snps
25 #end if 30 #if $dims.height > 0
26 $opt.exclude_ambig_pos 31 --height $dims.height
27 $opt.sort_by_mutation_number 32 #end if
28 $opt.sort_by_id 33 #if $dims.width > 0
29 #if $opt.sort_by_mutations 34 --width $dims.width
30 --sort-by-mutations '$opt.sort_by_mutations' 35 #end if
31 #end if 36 $dims.size_option
32 $opt.high_to_low 37 $style.flip_vertical
33 -c '$opt.colour_palette' 38 #if len($pos_restrict.include_positions)
34 ]]> </command> 39 --include-positions
40 #for $p in $pos_restrict.include_positions
41 '$p.pos'
42 #end for
43 #end if
44 #if len($pos_restrict.exclude_positions)
45 --exclude-positions
46 #for $p in $pos_restrict.exclude_positions
47 '$p.pos'
48 #end for
49 #end if
50 $pos_restrict.exclude_ambig_pos
51 $style.sort.order
52 #if str($style.sort.order) == '--sort-by-mutation-number'
53 $style.sort.high_to_low
54 #else if str($style.sort.order) == '--sort-by-mutations'
55 #echo ','.join([str(p['pos']) for p in $style.sort.positions])
56 $style.sort.high_to_low
57 #end if
58 #if not str($style.colouring.palette)
59 --recombi-mode --recombi-references '$style.colouring.parent1,$style.colouring.parent2'
60 #else
61 -c $style.colouring.palette
62 #end if
63 ]]></command>
35 <inputs> 64 <inputs>
36 <param name="alignment" format="fasta" type="data" label="Input alignment fasta file" /> 65 <param name="alignment" format="fasta" type="data" label="Input alignment fasta file" />
37 <section name="opt" title="Optional arguments" expanded="true"> 66 <conditional name="ref">
38 <param name="reference" argument="-r" type="text" optional="true" label="Reference sequence (by sequence ID)" help="Indicates which sequence in the alignment is the reference (by sequence ID). Default: first sequence in alignment" /> 67 <param name="select" type="select" label="The reference sequence ...">
39 <param name="labels" argument="-l" type="data" format="csv" optional="true" label="Labels" help="Optional csv file of labels to show in output snipit plot. Default: sequence names"/> 68 <option value="first">is the first sequence in the input</option>
40 <param argument="--l-header" type="text" value="name,label" label="Label headers" help="Comma separated string of column headers in label csv. First field indicates sequence name column, second the label column. Default: 'name,label'" /> 69 <option value="by_id">should be picked via its ID</option>
41 <param name="format" argument="-f" type="select" value="png" label="Output file format" help="Format options. Default: png"> 70 </param>
71 <when value="first" />
72 <when value="by_id">
73 <param name="id" argument="--reference" type="text" label="ID of reference sequence" />
74 </when>
75 </conditional>
76 <section name="pos_restrict" title="Restrict genome positions to be plotted" expanded="false">
77 <repeat name='include_positions' title="Restrict plot to specific regions/positions" min="0" default="0">
78 <param argument="--include-positions" name="pos" type="text" label="Include position/region" help="A range (closed, inclusive; one-indexed) or specific position to include in the output, e.g. '100-150' or '100'">
79 <validator type="regex" message="Either a single position, e.g. 8347, or an interval like 8000-8500 is required">[0-9]+(-[0-9]+)*$</validator>
80 </param>
81 </repeat>
82 <repeat name='exclude_positions' title="Exclude specific regions/positions from plot" min="0" default="0">
83 <param argument="--exclude-positions" name="pos" type="text" label="Exclude position/region" help="A range (closed, inclusive; one-indexed) or specific position to exclude from the output, e.g. '100-150' or '100'; considered after any '--include-positions'.">
84 <validator type="regex" message="Either a single position, e.g. 8347, or an interval like 8000-8500 is required">[0-9]+(-[0-9]+)*$</validator>
85 </param>
86 </repeat>
87 <param argument="--exclude-ambig-pos" type="boolean" truevalue="--exclude-ambig-pos" falsevalue="" label="Exclude ambig positions?" help="Exclude positions with an ambiguous base in any sequences; considered after '--include-positions'." />
88 </section>
89 <section name="style" title="Customize rendering of samples and mutations" expanded="true">
90 <conditional name="labels">
91 <param name="choose" argument="-l" type="select" label="Provide custom labels for sequences?">
92 <option value="">No, just use the sequence identifiers as labels in the plot</option>
93 <option value="simple_csv">Yes, via a simple CSV dataset mapping names to labels</option>
94 <option value="custom_csv">Yes, via a custom CSV dataset with column specification</option>
95 </param>
96 <when value="" />
97 <when value="simple_csv">
98 <param argument="--labels" name="source" type="data" format="csv" label="Labels mapping source" help="This expects a CSV dataset with two columns named 'name' and 'label' where the values in the 'name' column must have matches for all sequence IDs (including the reference) in the alignment input." />
99 </when>
100 <when value="custom_csv">
101 <param argument="--labels" name="source" type="data" format="csv" label="Labels mapping source" help="Select a CSV dataset with an arbitrary number of named columns here and specify below which column contains the sequence IDs to be mapped and which one the labels to be used instead. The dataset must define mappings for all sequence IDs including the reference." />
102 <param name="names_column" type="text" label="Name of the sequence ID column" />
103 <param name="labels_column" type="text" label="Name of the column with desired labels" />
104 </when>
105 </conditional>
106 <conditional name="colouring">
107 <param name="palette" type="select" value="classic" label="Mutations colouring scheme" help="Mutations can be coloured by base change or, alternatively, by their presence/absence in any of two parent sequences in the alignment (recombinant mode).">
108 <option value="primary">primary</option>
109 <option value="classic" selected="true">classic</option>
110 <option value="purine-pyrimidine">purine-pyrimidine</option>
111 <option value="greyscale">greyscale</option>
112 <option value="wes">wes</option>
113 <option value="verity">verity</option>
114 <option value="">recombinant mutations colouring</option>
115 </param>
116 <when value="primary" />
117 <when value="classic" />
118 <when value="purine-pyrimidine" />
119 <when value="greyscale" />
120 <when value="wes" />
121 <when value="verity" />
122 <when value="">
123 <param name="parent1" type="text" label="Sequence ID of first recombinant parent sequence in alignment" />
124 <param name="parent2" type="text" label="Sequence ID of second recombinant parent sequence in alignment" />
125 </when>
126 </conditional>
127 <conditional name="sort">
128 <param name="order" type="select" label="Order of samples in the plot">
129 <option value="">Go with default</option>
130 <option value="--sort-by-id">Sort by sequence ID/label</option>
131 <option value="--sort-by-mutation-number">Sort by number of mutations</option>
132 <option value="--sort-by-mutations">Sort by bases at specified positions</option>
133 </param>
134 <when value="" />
135 <when value="--sort-by-id" />
136 <when value="--sort-by-mutation-number">
137 <param argument="--high-to-low" type="boolean" truevalue="--high-to-low" falsevalue="" label="Invert sort order" help="If selected sort sequences from highest to lowest number of mutations instead of from lowest to highest." />
138 </when>
139 <when value="--sort-by-mutations">
140 <repeat name="positions" title="Sort on" min="1" default="1">
141 <param name="pos" type="integer" min="1" value="1" label="Sort (alphabetically) by base at position" />
142 </repeat>
143 <param argument="--high-to-low" type="boolean" truevalue="--high-to-low" falsevalue="" label="Invert resulting sort order" />
144 </when>
145 </conditional>
146 <param argument="--flip-vertical" type="boolean" truevalue="--flip-vertical" falsevalue="" label="Flip plot orientation?" help="Flip the orientation of the plot so sequences are below the reference rather than above it." />
147 </section>
148 <conditional name="plot">
149 <param argument="--format" type="select" value="png" label="Plot output file format">
42 <option value="png" selected="true">png</option> 150 <option value="png" selected="true">png</option>
43 <option value="jpg">jpg</option> 151 <option value="jpg">jpg</option>
44 <option value="pdf">pdf</option> 152 <option value="pdf">pdf</option>
45 <option value="svg">svg</option> 153 <option value="svg">svg</option>
46 <option value="tiff">tiff</option> 154 <option value="tiff">tiff</option>
47 </param> 155 </param>
48 <param argument="--height" type="float" value="0.0" label="Figure height" help="Overwrite the default figure height." /> 156 <when value="jpg" />
49 <param argument="--width" type="float" value="0.0" label="Figure width" help="Overwrite the default figure width." /> 157 <when value="pdf" />
50 <param argument="--size-option" type="select" value="scale" label="Sizing options" help="Specify options for sizing. Options: expand, scale"> 158 <expand macro="handle_background" format="png" />
51 <option value="expand">expand</option> 159 <expand macro="handle_background" format="svg" />
52 <option value="scale" selected="true">scale</option> 160 <expand macro="handle_background" format="tiff" />
53 </param> 161 </conditional>
54 <param argument="--flip-vertical" type="boolean" truevalue="--flip-vertical" falsevalue="" value="false" label="Flip plot orientation?" help="Flip the orientation of the plot so sequences are below the reference rather than above it. Default: false" /> 162 <section name="dims" title="Customize plot dimensions" expanded="false">
55 <param argument="--exclude-positions" type="text" optional="true" label="Excluded positions" help="One or more range (closed, inclusive; one-indexed) or specific position to exclude in the output. Ex. '100-150' or Ex. '100 101' Considered after '--include-positions'." /> 163 <param argument="--width" type="float" value="0" min="0" label="Figure width" help="Set to 0 to keep default figure width." />
56 <param argument="--exclude-ambig-pos" type="boolean" truevalue="--exclude-ambig-pos" falsevalue="" value="false" label="Exclude ambig positions?" help="Exclude positions with ambig base in any sequences. Considered after '--include-positions'" /> 164 <param argument="--height" type="float" value="0" min="0" label="Figure height" help="Set to 0 to keep default figure height." />
57 <param argument="--sort-by-mutation-number" type="boolean" truevalue="--sort-by-mutation-number" falsevalue="" value="false" label="Sort by mutation number?" help="Render the graph with sequences sorted by the number of SNPs relative to the reference (fewest to most). Default: False" /> 165 <param argument="--size-option" type="select" value="scale" label="Plot sizing options">
58 <param argument="--sort-by-id" type="boolean" truevalue="--sort-by-id" falsevalue="" value="false" label="Sort by sequence ID?" help="Sort sequences alphabetically by sequence id. Default: False" /> 166 <option value="--size-option expand">expand</option>
59 <param argument="--sort-by-mutations" type="text" optional="true" label="Sort by mutations" help="Sort sequences by bases at specified positions. Positions are comma separated integers. Ex. '1,2,3'" /> 167 <option value="" selected="true">scale</option>
60 <param argument="--high-to-low" type="boolean" truevalue="--high-to-low" falsevalue="" value="false" label="Sort high to low?" help="If 'sort by mutation number' is selected, show the sequences with the fewest SNPs closest to the reference. Default: False" />
61 <param name="colour_palette" argument="-c" type="select" value="classic" label="Colour palette" help="Specify colour palette. Options: primary, classic, purine-pyrimidine, greyscale, wes, verity">
62 <option value="primary">primary</option>
63 <option value="classic" selected="true">classic</option>
64 <option value="purine-pyrimidine">purine-pyrimidine</option>
65 <option value="greyscale">greyscale</option>
66 <option value="wes">wes</option>
67 <option value="verity">verity</option>
68 </param> 168 </param>
69 </section> 169 </section>
170 <param argument="--write-snps" type="boolean" truevalue="-s" falsevalue="" label="Write out SNPs?" help="Produces extra CSV output with lists of SNPs per sequence in the alignment if enabled." />
70 </inputs> 171 </inputs>
71 <outputs> 172 <outputs>
72 <data name="snp_plot" format="png" label="snp plot" from_work_dir="snp_plot.*"> 173 <data name="snp_plot" format="png" label="snipit on ${on_string}: Plot" from_work_dir="snp_plot.*">
73 <change_format> 174 <change_format>
74 <when input="opt.format" value="jpg" format="jpg" /> 175 <when input="plot.format" value="jpg" format="jpg" />
75 <when input="opt.format" value="pdf" format="pdf" /> 176 <when input="plot.format" value="pdf" format="pdf" />
76 <when input="opt.format" value="svg" format="svg" /> 177 <when input="plot.format" value="svg" format="svg" />
77 <when input="opt.format" value="tiff" format="tiff" /> 178 <when input="plot.format" value="tiff" format="tiff" />
78 </change_format> 179 </change_format>
180 </data>
181 <data name="snps" format="csv" label="snipit on ${on_string}: SNPs" from_work_dir="snps.csv">
182 <filter>write_snps</filter>
183 <actions>
184 <action name="column_names" type="metadata" default="record,snps,num_snps" />
185 </actions>
79 </data> 186 </data>
80 </outputs> 187 </outputs>
81 <tests> 188 <tests>
82 <test> 189 <test expect_num_outputs="2">
83 <param name="alignment" value="input.fasta" /> 190 <param name="alignment" value="input.fasta" />
84 <output name="snp_plot" ftype="png" file="snp_plot.png" compare="sim_size"/> 191 <param name="write_snps" value="true" />
85 </test> 192 <conditional name="plot">
86 <test> 193 <param name="transparent_background" value="true" />
87 <param name="alignment" value="input.fasta" /> 194 </conditional>
88 <param name="reference" value="USA_2" /> 195 <output name="snp_plot" ftype="png" file="snp_plot.png" compare="sim_size" />
89 <param name="format" value="pdf" /> 196 <output name="snps" ftype="csv" file="snps.csv" />
90 <param name="flip_vertical" value="true" /> 197 </test>
198 <test expect_num_outputs="1">
199 <param name="alignment" value="input.fasta" />
200 <conditional name="ref">
201 <param name="select" value="by_id" />
202 <param name="id" value="USA_2" />
203 </conditional>
204 <section name="style">
205 <param name="flip_vertical" value="true" />
206 </section>
207 <conditional name="plot">
208 <param name="format" value="pdf" />
209 </conditional>
210 <assert_command>
211 <has_text text="-r 'USA_2'" />
212 <has_text text="--flip-vertical" />
213 </assert_command>
91 <output name="snp_plot" ftype="pdf" file="snp_plot.pdf" compare="sim_size" /> 214 <output name="snp_plot" ftype="pdf" file="snp_plot.pdf" compare="sim_size" />
92 </test> 215 </test>
93 <test> 216 <test expect_num_outputs="1">
94 <param name="alignment" value="input.fasta" /> 217 <param name="alignment" value="input.fasta" />
95 <param name="format" value="jpg" /> 218 <section name="style">
96 <param name="colour_palette" value="verity" /> 219 <conditional name="colouring">
97 <output name="snp_plot" ftype="jpg" file="snp_plot.jpg" /> 220 <param name="palette" value="verity" />
98 </test> 221 </conditional>
99 <test> 222 </section>
100 <param name="alignment" value="input.fasta" /> 223 <conditional name="plot">
101 <param name="excluded_positions" value="1-100" /> 224 <param name="format" value="jpg" />
102 <param name="exclude_ambig_pos" value="true" /> 225 <param name="transparent_background" value="true" />
103 <param name="high_to_low" value="true" /> 226 </conditional>
104 <output name="snp_plot" ftype="png" file="snp_plot_ex.png" compare="sim_size" /> 227 <output name="snp_plot" ftype="jpg" file="snp_plot.jpg" compare="sim_size" />
105 </test> 228 </test>
229 <test expect_num_outputs="1">
230 <param name="alignment" value="input.fasta" />
231 <section name="pos_restrict">
232 <repeat name="include_positions">
233 <param name="pos" value="1-10000" />
234 </repeat>
235 <repeat name="include_positions">
236 <param name="pos" value="10001-30000" />
237 </repeat>
238 <repeat name="exclude_positions">
239 <param name="pos" value="1000-2000" />
240 </repeat>
241 <param name="exclude_ambig_pos" value="true" />
242 </section>
243 <section name="style">
244 <conditional name="sort">
245 <param name="order" value="--sort-by-mutations" />
246 <repeat name="positions">
247 <param name="pos" value="3" />
248 </repeat>
249 <repeat name="positions">
250 <param name="pos" value="1" />
251 </repeat>
252 <repeat name="positions">
253 <param name="pos" value="2" />
254 </repeat>
255 <param name="high_to_low" value="true" />
256 </conditional>
257 </section>
258 <conditional name="plot">
259 <param name="format" value="svg" />
260 <param name="transparent_background" value="true" />
261 </conditional>
262 <assert_command>
263 <has_text text="--include-positions '1-10000' '10001-30000'" />
264 <has_text text="--exclude-positions '1000-2000'" />
265 <has_text text="--exclude-ambig-pos" />
266 <has_text text="--sort-by-mutations 3,1,2" />
267 <has_text text="--high-to-low" />
268 </assert_command>
269 <output name="snp_plot" ftype="svg">
270 <assert_contents>
271 <!-- check that the plot does NOT refer to excluded
272 position 1059, uses darkseagreen (to highlight Ts) and
273 transparent (i.e. NOT white) background -->
274 <not_has_text text="&lt;!-- 1059 --&gt;" />
275 <has_text text="style=&quot;fill: #8fbc8f" />
276 <not_has_text text="style=&quot;fill: #ffffff&quot;" />
277 </assert_contents>
278 </output>
279 </test>
280 <test expect_num_outputs="1">
281 <param name="alignment" value="input.fasta" />
282 <section name="style">
283 <conditional name="colouring">
284 <param name="palette" value="" />
285 <param name="parent1" value="USA_1" />
286 <param name="parent2" value="USA_5" />
287 </conditional>
288 </section>
289 <conditional name="plot">
290 <param name="format" value="svg" />
291 </conditional>
292 <output name="snp_plot" ftype="svg">
293 <assert_contents>
294 <!-- check that the plot does mention position 1059,
295 uses goldenrod and #EA5463 as colors (to
296 indicate private and parent2 mutations, respectively, in
297 recombi-mode) and uses a solid white background -->
298 <has_text text="&lt;!-- 1059 --&gt;" />
299 <has_text text="style=&quot;fill: #daa520" />
300 <has_text text="style=&quot;fill: #ea5463" />
301 <has_text text="style=&quot;fill: #ffffff&quot;" />
302 </assert_contents>
303 </output>
304 </test>
305 <test expect_num_outputs="1">
306 <param name="alignment" value="input.fasta" />
307 <section name="style">
308 <conditional name="labels">
309 <param name="choose" value="custom_csv" />
310 <param name="source" value="custom_labels.csv" />
311 <param name="names_column" value="ori" />
312 <param name="labels_column" value="new" />
313 </conditional>
314 </section>
315 <conditional name="plot">
316 <param name="format" value="svg" />
317 </conditional>
318 <output name="snp_plot" ftype="svg">
319 <assert_contents>
320 <!-- check that the plot does not mention the original
321 seq IDs but the mapped labels -->
322 <not_has_text text="USA_" />
323 <has_text text="SAMPLE_" />
324 </assert_contents>
325 </output>
326 </test>
327
106 </tests> 328 </tests>
107 <help><![CDATA[ 329 <help><![CDATA[
108 **What it does** 330 **What it does**
109 331
110 Snipit finds the SNPs relative to a reference in a multiple sequence alignment and highlights these changes as a figure. 332 Snipit finds the SNPs relative to a reference in a multiple sequence alignment and highlights these changes as a figure.