view bcftools_reheader.xml @ 12:9ef52d95114b draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bcftools commit 8ad854180e3be0934cdb1f0021886199a2edf9c3"
author iuc
date Fri, 05 Feb 2021 19:25:09 +0000
parents 2a9cfd8f653e
children b3b3c060962e
line wrap: on
line source

<?xml version='1.0' encoding='utf-8'?>
<tool name="bcftools @EXECUTABLE@" id="bcftools_@EXECUTABLE@" version="@TOOL_VERSION@">
    <description>Modify header of VCF/BCF files, change sample names</description>
    <macros>
        <token name="@EXECUTABLE@">reheader</token>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements" />
    <expand macro="version_command" />
    <command detect_errors="aggressive"><![CDATA[
@PREPARE_ENV@
@PREPARE_INPUT_FILE@
bcftools @EXECUTABLE@

#set $section = $sec_default

#if $section.header:
  --header "${section.header}"
#end if

#if $section.rename_samples.samples_src == 'history':
  --samples "${section.rename_samples.sample_file}"
#elif $section.rename_samples.samples_src == 'entry':
  --samples "${entered_sample_file}"
#end if

## Primary Input/Outputs
@INPUT_FILE@
| bcftools view 
@OUTPUT_TYPE@
> '$output_file'
]]>
    </command>
    <configfiles>
        <configfile name="entered_sample_file"><![CDATA[#slurp
#if $sec_default.rename_samples.samples_src == 'entry'
$sec_default.rename_samples.sample_lines.__str__.strip()#slurp
#end if]]></configfile>
    </configfiles>

    <inputs>
        <expand macro="macro_input" />
        <section name="sec_default" expanded="true" title="Default Options">
            <param name="header" type="data" format="vcf" label="Header" optional="True" help="New header" />
            <conditional name="rename_samples">
                <param name="samples_src" type="select" label="New Sample names">
                    <help><![CDATA[
                     New sample names, one name per line, in the same order as they appear in the VCF file. 
                     Alternatively, only samples which need to be renamed can be listed as
                     "old_name new_name" pairs separated by whitespaces, each on separate line. 
                    ]]></help>
                    <option value="none">Do not change</option>
                    <option value="history">From your history</option>
                    <option value="entry">From text input</option>
                </param>
                <when value="none"/>
                <when value="history">
                    <param name="sample_file" type="data" format="tabular" label="Samples file"/>
                </when>
                <when value="entry">
                    <param name="sample_lines" type="text" area="True" label="Samples text entry" >
                        <validator type="regex" message="Either one name per line, or old new sample names per line">^((\S+(\n\S+))|(\S+[ \t]\S+(\n\S+[ \t]\S+)*))$</validator>
                        <sanitizer sanitize="False"/>
                    </param>
                </when>
            </conditional>
        </section>
        <expand macro="macro_select_output_type" />
    </inputs>
    <outputs>
        <expand macro="macro_vcf_output"/>
    </outputs>
    <tests>
        <test>
            <param name="input_file" ftype="vcf" value="reheader.vcf" />
            <param name="header" ftype="vcf" value="reheader.hdr" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text text="##fileformat=VCFv4.2" />
                    <has_text text="AAA0001" />
                    <not_has_text text="XY00001" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="reheader.vcf" />
            <param name="samples_src" value="history" />
            <param name="sample_file" ftype="tabular" value="reheader.samples" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <not_has_text text="XY00001" />
                    <has_text_matching expression="FORMAT\tAAA\tBBB"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="reheader.vcf" />
            <param name="samples_src" value="history" />
            <param name="sample_file" ftype="tabular" value="reheader.samples2" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <not_has_text text="XY00001" />
                    <has_text_matching expression="FORMAT\tAAA\tBBB"/>
                </assert_contents>
            </output>
        </test>
        <!--
        <test>
            <param name="input_file" ftype="vcf" value="reheader.vcf" />
            <param name="samples_src" value="entry" />
            <param name="sample_lines" value="AAA\nBBB" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <not_has_text text="XY00001" />
                    <has_text_matching expression="FORMAT\tAAA\tBBB"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="reheader.vcf" />
            <param name="samples_src" value="entry" />
            <param name="sample_lines" value="XY00002 BBB\nXY00001 AAA" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <not_has_text text="XY00001" />
                    <has_text_matching expression="FORMAT\tAAA\tBBB"/>
                </assert_contents>
            </output>
        </test>
        -->
    </tests>
    <help><![CDATA[ 
=====================================
 bcftools @EXECUTABLE@
=====================================

Modify header of VCF/BCF files, change sample names.

@BCFTOOLS_MANPAGE@#@EXECUTABLE@

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