view bcftools_convert_from_vcf.xml @ 9:aefb8d6348fb draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bcftools commit 942ca2971ae6a72e548fde6186c6408a1e236653
author iuc
date Mon, 29 Jul 2019 18:05:01 -0400
parents a7db83715075
children 7ca6120cb2a4
line wrap: on
line source

<?xml version='1.0' encoding='utf-8'?>
<tool name="bcftools @EXECUTABLE@ from vcf" id="bcftools_@EXECUTABLE@_from_vcf" version="@TOOL_VERSION@+galaxy1">
    <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>
        <xml name="macro_sexinfo">
            <conditional name="sex_info">
                <param name="sex_info_src" type="select" label="sex column">
                    <help><![CDATA[
SampleName SexDesignation:
<br>MaleSample    M
<br>FemaleSample  F
                    ]]></help>
                    <option value="none">None</option>
                    <option value="history">designations from history dataset</option>
                    <option value="entry">designations from text input</option>
                </param>
                <when value="none"/>
                <when value="history">
                    <param name="sex_info_file" type="data" format="tabular" label="per sample sex designation file"/>
                </when>
                <when value="entry">
                    <param name="sex_info_lines" type="text" area="True" label="per sample sex designation" >
                        <validator type="regex" message="sample M or F separated by TAB">^(\S+[ \t][MF](\n\S+[ \t][MF])*)$</validator>
                        <sanitizer sanitize="False"/>
                    </param>
                </when>
            </conditional>
        </xml>
        <token name="@SAMPLE_SEX@">
#if $convert.sex_info.sex_info_src == 'entry':
  --sex "$entered_sex_file"
#elif $convert.sex_info.sex_info_src == 'history':
  --sex "$convert.sex_info.sex_info_file"
#end if
        </token>
    </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@
@PREPARE_REGIONS_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
@SAMPLE_SEX@

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

## Primary Input/Outputs
"$input_file" .
]]>
    </command>
    <configfiles>
        <configfile name="entered_sex_file"><![CDATA[#slurp
#if $convert.sex_info.sex_info_src == 'entry':
$convert.sex_info.sex_info_lines.__str__.strip().replace(' ','\t')#slurp
#end if]]></configfile>
    </configfiles>
    <inputs>
        <expand macro="macro_input" />
        <section name="sec_restrict" expanded="false" title="Restrict to">
            <expand macro="macro_restrict" />
            <expand macro="macro_restrict" type="target" label_type="Target" />
            <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"/>
                <expand macro="macro_sexinfo"/>
            </when>
            <when value="hap_sample">
                <expand macro="macro_haploid2diploid"/>
                <expand macro="macro_vcf_ids"/>
                <expand macro="macro_sexinfo"/>
            </when>
            <when value="hap_legend_sample">
                <expand macro="macro_haploid2diploid"/>
                <expand macro="macro_vcf_ids"/>
                <expand macro="macro_sexinfo"/>
            </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>