view variant.xml @ 16:eb746fa6f514 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/medaka commit 7105600c6ba7a49e8933e1a1357566fc2126df58
author iuc
date Tue, 26 Sep 2023 10:11:35 +0000
parents ec699520444c
children
line wrap: on
line source

<tool id="medaka_variant" name="medaka variant tool" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>decodes variant calls from medaka consensus output</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <expand macro="version_command"/>
    <command detect_errors="exit_code"><![CDATA[
## initialize
@REF_FASTA@


#if $pool.pool_mode == "Yes":
    ## run
    medaka variant
    ## optional
    --debug
    #if $regions
        --regions '${regions}'
    #end if
    $verbose
    ${ambig_ref}
    ${gvcf}
    ## required
    reference.fa
    #for $current in $pool.inputs
        '$current'
    #end for
#elif $pool.pool_mode == "No":
    ## run
    medaka variant
    ## optional
    --debug
    #if $regions
        --regions '${regions}'
    #end if
    $verbose
    ${ambig_ref}
    ${gvcf}
    ## required
    reference.fa
    '$pool.input'
#end if
#if str($output_annotated.output_annotated_select) == 'false':
    '$out_variants' ##output
    2>&1 | tee '$out_log'
#else
    raw.vcf ##output of medaka variant
    2>&1 | tee '$out_log'
    && ln -s '$output_annotated.in_bam' in.bam
    && ln -s '$output_annotated.in_bam.metadata.bam_index' in.bai
    && medaka tools annotate --dpsp --pad $output_annotated.pad raw.vcf reference.fa in.bam tmp.vcf
    && python '$__tool_directory__/convert_VCF_info_fields.py' tmp.vcf '$out_variants'
#end if
    ]]></command>
    <inputs>
        <conditional name="pool">
            <param name="pool_mode"  type="select" label="Are you pooling HDF5 datasets?">
                <option value="No" selected="true">No</option>
                <option value="Yes">Yes</option>
            </param>
            <when value="Yes">
                <param name="inputs" type="data" format="h5" multiple="true" label="Select consensus file(s)"/>
            </when>
            <when value="No">
                <param name="input" type="data" format="h5" label="Select consensus file(s)"/>
            </when>
        </conditional>
        <expand macro="reference"/>
        <param argument="--regions" type="text" value="" optional="true" label="Set reference names to limit variant calling" help="Separated by ','.">
            <sanitizer invalid_char="">
                <valid initial="string.ascii_letters,string.digits">
                    <add value="_"/>
                    <add value=","/>
                    <add value="."/>
                </valid>
            </sanitizer>
        </param>
        <param argument="--verbose" type="boolean" truevalue="--verbose" falsevalue="" label="Populate VCF info fields?"/>
        <param argument="--ambig_ref" type="boolean" truevalue="--ambig_ref" falsevalue="" label="Decode variants at ambiguous reference positions?" checked="false"/>
        <param argument="--gvcf" type="boolean" truevalue="--gvcf" falsevalue="" label="Output VCF records for reference loci predicted to be non-variant?" checked="false"/>
        <conditional name="output_annotated">
            <param name="output_annotated_select" type="select"
            label="Type of VCF to generate"
            help="Variant INFO fields in the VCF can be extended to include allele frequency, depth of coverage, etc., but this requires a BAM dataset to calculate those values from.">
                <option value="true" selected="true">Write annotated VCF with extended INFO</option>
                <option value="false">Write original decoded VCF with minimal INFO field</option>
            </param>
            <when value="true">
                <param name="in_bam" type="data" format="bam" optional="false" label="BAM to caclulate additional INFO fields from"/>
                <param name="pad" type="integer" min="1" value="25"
                label="Padding width on either side of variant for realignment"
                help="To calculate the additional INFO fields the tool will run medaka tools anntotate, which performs local realignment of the region +- this width around each variant. All calculated new fields will depend on the width chosen, so only change this value if you know what you are doing." />
            </when>
            <when value="false"/>
        </conditional>
        <param name="output_log_bool" type="boolean" label="Output log file?" checked="true"/>
    </inputs>
    <outputs>
        <data name="out_variants" format="vcf" label="${tool.name} on ${on_string}: called variants"/>
        <data name="out_log" format="tabular" label="${tool.name} on ${on_string}: Log">
            <filter>output_log_bool</filter>
        </data>
    </outputs>
    <tests>
        <!-- #1 default -->
        <test expect_num_outputs="2">
            <conditional name="pool">
                <param name="pool_mode" value="Yes"/>
                <param name="inputs" value="medaka_test.hdf,medaka_test.hdf"/>
            </conditional>
            <conditional name="reference_source">
                <param name="reference_source_selector" value="history"/>
                <param name="ref_file" value="ref.fasta"/>
            </conditional>
            <param name="ambig_ref" value="true"/>
            <conditional name="output_annotated">
                <param name="output_annotated_select" value="true"/>
                <param name="in_bam" value="medaka_test.bam"/>
            </conditional>
            <param name="output_log_bool" value="true"/>
            <output name="out_variants">
                <assert_contents>
                    <has_n_lines n="18"/>
                    <has_line line="##fileformat=VCFv4.1" />
                    <has_line_matching expression="##medaka_version=[0-9]+\.[0-9]+\.[0-9]+" />
                    <has_line_matching expression="##convert_VCF_info_fields=[0-9]+\.[0-9]+" />
                </assert_contents>
            </output>
            <output name="out_log">
                <assert_contents>
                    <has_n_lines n="12" />
                </assert_contents>
            </output>
        </test>
        <!--No pooling-->
        <test expect_num_outputs="2">
            <conditional name="pool">
                <param name="pool_mode" value="No"/>
                <param name="input" value="medaka_test.hdf"/>
            </conditional>
            <conditional name="reference_source">
                <param name="reference_source_selector" value="history"/>
                <param name="ref_file" value="ref.fasta.gz" ftype="fasta.gz"/>
            </conditional>
            <param name="ambig_ref" value="true"/>
            <conditional name="output_annotated">
                <param name="output_annotated_select" value="true"/>
                <param name="in_bam" value="medaka_test.bam"/>
            </conditional>
            <param name="output_log_bool" value="true"/>
            <output name="out_variants">
                <assert_contents>
                    <has_n_lines n="18"/>
                    <has_line line="##fileformat=VCFv4.1" />
                    <has_line_matching expression="##medaka_version=[0-9]+\.[0-9]+\.[0-9]+" />
                    <has_line_matching expression="##convert_VCF_info_fields=[0-9]+\.[0-9]+" />
                </assert_contents>
            </output>
            <output name="out_log">
                <assert_contents>
                    <has_n_lines n="9" />
                </assert_contents>
            </output>
        </test>
        <!--No annotation or log-->
        <test expect_num_outputs="1">
            <conditional name="pool">
                <param name="pool_mode" value="No"/>
                <param name="input" value="medaka_test.hdf"/>
            </conditional>
            <conditional name="reference_source">
                <param name="reference_source_selector" value="history"/>
                <param name="ref_file" value="ref.fasta"/>
            </conditional>
            <conditional name="output_annotated">
                <param name="output_annotated_select" value="false"/>
            </conditional>
            <param name="output_log_bool" value="false"/>
            <output name="out_variants">
                <assert_contents>
                    <has_n_lines n="9"/>
                    <has_line line="##fileformat=VCFv4.1" />
                    <has_line_matching expression="##medaka_version=[0-9]+\.[0-9]+\.[0-9]+" />
                </assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[
.. class:: infomark

**What it does**

@WID@

The module *variant* decodes probabilities.

----

.. class:: infomark

**Input**

- reference sequence (FASTA)
- (several) consensus files (H5/HDF)

----

.. class:: infomark

**Output**

- decoded probabilities (VCF)

----

.. class:: infomark

**References**

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