view vcfanno.xml @ 1:cdcaa40e5e45 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/vcfanno/ commit c08085bc808613dd2b1a34d53e8366fafbda5ec7"
author iuc
date Mon, 06 Dec 2021 09:23:38 +0000
parents fb20fa735dfe
children 4f3c5e634679
line wrap: on
line source

<?xml version="1.0"?>
<tool id="vcfanno" name="vcfanno" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>VCF annotation</description>
    <macros>
        <import>macros.xml</import>
    </macros>

    <expand macro="xrefs"/>

    <expand macro="requirements"/>

    <expand macro="version_command"/>

    <!--
    In future versions - figure out how to safely add in lua support without posing security risk
    (Should be doable but requires writing some lua unfortunately to make custom sandboxes)
     -->
    <command detect_errors="exit_code"><![CDATA[
    ln -s '$config_toml' config.toml &&
    ln -s '$input_vcf' input.vcf &&

    #for $i, $annotation in enumerate($annotations):
        #set $ext = str($annotation.type.type_select)
        ln -s '$annotation.type.annotation' 'input_${i}.${ext}' &&
        ### These sets of conversions etc shouldn't be necessary but the vcfanno in Galaxy looks for an index file regardless of compression for some reason and if not present fails.
        #if $ext == 'vcf' or $ext == 'bed':
            bgzip 'input_${i}.${ext}' &&
            #set $ext = $ext + ".gz"
        #end if
        #if '.gz' in $ext[-3:]:
            tabix -p vcf 'input_${i}.${ext}' &&
        #elif $ext == 'bam':
            ln -s '${annotation.type.annotation.metadata.bam_index}' input_${i}.bam.bai &&
        #end if
    #end for
    vcfanno -p \${GALAXY_SLOTS:-4}
#if $ends:
    '$ends'
#end if
#if $permissive_overlap:
    '$permissive_overlap'
#end if
    config.toml
    input.vcf
    >
    '$out_vcf'
    ]]></command>
    <configfiles>
        <configfile name="config_toml">#
#for $i, $annotation in enumerate($annotations):
    #set $ext = $annotation.type.type_select
    #if $ext == 'vcf' or $ext == 'bed':
        #set $ext = $ext + ".gz"
    #end if
    #if $ext == 'vcf.gz' or $ext == 'bam':
        #set $annotation_names = list()
        #set $annotation_fields = list()
        #set $annotation_ops = list()
        #for $field in $annotation.type.fields:
            #silent $annotation_names.append('"%s"' %(str($field.name)))
            #silent $annotation_fields.append('"%s"' %(str($field.field)))
            #silent $annotation_ops.append('"%s"' %(str($field.op)))
        #end for
        #set $names = "names= [%s]" % (", ".join($annotation_names))
        #set $fields = "fields= [%s]" % (", ".join($annotation_fields))
        #set $ops = "ops= [%s]" % (", ".join($annotation_ops))
    #elif $ext == 'bed.gz':
        #set $annotation_names = list()
        #set $annotation_columns = list()
        #set $annotation_ops = list()
        #for $field in $annotation.type.fields:
            #silent $annotation_names.append('"%s"' %(str($field.name)))
            #silent $annotation_columns.append( str($field.columns))
            #silent $annotation_ops.append('"%s"' %(str($field.op)))
        #end for
        #set $names = "names= [%s]" % (", ".join($annotation_names))
        #set $fields = "columns= [%s]" % (", ".join($annotation_columns))
        #set $ops = "ops= [%s]" % (", ".join($annotation_ops))
    #end if 
[[annotation]]
file="input_${i}.${ext}"
${names}
${fields}
${ops}

