view bcftools_filter.xml @ 14:e4988fd4d503 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bcftools commit af43d9cf6824f88726900857116f333ff4cdd336"
author iuc
date Sat, 15 Jan 2022 13:45:46 +0000
parents abafcb875ba6
children e7452697afd9
line wrap: on
line source

<?xml version='1.0' encoding='utf-8'?>
<tool name="bcftools @EXECUTABLE@" id="bcftools_@EXECUTABLE@" version="@TOOL_VERSION@">
    <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.soft_filter:
  --soft-filter "${section.soft_filter}"
#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>
            <param name="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>
            <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="Modified" />
                    <has_text text="AN=2;AC=1" />
                    <has_text_matching expression="TAAAA\tTA,T\t61.5\tModified" />
                </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" />
            <param name="soft_filter" value="XX" />
            <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" />
            <param name="soft_filter" value="XX" />
            <param name="mode" value="+" />
            <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" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="filter.3.vcf" />
            <param name="exclude" value="INFO/DP=19" />
            <param name="soft_filter" value="XX" />
            <param name="mode" value="x" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="\tXX\tDP=19" />
                    <has_text_matching expression="\tPASS\tAO" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="filter.3.vcf" />
            <param name="exclude" value="INFO/DP=19" />
            <param name="soft_filter" value="XX" />
            <param name="mode" value="+,x" />
            <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>
        </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>
    </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>