view bcftools_filter.xml @ 22:46fcafba49ec draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bcftools commit 784611c9caf2680d41414ca2880b93a69d719701
author iuc
date Sun, 18 Aug 2024 10:20:55 +0000
parents e7452697afd9
children
line wrap: on
line source

<tool name="bcftools @EXECUTABLE@" id="bcftools_@EXECUTABLE@" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>Apply fixed-threshold filters</description>
    <macros>
        <token name="@EXECUTABLE@">filter</token>
        <import>macros.xml</import>
    </macros>
    <expand macro="bio_tools" />
    <expand macro="requirements" />
    <expand macro="version_command" />
    <command detect_errors="aggressive"><![CDATA[
@PREPARE_ENV@
@PREPARE_INPUT_FILE@
#set $section = $sec_restrict
@PREPARE_TARGETS_FILE@
@PREPARE_REGIONS_FILE@

bcftools @EXECUTABLE@

## Filter section
#set $section = $sec_filter
#if $section.SnpGap:
  --SnpGap "${section.SnpGap}"
#end if
#if $section.IndelGap:
  --IndelGap "${section.IndelGap}"
#end if
#if $section.mode:
  #set $mode = str($section.mode).replace(',','')
  --mode '$mode'
#end if
#if $section.conditional_soft_filter.selector == 'enabled':
  --soft-filter '${section.conditional_soft_filter.soft_filter}'
  @MASK@
#end if
#if $section.select_set_GTs:
  --set-GTs "${section.select_set_GTs}"
#end if

#set $section = $sec_restrict
@REGIONS@
@TARGETS@
@INCLUDE@
@EXCLUDE@

@OUTPUT_TYPE@
@THREADS@

## Primary Input/Outputs
@INPUT_FILE@
> '$output_file'
]]>
    </command>
    <inputs>
        <expand macro="macro_input" />
        <section name="sec_restrict" expanded="false" title="Restrict to">
            <expand macro="macro_restrict" />
            <expand macro="macro_restrict" type="target" label_type="Target" />
            <expand macro="macro_include" />
            <expand macro="macro_exclude" />
        </section>
        <section name="sec_filter" expanded="false" title="Filter Options">
            <param name="SnpGap" type="integer" label="Snpgap" optional="True" help="(-g) Filter SNPs within &lt;int&gt; base pairs of an indel" />
            <param name="IndelGap" type="integer" label="Indelgap" optional="True" help="(-G) Filter clusters of indels separated by &lt;int&gt; or fewer base pairs allowing only one to pass" />
            <param name="mode" type="select" label="Mode FILTER annotation" optional="true" multiple="true" display="checkboxes">
                <help>(-m)
                 The default mode replaces existing filters of failed sites with a new FILTER string 
                 while leaving sites which pass untouched when non-empty 
                 and setting to "PASS" when the FILTER string is absent.
                </help>
                <option value="+">(+) append new FILTER strings of failed sites instead of replacing them</option>
                <option value="x">(x) resets filters of sites which pass to "PASS"</option>
            </param>
            <conditional name="conditional_soft_filter">
                <param name="selector" type="select" label="Perform soft filtering">
                    <option value="disabled">Disabled</option>
                    <option value="enabled">Enabled</option>
                </param>
                <when value="disabled"/>
                <when value="enabled">
                    <param argument="--soft-filter" type="text" value="" label="Soft Filter" optional="true">
                        <help><![CDATA[ (-s) 
                           Annotate FILTER column with STRING or, with +, a unique filter name generated by the program ("Filter%d").
                        ]]></help>
                    </param>
                    <expand macro="macro_restrict" type="mask" label_type="Mask"/>
                </when>
            </conditional>

            <param name="select_set_GTs" type="select" label="Set genotypes of failed samples"  optional="true" help="(-S)">
                <option value=".">to missing (.)</option>
                <option value="0">to REF (0)</option>
            </param>
        </section>
        <expand macro="macro_select_output_type" />
    </inputs>
    <outputs>
        <expand macro="macro_vcf_output"/>
    </outputs>
    <tests>
        <test>
            <param name="input_file" ftype="vcf" value="filter.1.vcf" />
            <param name="mode" value="x" />
            <param name="SnpGap" value="2" />
            <param name="IndelGap" value="2" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text text="PASS" />
                    <not_has_text text="1006" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="filter.2.vcf" />
            <param name="exclude" value="QUAL==59.2 || (INDEL=0 &amp; (FMT/GQ=25 | FMT/DP=10))" />
            <param name="soft_filter" value="Modified" />
            <param name="select_set_GTs" value="." />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text text="genotypes" />
                    <has_text text="AN=2;AC=1" />
                    <has_text_matching expression="TAAAA\tTA,T\t61.5\tPASS" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="filter.3.vcf" />
            <param name="exclude" value="INFO/DP=19" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <not_has_text text="3162006" />
                    <has_text text="3162007" />
                </assert_contents>
            </output>
        </test>

        <test>
            <param name="input_file" ftype="vcf" value="filter.3.vcf" />
            <param name="exclude" value="INFO/DP=19" />
            <section name="sec_filter">
                <conditional name="conditional_soft_filter">
                    <param name="selector" value="enabled"/>
                    <param name="soft_filter" value="XX" />
                </conditional>
            </section>
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="\tXX\tDP=19" />
                    <has_text_matching expression="\tq20\tAO" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="filter.3.vcf" />
            <param name="exclude" value="INFO/DP=19" />
            <section name="sec_filter">
                <conditional name="conditional_soft_filter">
                    <param name="selector" value="enabled"/>
                    <param name="soft_filter" value="XX" />
                    <param name="mode" value="+" />
                </conditional>
            </section>
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="238\tXX\tDP=19" />
                    <has_text_matching expression="\tq20\tAO" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="filter.3.vcf" />
            <param name="exclude" value="INFO/DP=19" />
            <section name="sec_filter">
                <conditional name="conditional_soft_filter">
                    <param name="selector" value="enabled"/>
                    <param name="soft_filter" value="XX" />
                    <param name="mode" value="+" />
                </conditional>
            </section>
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="\tXX\tDP=19" />
                    <has_text_matching expression="\tq20\tAO=52101" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="filter.3.vcf" />
            <param name="exclude" value="INFO/DP=19" />
            <section name="sec_filter">
                <conditional name="conditional_soft_filter">
                    <param name="selector" value="enabled"/>
                    <param name="soft_filter" value="XX" />
                    <param name="mode" value="+" />
                </conditional>
            </section>
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="\t238\tXX\tDP=19" />
                    <has_text_matching expression="\t238\tq20\tAO" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="filter.3.vcf" />
            <param name="exclude" value="FMT/GT=&quot;0/2&quot;" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <not_has_text text="3162006" />
                    <has_text text="3162007" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="filter.2.vcf" />
            <param name="include" value="FMT/GT=&quot;0/0&quot; &amp;&amp; AC[*]=2" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text text="AN=4;AC=2" />
                    <not_has_text text="AN=4;AC=0" />
                </assert_contents>
            </output>
        </test>
        <!-- Test region overlap -->
        <test>
            <param name="input_file" ftype="vcf" value="filter.2.vcf" />
            <param name="include" value="FMT/GT=&quot;0/0&quot; &amp;&amp; AC[*]=2" />
            <param name="output_type" value="v" />
            <section name="sec_restrict">
                <param name="regions_overlap" value="1"/>
            </section>
            <output name="output_file">
                <assert_contents>
                    <has_text text="AN=4;AC=2" />
                    <not_has_text text="AN=4;AC=0" />
                </assert_contents>
            </output>
            <assert_command>
                <has_text text="--regions-overlap" />
            </assert_command>
        </test>
        <!-- Test mask options-->
        <test>
            <param name="input_file" ftype="vcf" value="filter.3.vcf" />
            <param name="exclude" value="INFO/DP=19" />
            <section name="sec_filter">
                <param name="mode" value="+,x" />
                <conditional name="conditional_soft_filter">
                    <param name="selector" value="enabled"/>
                    <param name="soft_filter" value="XX" />
                    <param name="masks_overlap" value="1"/>
                </conditional>
            </section>

            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="\tq20;XX\tDP=19" />
                    <has_text_matching expression="\tPASS\tAO" />
                </assert_contents>
            </output>
            <assert_command>
                <has_text text="--mask-overlap" />
            </assert_command>
        </test>
    </tests>
    <help><![CDATA[
=====================================
 bcftools @EXECUTABLE@
=====================================

Apply fixed-threshold filters.

@REGIONS_HELP@
@TARGETS_HELP@
@EXPRESSIONS_HELP@


@BCFTOOLS_MANPAGE@#@EXECUTABLE@

@BCFTOOLS_WIKI@
]]>
    </help>
    <expand macro="citations" />
</tool>