| 
11
 | 
     1 <tool id="bcftools_filter" name="BCFtools filter" version="1.0.0">
 | 
| 
 | 
     2     <description>Apply fixed-threshold filters</description>
 | 
| 
23
 | 
     3     <requirements>
 | 
| 
 | 
     4         <requirement type="package" version="1.3">bcftools</requirement>
 | 
| 
 | 
     5     </requirements>
 | 
| 
11
 | 
     6     <command>
 | 
| 
 | 
     7         #if str( $input_file_index ) != "None":
 | 
| 
 | 
     8             ln -s -f $input input_file.${input.ext} &&
 | 
| 
 | 
     9             ln -s -f $input_file_index input_file.${input.ext}.tbi &&
 | 
| 
 | 
    10         #end if
 | 
| 
 | 
    11 
 | 
| 
 | 
    12         bcftools filter                    
 | 
| 
 | 
    13         --output "${output_file}"
 | 
| 
 | 
    14         --output-type "${output_type}"
 | 
| 
 | 
    15         #if str( $regions_file ) != "None":
 | 
| 
 | 
    16             --regions-file "${regions_file}"
 | 
| 
 | 
    17         #end if
 | 
| 
 | 
    18         #if str( $regions ) != "":
 | 
| 
 | 
    19             --regions "${regions}"
 | 
| 
 | 
    20         #end if
 | 
| 
 | 
    21         #if str( $targets_file ) != "None":
 | 
| 
 | 
    22             --targets-file "${targets_file}"
 | 
| 
 | 
    23         #end if
 | 
| 
 | 
    24         #if str( $targets ) != "":
 | 
| 
 | 
    25             --targets "${targets}"
 | 
| 
 | 
    26         #end if
 | 
| 
 | 
    27         #if str( $expr_cond.set_expr ) == "True":
 | 
| 
 | 
    28             #if str( $expr_cond.include_or_exclude ) == "include":
 | 
| 
 | 
    29                 --include "${expr_cond.expr}"
 | 
| 
 | 
    30             #else
 | 
| 
 | 
    31                 --exclude "${expr_cond.expr}"
 | 
| 
 | 
    32             #end if
 | 
| 
 | 
    33         #end if
 | 
| 
 | 
    34         #if str( $mode_plus ) == "true":
 | 
| 
 | 
    35             #if str( $mode_x ) == "true":
 | 
| 
 | 
    36                 --mode +x
 | 
| 
 | 
    37             #else
 | 
| 
 | 
    38                 --mode +
 | 
| 
 | 
    39             #end if
 | 
| 
 | 
    40         #elif str( $mode_x ) == "true"
 | 
| 
 | 
    41             --mode x
 | 
| 
 | 
    42         #end if
 | 
| 
 | 
    43         #if str( $soft_filter_cond.set_soft_filter ) == "True":
 | 
| 
 | 
    44             #if str( $soft_filter_cond.string_or_plus_cond.string_or_plus ) == "use_plus":
 | 
| 
 | 
    45                 --soft-filter +
 | 
| 
 | 
    46             #else
 | 
| 
 | 
    47                 --soft-filter "${soft_filter_cond.string_or_plus_cond.str}"
 | 
| 
 | 
    48             #end if
 | 
| 
 | 
    49         #end if
 | 
| 
 | 
    50         #if str( $set_gts_cond.set_gts ) == "True":
 | 
| 
 | 
    51             #if str( $set_gts_cond.gts ) == "period":
 | 
| 
 | 
    52                 --set-GTs .
 | 
| 
 | 
    53             #else
 | 
| 
 | 
    54                 --set-GTs 0
 | 
| 
 | 
    55             #end if
 | 
| 
 | 
    56         #end if
 | 
| 
 | 
    57 
 | 
| 
 | 
    58         #if str( $input_file_index ) != "None":
 | 
| 
 | 
    59             input_file.${input.ext}
 | 
| 
 | 
    60         #else
 | 
| 
 | 
    61             $input
 | 
| 
 | 
    62         #end if
 | 
| 
 | 
    63     </command>
 | 
| 
 | 
    64     <inputs>
 | 
| 
 | 
    65         <param name="input" type="data" format="vcf,bcf,bgzip" label="VCF or BCF input file" help="Input file can optionally be compressed and indexed using Bgzip and Tabix Galaxy tools. In this case, select bgzipped file here and index below."/>
 | 
| 
 | 
    66         <param name="input_file_index" type="data" optional="true" label="Input file index" help="Tabix-generated index for input file. Run Tabix Galaxy tool on bgzipped input file to create index."/>
 | 
| 
 | 
    67         <param name="output_type" type="select" label="Output data type">
 | 
| 
 | 
    68             <option value="v" selected="true">VCF</option>
 | 
| 
 | 
    69             <option value="b">BCF</option>
 | 
| 
 | 
    70         </param>
 | 
| 
 | 
    71         <param name="regions_file" type="data" optional="true" label="Regions file" help="-R. Regions specified in a VCF, BED, or tab-delimited file with columns CHROM, POS, and, optionally, POS_TO."/>
 | 
| 
 | 
    72         <param name="regions" type="text" size="80" optional="True" label="Regions list" help="-r. Comma-separated list of regions. Format: chr|chr:pos|chr:from-to|chr:from-[,...]">
 | 
| 
 | 
    73             <sanitizer invalid_char="">
 | 
