view bcftools_convert_to_vcf.xml @ 19:4935320a59a8 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bcftools commit 96c0663be587b73bdf09ddf060cb559f28f9eba7
author iuc
date Thu, 12 Jan 2023 15:48:05 +0000
parents ecc9192912b8
children
line wrap: on
line source

<?xml version='1.0' encoding='utf-8'?>
<tool name="bcftools @EXECUTABLE@ to vcf" id="bcftools_@EXECUTABLE@_to_vcf" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>Converts other formats to VCF/BCFk</description>
    <macros>
        <token name="@EXECUTABLE@">convert</token>
        <import>macros.xml</import>
    </macros>
    <expand macro="bio_tools" />
    <expand macro="requirements">
        <expand macro="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
#if $convert.convert_from == 'gvcf' or $convert.convert_from == 'tsv':
  #set $section = $convert.reference_source
  @PREPARE_FASTA_REF@
#end if

bcftools @EXECUTABLE@

@OUTPUT_TYPE@

#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@
   #set $section = $convert
   @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="vcf" 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>
            <conditional name="convert">
                <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" />
            </conditional>
            <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>
            <conditional name="convert">
                <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" />
            </conditional>
            <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>
            <conditional name="convert">
                <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" />
            </conditional>
            <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>
            <conditional name="convert">
                <param name="convert_from"  value="gvcf" />
                <param name="input_file" ftype="vcf" value="convert.gvcf.vcf" />
                <expand macro="test_using_reference" ref="gvcf.fa" />
            </conditional>
            <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\tBLOCKAVG_min30p3a\tGT:GQX:DP:DPF\t0/0:5:2:0" />
                </assert_contents>
            </output>
        </test>
        <test>
            <conditional name="convert">
                <param name="convert_from"  value="gvcf" />
                <param name="input_file" ftype="vcf" dbkey="?" value="convert.gvcf.vcf" />
                <expand macro="test_using_reference" select_from="cached" ref="gvcf" />
            </conditional>
            <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\tBLOCKAVG_min30p3a\tGT:GQX:DP:DPF\t0/0:5:2:0" />
                </assert_contents>
            </output>
        </test>
        <test>
            <conditional name="convert">
                <param name="convert_from"  value="tsv" />
                <param name="input_file" ftype="tabular" value="convert.23andme" />
                <expand macro="test_using_reference" ref="23andme.fa" />
                <param name="samples"  value="SAMPLE1" />
                <param name="columns"  value="ID,CHROM,POS,AA" />
            </conditional>
            <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>
        <test>
            <conditional name="convert">
                <param name="convert_from"  value="tsv" />
                <param name="input_file" ftype="tabular" dbkey="?" value="convert.23andme" />
                <expand macro="test_using_reference" select_from="cached" ref="23andme" />
                <param name="samples"  value="SAMPLE1" />
                <param name="columns"  value="ID,CHROM,POS,AA" />
            </conditional>
            <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>