diff bcftools_convert_to_vcf.xml @ 0:bca07db8f55c draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bcftools commit 21c66fb27c7e2fd21c7f7607b3b29e77e64fb86d-dirty
author jjohnson
date Sat, 25 Jun 2016 20:47:33 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bcftools_convert_to_vcf.xml	Sat Jun 25 20:47:33 2016 -0400
@@ -0,0 +1,173 @@
+<?xml version='1.0' encoding='utf-8'?>
+<tool name="bcftools @EXECUTABLE@ to vcf" id="bcftools_@EXECUTABLE@_to_vcf" version="@VERSION@.0">
+    <description>Converts other formats to VCF/BCFk</description>
+    <macros>
+        <token name="@EXECUTABLE@">convert</token>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements" />
+    <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.datatype.file_ext == 'vcf'
+    bgzip -c "$convert.input_file" > $input_vcf &&
+    bcftools index $input_vcf &&
+  #elif $convert.input_file.datatype.file_ext == 'vcf_bgzip'
+    ln -s "$convert.input_file" $input_vcf
+  #elif $convert.input_file.datatype.file_ext == 'bcf'
+    #set $input_vcf = 'input.bcf'
+    ln -s "$convert.input_file" $input_vcf && 
+    bcftools index $input_vcf &&
+  #elif $convert.input_file.datatype.file_ext == '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>