| 
 | 
    74                 <valid initial="string.digits"><add value="CHRchr-:,"/> </valid>
 | 
| 
 | 
    75             </sanitizer>
 | 
| 
 | 
    76         </param>
 | 
| 
 | 
    77         <param name="targets_file" type="data" optional="true" label="Targets file" help="-T. Targets specified in a VCF, BED, or tab-delimited file with columns CHROM, POS, and, optionally, POS_TO."/>
 | 
| 
 | 
    78         <param name="targets" type="text" size="80" optional="True" label="Targets list" help="-t. Comma-separated list of targets. Format: [^]chr|chr:pos|chr:from-to|chr:from-[,...]">
 | 
| 
 | 
    79             <sanitizer invalid_char="">
 | 
| 
 | 
    80                 <valid initial="string.digits"><add value="CHRchr-:,^"/> </valid>
 | 
| 
 | 
    81             </sanitizer>
 | 
| 
 | 
    82         </param>
 | 
| 
 | 
    83         <conditional name="expr_cond">
 | 
| 
 | 
    84             <param name="set_expr" type="boolean" checked="False" label="Filter by expression" help="-i, e. Include/ exclude sites for which expression is true. Must use valid expression."/>
 | 
| 
 | 
    85             <when value="true">
 | 
| 
 | 
    86                 <param name="include_or_exclude" type="select" label="Include or exclude by expression">
 | 
| 
 | 
    87                     <option value="include">Include</option>
 | 
| 
 | 
    88                     <option value="exclude">Exclude</option>
 | 
| 
 | 
    89                 </param>
 | 
| 
 | 
    90                 <param name="expr" type="text" size="80" label="Expression">
 | 
| 
 | 
    91                     <sanitizer invalid_char="">
 | 
| 
 | 
    92                         <valid initial="string.letters,string.digits"><add value="~`!@#$%^&*()-_=+[{]}\|;:'",<.>?/ " /> </valid>
 | 
| 
 | 
    93                     </sanitizer>
 | 
| 
 | 
    94                 </param>
 | 
| 
 | 
    95             </when>
 | 
| 
 | 
    96         </conditional>
 | 
| 
 | 
    97         <param name="mode_x" type="boolean" checked="False" label="For sites that pass filter, reset filter to "PASS"" help="-m x. Default: When FILTER string is empty, set filter to "PASS". Do not change FILTER string otherwise."/>
 | 
| 
 | 
    98         <param name="mode_plus" type="boolean" checked="False" label="For sites that fail filter, append new FILTER string to existing FILTER string" help="-m +. Default: Replace existing FILTER string with new FILTER string."/>
 | 
| 
 | 
    99         <conditional name="soft_filter_cond">
 | 
| 
 | 
   100             <param name="set_soft_filter" type="boolean" checked="False" label="Annotate FILTER column" help="-s"/>
 | 
| 
 | 
   101             <when value="true">
 | 
| 
 | 
   102                 <conditional name="string_or_plus_cond">
 | 
| 
 | 
   103                     <param name="string_or_plus" type="select" label="Annotation string">
 | 
| 
 | 
   104                         <option value="use_plus" selected="true">Annotate with a pre-generated unique string  ("Filter1", "Filter2", etc.)</option>
 | 
| 
 | 
   105                         <option value="use_str">Choose annotation string</option>
 | 
| 
 | 
   106                     </param>
 | 
| 
 | 
   107                     <when value="use_str">
 | 
| 
 | 
   108                         <param name="str" type="text" size="80" label="String to annotate with" />
 | 
| 
 | 
   109                     </when>
 | 
| 
 | 
   110                 </conditional>
 | 
| 
 | 
   111             </when>
 | 
| 
 | 
   112         </conditional>
 | 
| 
 | 
   113         <conditional name="set_gts_cond">
 | 
| 
 | 
   114             <param name="set_gts" type="boolean" checked="False" label="Set genotype of samples that fail filter" help="-S"/>
 | 
| 
 | 
   115             <when value="true">
 | 
| 
 | 
   116                 <param name="gts" type="select" label="Genotype of failed samples">
 | 
| 
 | 
   117                     <option value="period" selected="true">.</option>
 | 
| 
 | 
   118                     <option value="ref_allele">Reference allele</option>
 | 
| 
 | 
   119                 </param>
 | 
| 
 | 
   120             </when>
 | 
| 
 | 
   121         </conditional>
 | 
| 
 | 
   122     </inputs>
 | 
| 
 | 
   123     <outputs>
 | 
| 
 | 
   124         <data name="output_file" format="vcf" label="${tool.name} on ${on_string}">
 | 
| 
 | 
   125             <change_format>
 | 
| 
 | 
   126                 <when input="output_type" value="b" format="bcf" />
 | 
| 
 | 
   127             </change_format>
 | 
| 
 | 
   128         </data>
 | 
| 
 | 
   129     </outputs>
 | 
| 
 | 
   130     <help>
 | 
| 
 | 
   131 **About this tool**
 | 
| 
 | 
   132 
 | 
| 
 | 
   133 **BCFtools filter**: Apply fixed-threshold filters.
 | 
| 
 | 
   134 
 | 
| 
 | 
   135 Please see https://samtools.github.io/bcftools/bcftools.html for more info on options.
 | 
| 
 | 
   136   </help>
 | 
| 
 | 
   137 </tool>
 |