view bcftools_filter.xml @ 25:5d8b9dd955c6 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bcftools commit f6efda26965eb73c9107d367fd5ffdf246ed0dbc
author iuc
date Tue, 02 Dec 2025 07:56:38 +0000
parents 0bb5f14a9955
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_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_region_restrict"/>
            <expand macro="macro_target_restrict"/>
            <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_mask_restrict"/>
                </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"/>
            <section name="sec_filter">
                <param name="mode" value="x"/>
            </section>
            <section name="sec_filter">
                <param name="SnpGap" value="2"/>
                <param name="IndelGap" value="2"/>
            </section>
            <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"/>
            <section name="sec_restrict">
                <param name="exclude" value="QUAL==59.2 || (INDEL=0 &amp; (FMT/GQ=25 | FMT/DP=10))"/>
            </section>
            <section name="sec_filter">
                <param name="mode" value="+"/>
                <conditional name="conditional_soft_filter">
                    <param name="selector" value="enabled"/>
                    <param name="soft_filter" value="Modified"/>
                </conditional>
                <param name="select_set_GTs" value="."/>
            </section>
            <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\s.*TA,T\s.*61.5\s.*Modified.+"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="filter.3.vcf"/>
            <section name="sec_restrict">
                <param name="exclude" value="INFO/DP=19"/>
            </section>
            <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"/>
            <section name="sec_restrict">
                <param name="exclude" value="INFO/DP=19"/>
            </section>
            <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="\t238\tXX\tDP=19.+"/>
                    <has_text_matching expression="\tq20\tAO.+"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="filter.3.vcf"/>
            <section name="sec_restrict">
                <param name="exclude" value="INFO/DP=19"/>
            </section>
            <section name="sec_filter">
                <param name="mode" value="+"/>
                <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="238\tq20;XX\tDP=19"/>
                    <has_text_matching expression="\tq20\tAO"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="filter.3.vcf"/>
            <section name="sec_restrict">
                <param name="exclude" value="INFO/DP=19"/>
            </section>
            <section name="sec_filter">
                <param name="mode" value="+"/>
                <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="\tq20;XX\tDP=19"/>
                    <has_text_matching expression="\tq20\tAO=52101"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="filter.3.vcf"/>
            <section name="sec_restrict">
                <param name="exclude" value="INFO/DP=19"/>
            </section>
            <section name="sec_filter">
                <param name="mode" value="+"/>
                <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="\t238\tq20;XX\tDP=19"/>
                    <has_text_matching expression="\t238\tq20\tAO"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="filter.3.vcf"/>
            <section name="sec_restrict">
                <param name="exclude" value="FMT/GT=&quot;0/2&quot;"/>
            </section>
            <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"/>
            <section name="sec_restrict">
                <param name="include" value="FMT/GT=&quot;0/0&quot; &amp;&amp; AC[*]=2"/>
            </section>
            <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"/>
            <section name="sec_restrict">
                <param name="include" value="FMT/GT=&quot;0/0&quot; &amp;&amp; AC[*]=2"/>
            </section>
            <param name="output_type" value="v"/>
            <section name="sec_restrict">
                <conditional name="regions">
                    <param name="regions_src" value="regions" />
                    <repeat name="region_specs">
                        <param name="chrom" value="1" />
                    </repeat>
                </conditional>
            </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"/>
            <section name="sec_restrict">
                <param name="exclude" value="INFO/DP=19"/>
            </section>
            <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"/>
                    <conditional name="masks">
                        <param name="masks_src" value="masks" />
                        <repeat name="mask_specs">
                            <param name="chrom" value="1" />
                            <param name="start" value="1" />
                            <param name="stop" value="1000" />
                        </repeat>
                        <param name="masks_overlap" value="1"/>
                    </conditional>
                </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_HOWTOS@
]]>
    </help>
    <expand macro="citations"/>
</tool>