view bcftools_convert_from_vcf.xml @ 4:8714c1caa3ee draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bcftools commit 3edcac645f34d5a94884dedaf95c5774f4afc5c7
author iuc
date Sat, 11 Mar 2017 17:58:33 -0500
parents 16f221807ecd
children 2c5a7bd98c81
line wrap: on
line source

<?xml version='1.0' encoding='utf-8'?>
<tool name="bcftools @EXECUTABLE@ from vcf" id="bcftools_@EXECUTABLE@_from_vcf" version="@VERSION@">
    <description>Converts VCF/BCF to IMPUTE2/SHAPEIT formats</description>
    <macros>
        <token name="@EXECUTABLE@">convert</token>
        <import>macros.xml</import>
        <xml name="macro_vcf_ids">
            <param name="vcf_ids" type="boolean" truevalue="--vcf-ids" falsevalue="" checked="false" 
                   label="Output VCF IDs instead of CHROM:POS_REF_ALT" help="(\-\-vcf_ids)"/>
        </xml>
        <xml name="macro_haploid2diploid">
            <param name="haploid2diploid" type="boolean" truevalue="--haploid2diploid" falsevalue="" checked="false" 
                   label="convert haploid genotypes to diploid homozygotes"  help="(\-\-haploid2diploid)"/>
        </xml>
    </macros>
    <expand macro="requirements" />
    <expand macro="version_command" />
    <command detect_errors="aggressive"><![CDATA[
@PREPARE_ENV@
@PREPARE_INPUT_FILE@
#set $section = $sec_restrict
@PREPARE_TARGETS_FILE@

bcftools @EXECUTABLE@

#if $convert.convert_to == 'gen_sample':
--tag $convert.tag $convert.chrom $convert.vcf_ids
--gensample "$output_gen,$output_samples"
#elif $convert.convert_to == 'hap_sample':
$convert.vcf_ids $convert.haploid2diploid
--hapsample "$output_hap,$output_samples"
#elif $convert.convert_to == 'hap_legend_sample':
$convert.vcf_ids $convert.haploid2diploid
--haplegendsample "$output_hap,$output_legend,$output_samples"
#end if

## VCF input section
#set $section = $sec_restrict
@INCLUDE@
@EXCLUDE@
@REGIONS@
@TARGETS@
@SAMPLES@

## Primary Input/Outputs
"$input_file" .
]]>
    </command>
    <inputs>
        <expand macro="macro_input" />
        <section name="sec_restrict" expanded="false" title="Restrict to">
            <expand macro="macro_regions" />
            <expand macro="macro_targets" />
            <expand macro="macro_samples" />
            <expand macro="macro_include" />
            <expand macro="macro_exclude" />
        </section>
        <conditional name="convert">
            <param name="convert_to" type="select" label="convert to">
                <option value="gen_sample">gen sample - IMPUTE2 or SHAPEIT</option>
                <option value="hap_sample">hap sample - IMPUTE2 or SHAPEIT</option>
                <option value="hap_legend_sample">hap legend sample - IMPUTE2 or SHAPEIT</option>
            </param>
            <when value="gen_sample">
                <param name="tag" type="select" label="tag to take values for .gen file: GT,PL,GL,GP">
                    <option value="GT">GT</option>
                    <option value="PL">PL</option>
                    <option value="GP">GP</option>
                    <!--
                    <option value="GL">GL</option>
                    -->
                </param>
                <param name="chrom" type="boolean" truevalue="--chrom" falsevalue="" checked="false" 
                   label="Output chromosome in first column instead of CHROM:POS_REF_ALT" help="(\-\-chrom)"/>
                <expand macro="macro_vcf_ids"/>
            </when>
            <when value="hap_sample">
                <expand macro="macro_haploid2diploid"/>
                <expand macro="macro_vcf_ids"/>
            </when>
            <when value="hap_legend_sample">
                <expand macro="macro_haploid2diploid"/>
                <expand macro="macro_vcf_ids"/>
            </when>
        </conditional>
    </inputs>
    <outputs>
        <data name="output_gen" format="tabular" label="${input_file.name.rsplit('.',1)[0]}.gen">
            <filter>convert['convert_to'] == 'gen_sample'</filter> 
        </data>
        <data name="output_hap" format="tabular" label="${input_file.name.rsplit('.',1)[0]}.haps">
            <filter>convert['convert_to'] in ('hap_sample','hap_legend_sample')</filter> 
        </data>
        <data name="output_legend" format="tabular" label="${input_file.name.rsplit('.',1)[0]}.legend">
            <filter>convert['convert_to'] == 'hap_legend_sample'</filter> 
        </data>
        <data name="output_samples" format="tabular" label="${input_file.name.rsplit('.',1)[0]}.samples"/>
    </outputs>
    <tests>
        <test>
            <param name="input_file" ftype="vcf" value="convert.vcf" />
            <param name="convert_to"  value="gen_sample" />
            <output name="output_gen">
                <assert_contents>
                    <has_text text="X:2698560_G_A X:2698560_G_A 2698560 G A 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0"/>
                </assert_contents>
            </output>
            <output name="output_samples">
                <assert_contents>
                    <has_text text="NA00001 NA00001 0"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="convert.vcf" />
            <param name="convert_to"  value="gen_sample" />
            <param name="tag"  value="GP" />
            <param name="chrom"  value="True" />
            <output name="output_gen">
                <assert_contents>
                    <has_text text="X X:2698560_G_A 2698560 G A 1.00"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="check.vcf" />
            <param name="convert_to"  value="gen_sample" />
            <param name="tag"  value="GT" />
            <param name="chrom"  value="True" />
            <param name="vcf_ids"  value="True" />
            <output name="output_gen">
                <assert_contents>
                    <has_text text="1 id3D 3062915 GTTT G 0 1 0 0 1 0"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="convert.vcf" />
            <param name="convert_to"  value="hap_sample" />
            <output name="output_hap">
                <assert_contents>
                    <has_text text="X X:2698769_AAG_A 2698769 AAG A 1 0 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_file" ftype="vcf" value="convert.vcf" />
            <param name="convert_to"  value="hap_legend_sample" />
            <output name="output_hap">
                <assert_contents>
                    <has_text text="1 0 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0"/>
                </assert_contents>
            </output>
            <output name="output_legend">
                <assert_contents>
                    <has_text text="X:2698769_AAG_A 2698769 AAG A"/>
                </assert_contents>
            </output>
            <output name="output_samples">
                <assert_contents>
                    <has_text text="sample population group sex"/>
                    <has_text text="NA00001 NA00001 NA00001 2"/>
                </assert_contents>
            </output>
        </test>
    </tests>

    <help><![CDATA[
=====================================
 bcftools @EXECUTABLE@ from vcf
=====================================

Converts VCF/BCF to other formats. See man page for file formats details. 

@REGIONS_HELP@
@TARGETS_HELP@
@EXPRESSIONS_HELP@

@BCFTOOLS_MANPAGE@#@EXECUTABLE@

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