diff bcftools_reheader.xml @ 0:6ca0d413a76a draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bcftools commit ef90c4602bdb83ea7455946c9d175ea27284e643
author iuc
date Wed, 06 Jul 2016 07:08:44 -0400
parents
children 4e8e8fa7f39e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bcftools_reheader.xml	Wed Jul 06 07:08:44 2016 -0400
@@ -0,0 +1,150 @@
+<?xml version='1.0' encoding='utf-8'?>
+<tool name="bcftools @EXECUTABLE@" id="bcftools_@EXECUTABLE@" version="@VERSION@.0">
+    <description>Modify header of VCF/BCF files, change sample names</description>
+    <macros>
+        <token name="@EXECUTABLE@">reheader</token>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements" />
+    <expand macro="version_command" />
+    <command detect_errors="aggressive"><![CDATA[
+@PREPARE_ENV@
+@PREPARE_INPUT_FILE@
+bcftools @EXECUTABLE@
+
+#set $section = $sec_default
+
+#if $section.header:
+  --header "${section.header}"
+#end if
+
+#if $section.rename_samples.samples_src == 'history':
+  --samples "${section.rename_samples.sample_file}"
+#elif $section.rename_samples.samples_src == 'entry':
+  --samples "${entered_sample_file}"
+#end if
+
+## Primary Input/Outputs
+@INPUT_FILE@
+| bcftools view 
+@OUTPUT_TYPE@
+> "$output_file"
+]]>
+    </command>
+    <configfiles>
+        <configfile name="entered_sample_file"><![CDATA[#slurp
+#if $sec_default.rename_samples.samples_src == 'entry'
+$sec_default.rename_samples.sample_lines.__str__.strip()#slurp
+#end if]]></configfile>
+    </configfiles>
+
+    <inputs>
+        <expand macro="macro_input" />
+        <section name="sec_default" expanded="true" title="Default Options">
+            <param name="header" type="data" format="vcf" label="Header" optional="True" help="New header" />
+            <conditional name="rename_samples">
+                <param name="samples_src" type="select" label="New Sample names">
+                    <help><![CDATA[
+                     New sample names, one name per line, in the same order as they appear in the VCF file. 
+                     Alternatively, only samples which need to be renamed can be listed as
+                     "old_name new_name" pairs separated by whitespaces, each on separate line. 
+                    ]]></help>
+                    <option value="none">Do not change</option>
+                    <option value="history">From your history</option>
+                    <option value="entry">From text input</option>
+                </param>
+                <when value="none"/>
+                <when value="history">
+                    <param name="sample_file" type="data" format="tabular" label="Samples file"/>
+                </when>
+                <when value="entry">
+                    <param name="sample_lines" type="text" area="True" label="Samples text entry" >
+                        <validator type="regex" message="Either one name per line, or old new sample names per line">^((\S+(\n\S+))|(\S+[ \t]\S+(\n\S+[ \t]\S+)*))$</validator>
+                        <sanitizer sanitize="False"/>
+                    </param>
+                </when>
+            </conditional>
+        </section>
+        <expand macro="macro_select_output_type" />
+    </inputs>
+    <outputs>
+        <expand macro="macro_vcf_output"/>
+    </outputs>
+    <tests>
+        <test>
+            <param name="input_file" ftype="vcf" value="reheader.vcf" />
+            <param name="header" ftype="vcf" value="reheader.hdr" />
+            <param name="output_type" value="v" />
+            <output name="output_file">
+                <assert_contents>
+                    <has_text text="##fileformat=VCFv4.2" />
+                    <has_text text="AAA0001" />
+                    <not_has_text text="XY00001" />
+                </assert_contents>
+            </output>
+        </test>
+        <test>
+            <param name="input_file" ftype="vcf" value="reheader.vcf" />
+            <param name="samples_src" value="history" />
+            <param name="sample_file" ftype="tabular" value="reheader.samples" />
+            <param name="output_type" value="v" />
+            <output name="output_file">
+                <assert_contents>
+                    <not_has_text text="XY00001" />
+                    <has_text_matching expression="FORMAT\tAAA\tBBB"/>
+                </assert_contents>
+            </output>
+        </test>
+        <test>
+            <param name="input_file" ftype="vcf" value="reheader.vcf" />
+            <param name="samples_src" value="history" />
+            <param name="sample_file" ftype="tabular" value="reheader.samples2" />
+            <param name="output_type" value="v" />
+            <output name="output_file">
+                <assert_contents>
+                    <not_has_text text="XY00001" />
+                    <has_text_matching expression="FORMAT\tAAA\tBBB"/>
+                </assert_contents>
+            </output>
+        </test>
+        <!--
+        <test>
+            <param name="input_file" ftype="vcf" value="reheader.vcf" />
+            <param name="samples_src" value="entry" />
+            <param name="sample_lines" value="AAA\nBBB" />
+            <param name="output_type" value="v" />
+            <output name="output_file">
+                <assert_contents>
+                    <not_has_text text="XY00001" />
+                    <has_text_matching expression="FORMAT\tAAA\tBBB"/>
+                </assert_contents>
+            </output>
+        </test>
+        <test>
+            <param name="input_file" ftype="vcf" value="reheader.vcf" />
+            <param name="samples_src" value="entry" />
+            <param name="sample_lines" value="XY00002 BBB\nXY00001 AAA" />
+            <param name="output_type" value="v" />
+            <output name="output_file">
+                <assert_contents>
+                    <not_has_text text="XY00001" />
+                    <has_text_matching expression="FORMAT\tAAA\tBBB"/>
+                </assert_contents>
+            </output>
+        </test>
+        -->
+    </tests>
+    <help><![CDATA[ 
+=====================================
+ bcftools @EXECUTABLE@
+=====================================
+
+Modify header of VCF/BCF files, change sample names.
+
+@BCFTOOLS_MANPAGE@#@EXECUTABLE@
+
+@BCFTOOLS_WIKI@
+]]>
+    </help>
+    <expand macro="citations" />
+</tool>