Mercurial > repos > jjohnson > bcftools_annotate
comparison bcftools_annotate.xml @ 0:a30804010531 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bcftools commit 21c66fb27c7e2fd21c7f7607b3b29e77e64fb86d-dirty
| author | jjohnson |
|---|---|
| date | Sat, 25 Jun 2016 20:46:09 -0400 |
| parents | |
| children | 6c6a06ac35c1 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:a30804010531 |
|---|---|
| 1 <?xml version='1.0' encoding='utf-8'?> | |
| 2 <tool name="bcftools @EXECUTABLE@" id="bcftools_@EXECUTABLE@" version="@VERSION@.0"> | |
| 3 <description>Annotate and edit VCF/BCF files</description> | |
| 4 <macros> | |
| 5 <token name="@EXECUTABLE@">annotate</token> | |
| 6 <import>macros.xml</import> | |
| 7 </macros> | |
| 8 <expand macro="requirements" /> | |
| 9 <expand macro="version_command" /> | |
| 10 <command detect_errors="aggressive"><![CDATA[ | |
| 11 @PREPARE_ENV@ | |
| 12 @PREPARE_INPUT_FILE@ | |
| 13 #set $annotation_file = None | |
| 14 #set $annotation_hdr = None | |
| 15 #set $section = $sec_annofile | |
| 16 #if $section.annofile.anno_fmt == 'vcf': | |
| 17 #set $annotation_file = 'annotations.vcf.gz' | |
| 18 bgzip -c "$section.annofile.annotations" > $annotation_file && | |
| 19 bcftools index $annotation_file && | |
| 20 #elif $section.annofile.anno_fmt == 'tab': | |
| 21 #if $section.annofile.annotations.ext == 'bed' | |
| 22 #set $annotation_file = 'annotations.bed.gz' | |
| 23 bgzip -c "$section.annofile.annotations" > $annotation_file && | |
| 24 tabix -s 1 -b 2 -e 3 $annotation_file && | |
| 25 #else: | |
| 26 #set $annotation_file = 'annotations.tab.gz' | |
| 27 bgzip -c "$section.annofile.annotations" > $annotation_file && | |
| 28 tabix -s 1 -b 2 -e 2 $annotation_file && | |
| 29 #end if | |
| 30 #if $section.annofile.header_file: | |
| 31 #set $annotation_hdr = $section.annofile.header_file | |
| 32 #elif $section.annofile.header_lines: | |
| 33 #set $annotation_hdr = 'annotation.hdr' | |
| 34 grep '^\#\#INFO' ${hdr_file} > $annotation_hdr && | |
| 35 #end if | |
| 36 #end if | |
| 37 | |
| 38 bcftools @EXECUTABLE@ | |
| 39 | |
| 40 #set $section = $sec_annofile | |
| 41 @COLUMNS@ | |
| 42 #if $annotation_file: | |
| 43 --annotations "${annotation_file}" | |
| 44 #end if | |
| 45 #if $annotation_hdr: | |
| 46 --header-lines "${annotation_hdr}" | |
| 47 #end if | |
| 48 | |
| 49 #if $section.set_id: | |
| 50 --set-id "${section.set_id}" | |
| 51 #end if | |
| 52 #if $section.mark_sites: | |
| 53 --mark-sites "${section.mark_sites}" | |
| 54 #end if | |
| 55 | |
| 56 #set $section = $sec_annotate | |
| 57 #if $section.rename_chrs: | |
| 58 --rename-chrs "${section.rename_chrs}" | |
| 59 #end if | |
| 60 #if $section.remove: | |
| 61 --remove "${section.remove}" | |
| 62 #end if | |
| 63 | |
| 64 ## Default section | |
| 65 #set $section = $sec_restrict | |
| 66 @INCLUDE@ | |
| 67 @EXCLUDE@ | |
| 68 @REGIONS@ | |
| 69 @SAMPLES@ | |
| 70 | |
| 71 @OUTPUT_TYPE@ | |
| 72 @THREADS@ | |
| 73 | |
| 74 ## Primary Input/Outputs | |
| 75 @INPUT_FILE@ | |
| 76 > "$output_file" | |
| 77 ]]> | |
| 78 </command> | |
| 79 <configfiles> | |
| 80 <configfile name="hdr_file"><![CDATA[#slurp | |
| 81 #if $sec_annofile.annofile.anno_fmt == 'tab' and str($sec_annofile.annofile.header_lines) != '': | |
| 82 $sec_annofile.annofile.header_lines.__str__.strip()#slurp | |
| 83 #end if]]></configfile> | |
| 84 </configfiles> | |
| 85 <inputs> | |
| 86 <expand macro="macro_input" /> | |
| 87 <section name="sec_annofile" expanded="false" title="Add Annotations"> | |
| 88 <expand macro="macro_columns" /> | |
| 89 <conditional name="annofile"> | |
| 90 <param name="anno_fmt" type="select" label="Annotations File"> | |
| 91 <option value="none">None</option> | |
| 92 <option value="vcf">From a VCF/BCF file</option> | |
| 93 <option value="tab">From a BED or tab-delimited file</option> | |
| 94 </param> | |
| 95 <when value="none"/> | |
| 96 <when value="vcf"> | |
| 97 <param name="annotations" type="data" format="vcf" label="Annotations VCF"/> | |
| 98 </when> | |
| 99 <when value="tab"> | |
| 100 <param name="annotations" type="data" format="tabular,bed" label="Annotations"> | |
| 101 <help><![CDATA[ | |
| 102 BED, or a tab-delimited file with mandatory columns CHROM, POS (or, alternatively, FROM and TO), | |
| 103 optional columns REF and ALT, and arbitrary number of annotation columns. | |
| 104 Note that in case of tab-delimited file, the coordinates POS, FROM and TO are one-based and inclusive. | |
| 105 ]]></help> | |
| 106 </param> | |
| 107 <param name="header_file" type="data" format="txt" label="Header Lines File" optional="True" help="lines which should be appended to the VCF header" /> | |
| 108 <param name="header_lines" type="text" area="True" label="Header Lines" optional="True" help="lines which should be appended to the VCF header" > | |
| 109 <help><![CDATA[ | |
| 110 ##INFO=<ID=NUMERIC_TAG,Number=1,Type=Integer,Description="Example header line"> | |
| 111 ##INFO=<ID=STRING_TAG,Number=1,Type=String,Description="Yet another header line"> | |
| 112 ]]></help> | |
| 113 <sanitizer sanitize="False"/> | |
| 114 </param> | |
| 115 </when> | |
| 116 </conditional> | |
| 117 <param name="mark_sites" type="text" value="" label="Mark Sites TAG" | |
| 118 help="add INFO/TAG flag to sites which are ("+") or are not ("-") listed in the annotations file" /> | |
| 119 <param name="set_id" type="text" value="" optional="true" label="Set Id"> | |
| 120 <help>Assign ID on the fly using the given format. | |
| 121 By default all existing IDs are replaced. | |
| 122 If the format string is preceded by "+", only missing IDs will be set. | |
| 123 For example: '%CHROM\_%POS\_%REF\_%FIRST_ALT' | |
| 124 </help> | |
| 125 <sanitizer sanitize="False"/> | |
| 126 <validator type="regex" message="">^([+]?(%[A-Z]+)(\_%[A-Z]+)*)?$</validator> | |
| 127 </param> | |
| 128 </section> | |
| 129 <section name="sec_annotate" expanded="false" title="Change Annotations"> | |
| 130 <param name="remove" type="text" value="" label="Remove annotations" optional="true"> | |
| 131 <help><![CDATA[ | |
| 132 List of annotations to remove. | |
| 133 Use "FILTER" to remove all filters or "FILTER/SomeFilter" to remove a specific filter. | |
| 134 Similarly, "INFO" can be used to remove all INFO tags and "FORMAT" to remove all FORMAT tags except GT. | |
| 135 To remove all INFO tags except "FOO" and "BAR", use "^INFO/FOO,INFO/BAR" (and similarly for FORMAT and FILTER). | |
| 136 "INFO" can be abbreviated to "INF" and "FORMAT" to "FMT". | |
| 137 ]]></help> | |
| 138 <validator type="regex" message="">^([+]?(%[A-Z]+)(\_%[A-Z]+)*)?$</validator> | |
| 139 </param> | |
| 140 <param name="rename_chrs" type="data" format="tabular" label="Rename CHROM" optional="True" | |
| 141 help="rename chromosomes according to the map in file, with old_name new_name pairs separated by whitespaces, each on a separate line." /> | |
| 142 </section> | |
| 143 <section name="sec_restrict" expanded="false" title="Restrict to"> | |
| 144 <expand macro="macro_include" /> | |
| 145 <expand macro="macro_exclude" /> | |
| 146 <expand macro="macro_regions" /> | |
| 147 <expand macro="macro_samples" /> | |
| 148 </section> | |
| 149 <expand macro="macro_select_output_type" /> | |
| 150 </inputs> | |
| 151 <outputs> | |
| 152 <expand macro="macro_vcf_output"/> | |
| 153 </outputs> | |
| 154 <tests> | |
| 155 <test> | |
| 156 <param name="input_file" ftype="vcf" value="annotate.vcf" /> | |
| 157 <param name="anno_fmt" value="tab" /> | |
| 158 <param name="annotations" value="annotate.tab" /> | |
| 159 <param name="header_file" value="annotate.hdr" /> | |
| 160 <param name="columns" value="CHROM,POS,REF,ALT,ID,QUAL,INFO/T_INT,INFO/T_FLOAT,INDEL" /> | |
| 161 <param name="output_type" value="v" /> | |
| 162 <output name="output_file"> | |
| 163 <assert_contents> | |
| 164 <has_text text="snp_3000150" /> | |
| 165 </assert_contents> | |
| 166 </output> | |
| 167 </test> | |
| 168 <test> | |
| 169 <param name="input_file" ftype="vcf" value="annotate.vcf" /> | |
| 170 <param name="anno_fmt" value="tab" /> | |
| 171 <param name="annotations" value="annotate2.tab" /> | |
| 172 <param name="header_file" value="annotate.hdr" /> | |
| 173 <param name="columns" value="CHROM,FROM,TO,T_STR" /> | |
| 174 <param name="output_type" value="v" /> | |
| 175 <output name="output_file"> | |
| 176 <assert_contents> | |
| 177 <has_text text="T_STR=region_3000150_3106154" /> | |
| 178 </assert_contents> | |
| 179 </output> | |
| 180 </test> | |
| 181 <test> | |
| 182 <param name="input_file" ftype="vcf" value="annotate.vcf" /> | |
| 183 <param name="anno_fmt" value="vcf" /> | |
| 184 <param name="annotations" value="annots.vcf" /> | |
| 185 <param name="columns" value="STR,ID,QUAL,FILTER" /> | |
| 186 <param name="output_type" value="v" /> | |
| 187 <output name="output_file"> | |
| 188 <assert_contents> | |
| 189 <has_text text="idIndel" /> | |
| 190 <has_text text="STR=testSNP" /> | |
| 191 </assert_contents> | |
| 192 </output> | |
| 193 </test> | |
| 194 <test> | |
| 195 <param name="input_file" ftype="vcf" value="annotate2.vcf" /> | |
| 196 <param name="anno_fmt" value="vcf" /> | |
| 197 <param name="annotations" value="annots2.vcf" /> | |
| 198 <param name="columns" value="ID,QUAL,FILTER,INFO,FMT" /> | |
| 199 <param name="output_type" value="v" /> | |
| 200 <output name="output_file"> | |
| 201 <assert_contents> | |
| 202 <has_text text="q99" /> | |
| 203 <has_text text="FLAG;IINT=88,99;IFLT=8.8,9.9;ISTR=888,999" /> | |
| 204 </assert_contents> | |
| 205 </output> | |
| 206 </test> | |
| 207 <test> | |
| 208 <param name="input_file" ftype="vcf" value="annotate2.vcf" /> | |
| 209 <param name="anno_fmt" value="vcf" /> | |
| 210 <param name="annotations" value="annots2.vcf" /> | |
| 211 <param name="columns" value="ID,QUAL,FILTER,INFO,FMT" /> | |
| 212 <param name="samples" value="A" /> | |
| 213 <param name="output_type" value="v" /> | |
| 214 <output name="output_file"> | |
| 215 <assert_contents> | |
| 216 <has_text text="q11" /> | |
| 217 <has_text text="FLAG;IINT=88,99;IFLT=8.8,9.9;ISTR=888,999" /> | |
| 218 </assert_contents> | |
| 219 </output> | |
| 220 </test> | |
| 221 <test> | |
| 222 <param name="input_file" ftype="vcf" value="annotate3.vcf" /> | |
| 223 <param name="anno_fmt" value="none" /> | |
| 224 <param name="remove" value="ID,QUAL,^FILTER/fltA,FILTER/fltB,^INFO/AA,INFO/BB,^FMT/GT,FMT/PL" /> | |
| 225 <param name="output_type" value="v" /> | |
| 226 <output name="output_file"> | |
| 227 <assert_contents> | |
| 228 <not_has_text text="ID=X" /> | |
| 229 </assert_contents> | |
| 230 </output> | |
| 231 </test> | |
| 232 <test> | |
| 233 <param name="input_file" ftype="vcf" value="annotate3.vcf" /> | |
| 234 <param name="anno_fmt" value="none" /> | |
| 235 <param name="remove" value="FORMAT" /> | |
| 236 <param name="output_type" value="v" /> | |
| 237 <output name="output_file"> | |
| 238 <assert_contents> | |
| 239 <not_has_text text="ID=PL" /> | |
| 240 </assert_contents> | |
| 241 </output> | |
| 242 </test> | |
| 243 | |
| 244 </tests> | |
| 245 <help><![CDATA[ | |
| 246 ================================== | |
| 247 bcftools @EXECUTABLE@ | |
| 248 ================================== | |
| 249 | |
| 250 Annotate and edit VCF/BCF files. | |
| 251 | |
| 252 Examples: | |
| 253 | |
| 254 # Remove three fields | |
| 255 bcftools annotate -x ID,INFO/DP,FORMAT/DP file.vcf.gz | |
| 256 | |
| 257 # Remove all INFO fields and all FORMAT fields except for GT and PL | |
| 258 bcftools annotate -x INFO,^FORMAT/GT,FORMAT/PL file.vcf | |
| 259 | |
| 260 # Add ID, QUAL and INFO/TAG, not replacing TAG if already present | |
| 261 bcftools annotate -a src.bcf -c ID,QUAL,+TAG dst.bcf | |
| 262 | |
| 263 # Carry over all INFO and FORMAT annotations except FORMAT/GT | |
| 264 bcftools annotate -a src.bcf -c INFO,^FORMAT/GT dst.bcf | |
| 265 | |
| 266 # Annotate from a tab-delimited file with six columns (the fifth is ignored), | |
| 267 # first indexing with tabix. The coordinates are 1-based. | |
| 268 tabix -s1 -b2 -e2 annots.tab.gz | |
| 269 bcftools annotate -a annots.tab.gz -h annots.hdr -c CHROM,POS,REF,ALT,-,TAG file.vcf | |
| 270 | |
| 271 # Annotate from a tab-delimited file with regions (1-based coordinates, inclusive) | |
| 272 tabix -s1 -b2 -e3 annots.tab.gz | |
| 273 bcftools annotate -a annots.tab.gz -h annots.hdr -c CHROM,FROM,TO,TAG inut.vcf | |
| 274 | |
| 275 # Annotate from a bed file (0-based coordinates, half-closed, half-open intervals) | |
| 276 bcftools annotate -a annots.bed.gz -h annots.hdr -c CHROM,FROM,TO,TAG input.vcf | |
| 277 | |
| 278 @REGIONS_HELP@ | |
| 279 @EXPRESSIONS_HELP@ | |
| 280 | |
| 281 @BCFTOOLS_MANPAGE@#@EXECUTABLE@ | |
| 282 | |
| 283 @BCFTOOLS_WIKI@ | |
| 284 ]]> | |
| 285 </help> | |
| 286 <expand macro="citations" /> | |
| 287 </tool> |