#end for
        </configfile>
    </configfiles>
    <inputs>
        <param name="input_vcf" type="data" format="vcf,vcf_bgzip" label="VCF to be annotated"/>
        <param argument="-ends" type="boolean" checked="false" truevalue="-ends" falsevalue="" label="annotate the start and end as well as the interval itself?"/>
        <param argument="-permissive-overlap" type="boolean" checked="false" truevalue="-permissive-overlap" falsevalue="" label="annotate with an overlapping variant even it doesn't share the same ref and alt alleles." help="Default is to require exact match between variants."/>
        <repeat name="annotations" title="Input annotations" min="1">
            <conditional name="type">
                <param name="type_select" type="select">
                    <option value="vcf" selected="true">VCF</option>
                    <option value="vcf.gz">VCF.bgzip</option>
                    <option value="bed">BED</option>
                    <option value="bam">BAM</option>
                </param>
                <when value="vcf">
                    <param name="annotation" type="data" format="vcf" label="Annotation file"/>
                    <repeat name="fields" title="Fields" min="1">
                        <param name="name" type="text"/>
                        <param name="field" type="text" help="ID and FILTER are special fields that pull the ID and FILTER columns from the VCF"/>
                        <param name="op" type="select" label="Op" help="In most cases, we will have a single annotation entry for each entry (variant) in the query VCF, in which case the self op is the best choice. However, it is possible that there will be multiple annotations from a single annotation file--in this case, the op determines how the many values are reduced. In nearly all cases, if you are annotating with a VCF, use self">
                            <expand macro="ops"/>
                        </param>
                    </repeat>
                </when>
                <when value="vcf.gz">
                    <param name="annotation" type="data" format="vcf_bgzip" label="Annotation file"/>
                    <repeat name="fields" title="Fields" min="1">
                        <param name="name" type="text"/>
                        <param name="field" type="text" help="ID and FILTER are special fields that pull the ID and FILTER columns from the VCF"/>
                        <param name="op" type="select" label="Op" help="In most cases, we will have a single annotation entry for each entry (variant) in the query VCF, in which case the self op is the best choice. However, it is possible that there will be multiple annotations from a single annotation file--in this case, the op determines how the many values are reduced. In nearly all cases, if you are annotating with a VCF, use self">
                            <expand macro="ops"/>
                        </param>
                    </repeat>
                </when>
                <when value="bed">
                    <param name="annotation" type="data" format="bed" label="Annotation file"/>
                    <repeat name="fields" title="Fields" min="1">
                        <param name="name" type="text"/>
                        <param name="columns" type="text" help="(1-based) column number from which to pull the value for the op"/>
                        <param name="op" type="select" label="Op">
                            <expand macro="ops"/>
                        </param>
                    </repeat>
                </when>
                <when value="bam">
                    <param name="annotation" type="data" format="bam" label="Annotation file"/>
                    <repeat name="fields" title="Fields" min="1">
                        <param name="name" type="text"/>
                        <param name="field" type="select" help="Field in the BAM to pull value from">
                            <option value="depth">Depth (count)</option>
                            <option value="coverage">Coverage</option>
                            <option value="mapq">mapq (mapping quality)</option>
                            <option value="seq">seq</option>
                            <option value="DP2">DP2</option>
                        </param>
                        <param name="op" type="select" label="Op" help="Op to perform on the field. Note: DP2 field always will result in DP2 op">
                            <expand macro="ops"/>
                        </param>
                    </repeat>
                </when>
            </conditional>
        </repeat>
        <!-- <repeat name="postannotations" title="Input postannotations">
        </repeat> -->
        <!-- Until we figure out lua sanitization there's really no point to adding this either-->
    </inputs>
    <outputs>
        <!-- standard -->
        <data name="out_vcf" format="vcf" label="${tool.name} on ${on_string}: Result"/>
    </outputs>
    <tests>
        <!-- #1 default -->
        <test expect_num_outputs="1">
            <param name="input_vcf" value="query.vcf.gz" ftype="vcf_bgzip"/>
            <repeat name="annotations">
                <conditional name="type">
                    <param name="type_select" value="vcf.gz" />
                    <param name="annotation" value="exac.vcf.gz" ftype="vcf_bgzip"/>
                    <repeat name="fields">
                        <param name="name" value="AC_AFR" />
                        <param name="field" value="AC_AFR" />
                        <param name="op" value="first" />
                    </repeat>
                    <repeat name="fields">
                        <param name="name" value="AC_AMR" />
                        <param name="field" value="AC_AMR" />
                        <param name="op" value="first" />
                    </repeat>
                    <repeat name="fields">
                        <param name="name" value="AC_EAS" />
                        <param name="field" value="AC_EAS" />
                        <param name="op" value="first" />
                    </repeat>
                    <repeat name="fields">
                        <param name="name" value="ID" />
                        <param name="field" value="ID" />
                        <param name="op" value="first" />
                    </repeat>
                </conditional>
            </repeat>
            <repeat name="annotations">
                <conditional name="type">
                    <param name="type_select" value="bam" />
                    <param name="annotation" value="ex.bam" />
                    <repeat name="fields">
                        <param name="name" value="mapq" />
                        <param name="field" value="mapq" />
                        <param name="op" value="mean" />
                    </repeat>
                    <repeat name="fields">
                        <param name="name" value="coverage" />
                        <param name="field" value="coverage" />
                        <param name="op" value="sum" />
                    </repeat>
                    <repeat name="fields">
                        <param name="name" value="xdp2" />
                        <param name="field" value="DP2" />
                        <param name="op" value="self" />
                    </repeat>
                </conditional>
            </repeat>
            <repeat name="annotations">
                <conditional name="type">
                    <param name="type_select" value="bed" />
                    <param name="annotation" value="fitcons.bed" />
                    <repeat name="fields">
                        <param name="name" value="lua_start" />
                        <param name="columns" value="4" />
                        <param name="op" value="first" />
                    </repeat>
                    <repeat name="fields">
                        <param name="name" value="lua_end" />
                        <param name="columns" value="4" />
                        <param name="op" value="first" />
                    </repeat>
                    <repeat name="fields">
                        <param name="name" value="lua_len" />
                        <param name="columns" value="4" />
                        <param name="op" value="first" />
                    </repeat>
                    <repeat name="fields">
                        <param name="name" value="lua_mean" />
                        <param name="columns" value="4" />
                        <param name="op" value="first" />
                    </repeat>
                    <repeat name="fields">
                        <param name="name" value="lua_loc" />
                        <param name="columns" value="4" />
                        <param name="op" value="first" />
                    </repeat>
                </conditional>
            </repeat>
            <output name="out_vcf" file="vcfanno_result.vcf"/>
        </test>
    </tests>
    <help><![CDATA[
.. class:: infomark

**What it does**

@WID@

Note this version of vcfanno does not support lua code functionality

**Input**

- VCF file to be annotated

- BAM / BED / VCF files to annotate with

**Output**

- Annotated VCF

**References**

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