|
4 | 4 | <import>snpEff_macros.xml</import> |
5 | 5 | </macros> |
6 | 6 | <requirements> |
7 | | - <expand macro="requirement" /> |
| 7 | + <expand macro="requirement"> |
| 8 | + <requirement type="package" version="9.5">coreutils</requirement> |
| 9 | + </expand> |
8 | 10 | </requirements> |
9 | 11 | <expand macro="stdio" /> |
10 | 12 | <expand macro="version_command" /> |
|
47 | 49 | #if $intervals ### fix this for multiple dataset input |
48 | 50 | -interval intervals.bed |
49 | 51 | #end if |
50 | | - #if $statsFile: |
51 | | - -stats '$statsFile' |
52 | | - #end if |
53 | | - #if $csvStats: |
54 | | - -csvStats '$csvFile' |
55 | | - #end if |
56 | 52 | #if str($chr).strip() != '': |
57 | 53 | -chr '$chr' |
| 54 | + #end if |
| 55 | + #if $generate_stats or $generate_gene_stats or $csvStats: |
| 56 | + #if $csvStats: |
| 57 | + $csvStats snpeff_stats.csv |
| 58 | + #end if |
| 59 | + #if $generate_stats or ($generate_gene_stats and not $csvStats): |
| 60 | + ## the base name passed in via the -csvStats or the -s option also determines the name of the genes.txt file |
| 61 | + ## so in the absence of the first we need the second to have a consistent name of the genes.txt file |
| 62 | + -s snpeff_stats.html |
| 63 | + #end if |
| 64 | + #else: |
| 65 | + ## when no stats output is requested by the user, we can make things a little more efficient |
| 66 | + ## by telling snpEff that it doesn't have to write even the default (html and genes.txt) ones. |
| 67 | + -noStats |
58 | 68 | #end if |
59 | 69 | $noLog |
60 | 70 | ## Regulation names can include parentheses: H3K4me3-MSC_(VB)_enriched_sites |
|
88 | 98 | '$snpDb.genome_version' |
89 | 99 | #end if |
90 | 100 | '$input' > '$snpeff_output' |
91 | | - #if $statsFile: |
92 | | - && |
93 | | - #import os |
94 | | - #if $csvStats: |
95 | | - #set $genes_file = str($csvFile) + '.genes.txt' |
96 | | - #else |
97 | | - #set $genes_file = str($statsFile) + '.genes.txt' |
98 | | - #end if |
99 | | - #set $genes_file_name = os.path.split($genes_file)[-1] |
100 | | - mkdir '$statsFile.files_path' && |
101 | | - mv '$genes_file' '#echo os.path.join($statsFile.files_path, $genes_file_name)#' |
| 101 | + #if $generate_gene_stats: |
| 102 | + ## remove the first, unnecessary comment line from the output |
| 103 | + && tail -n+2 snpeff_stats.genes.txt > genes.txt |
| 104 | + #end if |
| 105 | + #if $generate_stats: |
| 106 | + ## independently of whether the user asked for the gene.txt file, |
| 107 | + ## we need to add it to files_path because the stats html report links to it. |
| 108 | + && mkdir '$statsFile.files_path' && |
| 109 | + mv snpeff_stats.genes.txt $statsFile.files_path |
102 | 110 | #end if |
103 | 111 | ]]></command> |
104 | 112 | <inputs> |
|
114 | 122 | <option value="bedAnn">BED annotations</option> |
115 | 123 | </param> |
116 | 124 | <param argument="-csvStats" type="boolean" truevalue="-csvStats" falsevalue="" checked="false" label="Create CSV report?" help="Useful for downstream analyses and report generation" /> |
117 | | - <param argument="-noStats" name="generate_stats" type="boolean" truevalue="" falsevalue="-noStats" checked="true" label="Produce Summary Stats?" help="Generates an HTML summary of results"/> |
| 125 | + <param name="generate_stats" type="boolean" checked="true" label="Produce Summary Stats?" help="Generates an HTML summary of results"/> |
| 126 | + <param name="generate_gene_stats" type="boolean" label="Produce Gene Statistics output?" help="Generates a table of effects per gene as an extra output"/> |
118 | 127 | <conditional name="snpDb"> |
119 | 128 | <param name="genomeSrc" type="select" label="Genome source"> |
120 | 129 | <!-- These options are referenced in the help section of SnpEff download tool. If you change them, change help of SnpEff download as well --> |
|
127 | 136 | <param name="genomeVersion" type="select" label="Genome"> |
128 | 137 | <!--GENOME DESCRIPTION--> |
129 | 138 | <options from_data_table="snpeffv_genomedb"> |
130 | | - <filter type="static_value" name="snpeff_version" value="@SNPEFF_VERSION@" column="1"/> |
131 | | - <filter type="unique_value" column="2" /> |
| 139 | + <filter type="regexp" column="1" value="@COMPATIBLE_DB_VERSIONS_REGEX@" /> |
| 140 | + <filter type="unique_value" column="2" /> |
132 | 141 | </options> |
133 | 142 | </param> |
134 | 143 | <section name="reg_section" expanded="false" title="Regulation options"> |
135 | 144 | <param name="regulation" type="select" display="checkboxes" multiple="true" label="Non-coding and regulatory annotation" help="These are available for only a few genomes"> |
136 | 145 | <options from_data_table="snpeffv_regulationdb"> |
137 | | - <filter type="param_value" ref="genomeVersion" key="genome" column="2" /> |
| 146 | + <filter type="regexp" column="1" value="@COMPATIBLE_DB_VERSIONS_REGEX@" /> |
| 147 | + <filter type="param_value" ref="genomeVersion" column="2" /> |
138 | 148 | <filter type="unique_value" column="3" /> |
139 | 149 | </options> |
140 | 150 | </param> |
141 | 151 | </section> |
142 | 152 | </when> |
143 | 153 | <when value="history"> |
144 | 154 | <param name="snpeff_db" type="data" format="snpeffdb" label="@SNPEFF_VERSION@ Genome Data"> |
145 | | - <validator type="expression" message="This version of SnpEff will only work with @SNPEFF_VERSION@ genome databases">value is not None and value.metadata.snpeff_version == "@SNPEFF_VERSION@"</validator> |
| 155 | + <validator type="expression" message="This version of SnpEff will only work with @COMPATIBLE_DB_VERSIONS_STRING@ genome databases">value.metadata.snpeff_version in @COMPATIBLE_DB_VERSIONS@</validator> |
146 | 156 | </param> |
147 | 157 | <section name="reg_section" expanded="false" title="Regulation options"> |
148 | 158 | <!-- From metadata --> |
|
160 | 170 | </when> |
161 | 171 | <when value="custom"> |
162 | 172 | <param name="snpeff_db" type="data" format="snpeffdb" label="@SNPEFF_VERSION@ Genome Data"> |
163 | | - <validator type="expression" message="This version of SnpEff will only work with @SNPEFF_VERSION@ genome databases">value is not None and value.metadata.snpeff_version == "@SNPEFF_VERSION@"</validator> |
| 173 | + <validator type="expression" message="This version of SnpEff will only work with @COMPATIBLE_DB_VERSIONS_STRING@ genome databases">value.metadata.snpeff_version in @COMPATIBLE_DB_VERSIONS@</validator> |
164 | 174 | </param> |
165 | 175 | <param name="codon_table" type="select" label="Select genetic code for this sequence" help="If this sequence uses non-standard genetic code, select one from these options"> |
166 | 176 | <option selected="true" value="Standard">Standard</option> |
|
188 | 198 | <option value="Trematode_Mitochondrial">Trematode_Mitochondrial</option> |
189 | 199 | <option value="Scenedesmus_obliquus_Mitochondrial">Scenedesmus_obliquus_Mitochondrial</option> |
190 | 200 | <option value="Thraustochytrium_Mitochondrial">Thraustochytrium_Mitochondrial</option> |
191 | | - </param> |
| 201 | + </param> |
192 | 202 | </when> |
193 | 203 | </conditional> |
194 | 204 | <param name="udLength" argument="-ud" type="select" label="Upstream / Downstream length"> |
|
328 | 338 | <when input="outputConditional.outputFormat" value="bedAnn" format="bed" /> |
329 | 339 | </change_format> |
330 | 340 | </data> |
331 | | - <data name="statsFile" format="html" label="${tool.name} on ${on_string} - HTML stats"> |
| 341 | + <data name="statsFile" format="html" label="${tool.name} on ${on_string} - HTML stats" from_work_dir="snpeff_stats.html"> |
332 | 342 | <filter>generate_stats</filter> |
333 | 343 | </data> |
334 | | - <data name="csvFile" format="csv" label="${tool.name} on ${on_string} - CSV stats"> |
| 344 | + <data name="genes_file" format="tabular" label="${tool.name} on ${on_string} - Gene stats" from_work_dir="genes.txt"> |
| 345 | + <filter>generate_gene_stats</filter> |
| 346 | + </data> |
| 347 | + <data name="csvFile" format="txt" label="${tool.name} on ${on_string} - CSV stats" from_work_dir="snpeff_stats.csv"> |
335 | 348 | <filter>csvStats</filter> |
336 | 349 | </data> |
337 | 350 | </outputs> |
338 | 351 | <tests> |
| 352 | + <test expect_num_outputs="1"> |
| 353 | + <param name="input" ftype="vcf" value="input.vcf"/> |
| 354 | + <param name="inputFormat" value="vcf"/> |
| 355 | + <param name="outputFormat" value="vcf"/> |
| 356 | + <conditional name="snpDb"> |
| 357 | + <param name="genomeSrc" value="cached"/> |
| 358 | + <param name="genomeVersion" value="ebola_zaire"/> |
| 359 | + </conditional> |
| 360 | + <param name="udLength" value="0"/> |
| 361 | + <param name="generate_stats" value="false"/> |
| 362 | + <output name="snpeff_output"> |
| 363 | + <assert_contents> |
| 364 | + <has_text_matching expression="KJ660346.1\t572\t.*missense_variant" /> |
| 365 | + <has_text_matching expression="KJ660346.1\t1024\t.*synonymous_variant" /> |
| 366 | + </assert_contents> |
| 367 | + </output> |
| 368 | + </test> |
339 | 369 | <test expect_num_outputs="2"> |
340 | 370 | <param name="input" ftype="vcf" value="input.vcf"/> |
341 | 371 | <param name="inputFormat" value="vcf"/> |
342 | 372 | <param name="outputFormat" value="vcf"/> |
343 | | - <param name="genomeSrc" value="named"/> |
344 | | - <param name="genome_version" value="ebola_zaire"/> |
| 373 | + <conditional name="snpDb"> |
| 374 | + <param name="genomeSrc" value="cached"/> |
| 375 | + <param name="genomeVersion" value="ebola_zaire"/> |
| 376 | + </conditional> |
345 | 377 | <param name="udLength" value="0"/> |
346 | | - <param name="generate_stats" value="true"/> |
347 | 378 | <output name="snpeff_output"> |
348 | 379 | <assert_contents> |
349 | 380 | <has_text_matching expression="KJ660346.1\t572\t.*missense_variant" /> |
|
356 | 387 | </assert_contents> |
357 | 388 | </output> |
358 | 389 | </test> |
| 390 | + <test expect_num_outputs="2"> |
| 391 | + <param name="input" ftype="vcf" value="input.vcf"/> |
| 392 | + <param name="inputFormat" value="vcf"/> |
| 393 | + <param name="outputFormat" value="vcf"/> |
| 394 | + <conditional name="snpDb"> |
| 395 | + <param name="genomeSrc" value="cached"/> |
| 396 | + <param name="genomeVersion" value="ebola_zaire"/> |
| 397 | + </conditional> |
| 398 | + <param name="udLength" value="0"/> |
| 399 | + <param name="generate_stats" value="false"/> |
| 400 | + <param name="generate_gene_stats" value="true"/> |
| 401 | + <output name="snpeff_output"> |
| 402 | + <assert_contents> |
| 403 | + <has_text_matching expression="KJ660346.1\t572\t.*missense_variant" /> |
| 404 | + <has_text_matching expression="KJ660346.1\t1024\t.*synonymous_variant" /> |
| 405 | + </assert_contents> |
| 406 | + </output> |
| 407 | + <output name="genes_file"> |
| 408 | + <assert_contents> |
| 409 | + <has_text text="#GeneName"/> |
| 410 | + </assert_contents> |
| 411 | + </output> |
| 412 | + </test> |
359 | 413 | <!-- Test interval option--> |
360 | 414 | <test expect_num_outputs="2"> |
361 | 415 | <param name="input" ftype="vcf" value="input.vcf"/> |
362 | 416 | <param name="inputFormat" value="vcf"/> |
363 | 417 | <param name="outputFormat" value="vcf"/> |
364 | | - <param name="genomeSrc" value="named"/> |
365 | | - <param name="interval" value="intervals.bed"/> |
366 | | - <param name="genome_version" value="ebola_zaire"/> |
| 418 | + <conditional name="snpDb"> |
| 419 | + <param name="genomeSrc" value="cached"/> |
| 420 | + <param name="genomeVersion" value="ebola_zaire"/> |
| 421 | + </conditional> |
| 422 | + <param name="intervals" value="intervals.bed"/> |
367 | 423 | <param name="udLength" value="0"/> |
368 | 424 | <param name="generate_stats" value="false"/> |
369 | 425 | <param name="csvStats" value="true"/> |
|
0 commit comments