view vcffilter.xml @ 10:4bdc111b2470 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/vcflib/vcffilter commit f28d66c0bcad8ac29be2afec28bc639317239775
author iuc
date Tue, 01 Oct 2024 13:48:17 +0000
parents fa24bf0598f4
children
line wrap: on
line source

<tool id="vcffilter2" name="VCFfilter:" version="@WRAPPER_VERSION@+galaxy3">
    <description>filter VCF data in a variety of attributes</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements">
        <requirement type="package" version="1.10.2">htslib</requirement>
    </expand>
    <expand macro="stdio" />
    <command><![CDATA[
ln -s '$input1' input1.vcf &&
bgzip input1.vcf &&
tabix -p vcf input1.vcf.gz &&
vcffilter
#for $filter_el in $filter_repeat:
    $filter_el.filter_type '$filter_el.filter_value'
#end for
$filter_sites
$tag_pass
$tag_fail
$append_filter
$allele_tag
$invert
$or
#if str($region):
    --region '$region'
#end if
input1.vcf.gz
> '${out_file1}'
    ]]></command>
    <inputs>
        <param name="input1" type="data" format="vcf" label="VCF dataset to filter"/>
        <repeat name="filter_repeat" title="more filters" min="1">
            <param name="filter_type" type="select" label="Select the filter type">
                <option value="-f">Info filter (-f)</option>
                <option value="-g">Genotype filter (-g)</option>
            </param>
            <param name="filter_value" type="text" value="DP &gt; 10" label="Specify filtering value" help="See explanation of filtering options below">
                <sanitizer>
                    <valid initial="string.printable">
                        <remove value="&apos;"/>
                        <remove value="&quot;"/>
                    </valid>
                    <mapping initial="none">
                        <add source="&apos;" target=""/>
                        <add source="&quot;" target=""/>
                    </mapping>
                </sanitizer>
                <validator type="expression" message="Invalid operator provided, valid operators are =, !, &lt;, &gt;, |, &amp;.">value is not None and not any(x in value for x in ["&lt;=", "=&lt;", "&gt;=", "=&gt;"])</validator>
            </param>
        </repeat>
        <param argument="--filter-sites" type="boolean" truevalue="--filter-sites" falsevalue="" label="Filter entire records, not just alleles"/>
        <param argument="--tag-pass" type="boolean" truevalue="--tag-pass" falsevalue="" label="Tag vcf records as positively filtered with this tag, print all records"/>
        <param argument="--tag-fail" type="boolean" truevalue="--tag-fail" falsevalue="" label="Tag vcf records as negatively filtered with this tag, print all records"/>
        <param argument="--append-filter" type="boolean" truevalue="--append-filter" falsevalue="" label="Append the existing filter tag, don't just replace it"/>
        <param argument="--allele-tag" type="boolean" truevalue="--allele-tag" falsevalue="" label="Apply --tag-pass on a per-allele basis, adds or sets the corresponding INFO field tag"/>
        <param argument="--invert" type="boolean" truevalue="--invert" falsevalue="" label="Inverts the filter, e.g. grep -v"/>
        <param argument="--or" type="boolean" truevalue="--or" falsevalue="" label="Use logical OR instead of AND to combine filters"/>
        <param argument="--region" type="text" label="Specify a region on which to target the filtering" help="Regions should be specified as chr:start-end, e.g X:1000-2000"/>
    </inputs>
    <outputs>
        <data name="out_file1" format="vcf" />
    </outputs>
    <tests>
        <test>
            <param name="filter_repeat_0|filter_type" value="-f"/>
            <param name="filter_repeat_0|filter_value" value="DP &gt; 10"/>
            <param name="input1" value="vcflib.vcf"/>
            <output name="out_file1" file="vcffilter-test1.vcf"/>
        </test>
        <test>
            <param name="filter_repeat_0|filter_type" value="-f"/>
            <param name="filter_repeat_0|filter_value" value="!( DP &gt; 10 )"/>
            <param name="invert" value="true"/>
            <param name="input1" value="vcflib.vcf"/>
            <output name="out_file1" file="vcffilter-test2.vcf"/>
        </test>
    </tests>
    <help><![CDATA[
You can specify the following options within the **Specify filtering expression** box in any combination::

    -f, --info-filter     specifies a filter to apply to the info fields of records, removes alleles which do not pass the filter
    -g, --genotype-filter specifies a filter to apply to the genotype fields of records
    -s, --filter-sites    filter entire records, not just alleles
    -t, --tag-pass        tag vcf records as positively filtered with this tag, print all records
    -F, --tag-fail        tag vcf records as negatively filtered with this tag, print all records
    -A, --append-filter   append the existing filter tag, don't just replace it
    -a, --allele-tag      apply -t on a per-allele basis.  adds or sets the corresponding INFO field tag
    -v, --invert          inverts the filter, e.g. grep -v
    -o, --or              use logical OR instead of AND to combine filters
    -r, --region          specify a region on which to target the filtering (must be used in conjunction with -f or -g)

To specify filters, click on the 'Insert Add filters' button, choose a filter type
(e.g., 'Info filter' or 'Genotype filter'), and specify filter value according to the
following pattern::

    - For 'Info filter (-f)':: {ID} {operator} {value}
    For instance::  DP > 10

    - For 'Genotype fields (-g)':: {ID} {operator} {value}
    For instance::  GT = 1|1

    - For 'Flag' fields (when 'Info filter (-f)' is selected for filter type field):: {value}
    For instance::  CpG

Any number of filters may be specified.  They are combined via logical AND unless the --or option is specified. For convenience, you can specify "QUAL" to refer to the quality of the site, even though it does not appear in the INFO fields.

Operators can be any of::

   =, !, <, >, |, &

Obtain logical negation through the use of parentheses, e.g. "! ( DP = 10 )"
Please mind the blank space between parentheses and the arguments.

To restrict output to a specific location use the -r option (must be used in conjunction with -g or -f)::

 -r chr20:14000-15000  # only output calls between positions 14,000 and 15,000 on chromosome 20
 -r chrX               # only output call on chromosome X

-----

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