view bcftools_convert_to_vcf.xml @ 4:19167fd970a3 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:54 -0500
parents d6e3d97e17f0
children 7b50ab23976c
line wrap: on
line source

<?xml version='1.0' encoding='utf-8'?>
<tool name="bcftools @EXECUTABLE@ to vcf" id="bcftools_@EXECUTABLE@_to_vcf" version="@VERSION@">
    <description>Converts other formats to VCF/BCFk</description>
    <macros>
        <token name="@EXECUTABLE@">convert</token>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements">
        <requirement type="package" version="1.3.1">samtools</requirement>
    </expand>
    <expand macro="version_command" />
    <command detect_errors="aggressive"><![CDATA[
@PREPARE_ENV@
#set $input_vcf = None
#if $convert.convert_from == 'gvcf':
  #set $input_vcf = 'input.vcf.gz'
  #if $convert.input_file.is_of_type('vcf')
    bgzip -c "$convert.input_file" > $input_vcf &&
    bcftools index $input_vcf &&
  #elif $convert.input_file.is_of_type('vcf_bgzip')
    ln -s "$convert.input_file" $input_vcf
  #elif $convert.input_file.is_of_type('bcf')
    #set $input_vcf = 'input.bcf'
    ln -s "$convert.input_file" $input_vcf &&
    bcftools index $input_vcf &&
  #elif $convert.input_file.is_of_type('bcf_bgzip')
    ln -s "$convert.input_file" $input_vcf &&
  #end if
#end if
#set $section = $convert
@PREPARE_FASTA_REF@

bcftools @EXECUTABLE@

@OUTPUT_TYPE@

#set $section = $convert
#if $convert.convert_from == 'gen_sample':
  --gensample2vcf "$convert.input_file,$convert.input_sample"
#elif $convert.convert_from == 'hap_sample':
  --hapsample2vcf "$convert.input_file,$convert.input_sample"
#elif $convert.convert_from == 'hap_legend_sample':
  --haplegendsample2vcf "$convert.input_file,$convert.input_legend,$convert.input_sample"
#elif $convert.convert_from == 'gvcf':
   @FASTA_REF@
   --gvcf2vcf $input_vcf
#elif $convert.convert_from == 'tsv':
   @FASTA_REF@
   @SAMPLES@
   @COLUMNS@
   --tsv2vcf "$convert.input_file"
#end if
> "$output_file"
]]>
    </command>
    <inputs>
        <conditional name="convert">
            <param name="convert_from" type="select" label="convert from">
                <option value="tsv">tsv - TAB-Separated-Value (e.g. 23andMe)</option>
                <option value="gvcf">gVCF - GATK Variant Call Format</option>
                <option value="gen_sample">gen sample - IMPUTE2 or SHAPEIT</option>
                <option value="hap_sample">haps sample - IMPUTE2 or SHAPEIT</option>
                <option value="hap_legend_sample">haps legend sample - IMPUTE2 or SHAPEIT</option>
            </param>
            <when value="tsv">
                <param name="input_file" type="data" format="tabular" label="Tabular Variant Data"
                       help="Reference sequence and samples are required"/>
                <expand macro="macro_fasta_ref" />
                <expand macro="macro_samples"/>
                <expand macro="macro_columns"/>
            </when>
            <when value="gvcf">
                <param name="input_file" type="data" format="gvcf" label="Genomic VCF (GATK HaplotypeCaller)" />
                <expand macro="macro_fasta_ref" />
            </when>
            <when value="gen_sample">
                <param name="input_file" type="data" format="tabular" label="The .gen file" />
                <param name="input_sample" type="data" format="tabular" label="The .samples file" />
            </when>
            <when value="hap_sample">
                <param name="input_file" type="data" format="tabular" label="The .hap file" />
                <param name="input_sample" type="data" format="tabular" label="The .samples file" />
            </when>
            <when value="hap_legend_sample">
                <param name="input_file" type="data" format="tabular" label="The .hap file" />
                <param name="input_legend" type="data" format="tabular" label="The .legend file" />
                <param name="input_sample" type="data" format="tabular" label="The .samples file" />
            </when>

        </conditional>
        <expand macro="macro_select_output_type" />
    </inputs>
    <outputs>
        <expand macro="macro_vcf_output"/>
    </outputs>
    <tests>
        <test>
            <param name="convert_from"  value="gen_sample" />
            <param name="input_file" ftype="tabular" value="convert.gs.gt.gen" />
            <param name="input_sample" ftype="tabular" value="convert.gs.gt.samples" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tNA00001\tNA00002\tNA00003\tNA00004\tNA00005\tNA00006\tNA00007\tNA00008\tNA00009\tNA00010" />
                    <has_text_matching expression="X\t2698560\t.\tG\tA\t.\t.\t.\tGT:GP" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="convert_from"  value="hap_sample" />
            <param name="input_file" ftype="tabular" value="convert.hs.gt.hap" />
            <param name="input_sample" ftype="tabular" value="convert.hs.gt.samples" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tNA00001\tNA00002\tNA00003\tNA00004\tNA00005\tNA00006\tNA00007\tNA00008\tNA00009\tNA00010" />
                    <has_text_matching expression="X\t2698769\t.\tAAG\tA\t.\t.\t.\tGT\t1|0\t1|1\t0|1\t1|0\t1|0\t0|0\t0|0\t0|0\t0|0\t0|0" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="convert_from"  value="hap_legend_sample" />
            <param name="input_file" ftype="tabular" value="convert.hls.gt.hap" />
            <param name="input_legend" ftype="tabular" value="convert.hls.gt.legend" />
            <param name="input_sample" ftype="tabular" value="convert.hls.gt.samples" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tNA00001\tNA00002\tNA00003\tNA00004\tNA00005\tNA00006\tNA00007\tNA00008\tNA00009\tNA00010" />
                    <has_text_matching expression="X\t2698769\t.\tAAG\tA\t.\t.\t.\tGT\t1|0\t1|1\t0|1\t1|0\t1|0\t0|0\t0|0\t0|0\t0|0\t0|0" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="convert_from"  value="gvcf" />
            <param name="input_file" ftype="vcf" value="convert.gvcf.vcf" />
            <param name="fasta_ref" ftype="fasta" value="gvcf.fa" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tSAMPLE99" />
                    <has_text_matching expression="22\t10\t.\tC\t.\t0\tLowGQX\tEND=20;BLOCKAVG_min30p3a\tGT:GQX:DP:DPF\t0/0:5:2:0" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="convert_from"  value="tsv" />
            <param name="input_file" ftype="tabular" value="convert.23andme" />
            <param name="fasta_ref" ftype="fasta" value="23andme.fa" />
            <param name="samples"  value="SAMPLE1" />
            <param name="columns"  value="ID,CHROM,POS,AA" />
            <param name="output_type" value="v" />
            <output name="output_file">
                <assert_contents>
                    <has_text_matching expression="#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tSAMPLE1" />
                    <has_text_matching expression="1\t10\trs002\tG\tA\t.\t.\t.\tGT\t1/0" />
                </assert_contents>
            </output>
        </test>
    </tests>

    <help><![CDATA[
=====================================
 bcftools @EXECUTABLE@ plugin
=====================================

Converts other variant formats to vcf.  See man page for file formats details.

@BCFTOOLS_MANPAGE@#@EXECUTABLE@

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