view bcftools_merge.xml @ 22:5b006286a458 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bcftools commit 784611c9caf2680d41414ca2880b93a69d719701
author iuc
date Sun, 18 Aug 2024 10:12:56 +0000
parents 2215287d5cc9
children
line wrap: on
line source

<?xml version='1.0' encoding='utf-8'?>
<tool name="bcftools @EXECUTABLE@" id="bcftools_@EXECUTABLE@" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>Merge multiple VCF/BCF files from non-overlapping sample sets to create one multi-sample file</description>
    <macros>
        <token name="@EXECUTABLE@">merge</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_FILES@
#set $section = $sec_restrict
@PREPARE_REGIONS_FILE@

bcftools @EXECUTABLE@

## Header section
#set $section = $sec_header
${section.print_header}
#if $section.use_header:
  --use-header "${section.use_header}"
#end if

## Merge section
#set $section = $sec_merge
${section.force_samples}

#if $section.info_rules:
  --info-rules "${section.info_rules}"
#end if

#if $section.merge:
  --merge "${section.merge}"
  $section.no_index
#end if

#set $section = $sec_restrict
@APPLY_FILTERS@
@REGIONS@

@OUTPUT_TYPE@
@THREADS@

## Primary Input/Outputs
@INPUT_FILES@
> '$output_file'
]]>
    </command>
    <inputs>
        <expand macro="macro_inputs" />
        <section name="sec_restrict" expanded="false" title="Restrict to">
            <expand macro="macro_apply_filters" />
            <expand macro="macro_restrict" />
        </section>
        <section name="sec_merge" expanded="true" title="Merge Options">
            <param name="force_samples" type="boolean" truevalue="--force-samples" falsevalue="" label="Force Samples" help="Resolve duplicate sample names" />
            <param name="info_rules" type="text" label="Info Rules" help="Rules for merging INFO fields (method is one of sum,avg,min,max,join) or &quot;-&quot; to turn off the default [DP:sum,DP4:sum]" />
            <param name="merge" type="select" label="Merge" optional="True" 
                  help="Allow multiallelic records for: snps|indels|both|all|none|id, see man page for details [both]" >
                  <option value="none">none - no new multiallelics, output multiple records instead</option>
                  <option value="snps">snps - allow multiallelic SNP records</option>
                  <option value="indels">indels - allow multiallelic indel records</option>
                  <option value="both">both - both SNP and indel records can be multiallelic</option>
                  <option value="all">all - SNP records can be merged with indel records</option>
                  <option value="id">id - merge by ID</option>
            </param>
            <param argument="--no-index" type="boolean" truevalue="--no-index" falsevalue="" checked="false"
                label="Allow merge unindexed files" help="Requires the input files to have chromosomes in th same order and consistent with the order of sequences in the header" />
        </section>
        <section name="sec_header" expanded="false" title="Header Options">
          <param name="use_header" type="data" format="vcf" label="Use Header" optional="True" help="Use the provided header" />
          <param name="print_header" type="boolean" truevalue="--print-header" falsevalue="" label="Print Header" help="Print only the merged header and exit" />
        </section>
        <expand macro="macro_select_output_type" />
    </inputs>
    <outputs>
        <expand macro="macro_vcf_output"/>
    </outputs>
    <tests>
        <test>
            <param name="input_files" ftype="vcf" value="merge.a.vcf,merge.b.vcf,merge.c.vcf" />
            <param name="force_samples" value="true" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text text="3000150" />
                    <has_text text="3188209" />
                    <has_text_matching expression="\tq10;q20\t[\s]*INDEL"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_files" ftype="vcf" value="merge.2.a.vcf,merge.2.b.vcf" />
            <param name="force_samples" value="true" />
            <param name="merge" value="none" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="1\t3000000\t.\tC\tCCG\t"/>
                    <has_text_matching expression="1\t3000000\t.\tC\tG\t"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_files" ftype="vcf" value="merge.2.a.vcf,merge.2.b.vcf" />
            <param name="force_samples" value="true" />
            <param name="merge" value="both" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="1\t3000150\t\.\tC\t(A,G|G,A)\t"/>
                    <has_text_matching expression="1\t3106154\t\.\tC\t(CC,CCC|CCC,CC)\t"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_files" ftype="vcf" value="merge.2.a.vcf,merge.2.b.vcf" />
            <param name="force_samples" value="true" />
            <param name="merge" value="all" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="1\t3000000\t\.\tC\t(CCG,G|G,CCG)\t"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_files" ftype="vcf" value="merge.3.a.vcf,merge.3.b.vcf" />
            <param name="force_samples" value="true" />
            <param name="info_rules" value="TR:sum,TA:sum,TG:sum" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="1\t3000000\t.\tC\t(CG,CCG|CCG,CG)\t"/>
                    <has_text_matching expression="TR=[^;\t]*11"/>
                </assert_contents>
            </output>
        </test>
        <!-- Test no_index option -->
        <test>
            <param name="input_files" ftype="vcf" value="merge.4.a.vcf,merge.4.b.vcf" />
            <param name="force_samples" value="true" />
            <param name="merge" value="id" />
            <param name="no_index" value="true"/>
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="1\t3000000\tid1\tC\t(A,CCG|CCG,A)\t"/>
                </assert_contents>
            </output>
            <assert_command>
                <has_text text="--no-index" />
            </assert_command>
        </test>
        <!-- Test region overlap option -->
        <test>
            <param name="input_files" ftype="vcf" value="merge.4.a.vcf,merge.4.b.vcf" />
            <param name="force_samples" value="true" />
            <param name="merge" value="id" />
            <param name="output_type" value="v" />
            <section name="sec_restrict">
                <param name="regions_overlap" value="1"/>
            </section>
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="1\t3000000\tid1\tC\t(A,CCG|CCG,A)\t"/>
                </assert_contents>
            </output>
            <assert_command>
                <has_text text="--regions-overlap" />
            </assert_command>
        </test>
    </tests>
    <help><![CDATA[
=====================================
 bcftools @EXECUTABLE@
=====================================


Merge multiple VCF/BCF files from non-overlapping sample sets to create one multi-sample file. 

Note that only records from different files can be merged, never from the same file. 
For "vertical" merge take a look at "bcftools norm" instead.

@REGIONS_HELP@

@BCFTOOLS_MANPAGE@#@EXECUTABLE@

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