changeset 11:a87ae767b01d draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bcftools commit 3c56c04b42c70a072429e4534a136dc28c98b642"
author iuc
date Wed, 23 Oct 2019 19:30:14 -0400
parents f867422772d6
children e522022137f6
files bcftools_consensus.xml
diffstat 1 files changed, 34 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/bcftools_consensus.xml	Thu Oct 17 02:49:33 2019 -0400
+++ b/bcftools_consensus.xml	Wed Oct 23 19:30:14 2019 -0400
@@ -1,5 +1,5 @@
 <?xml version='1.0' encoding='utf-8'?>
-<tool name="bcftools @EXECUTABLE@" id="bcftools_@EXECUTABLE@" version="@TOOL_VERSION@+galaxy1">
+<tool name="bcftools @EXECUTABLE@" id="bcftools_@EXECUTABLE@" version="@TOOL_VERSION@+galaxy2">
     <description>Create consensus sequence by applying VCF variants to a reference fasta file</description>
     <macros>
         <token name="@EXECUTABLE@">consensus</token>
@@ -7,6 +7,7 @@
     </macros>
     <expand macro="requirements">
         <expand macro="samtools_requirement"/>
+        <requirement type="package" version="5.0.1">gawk</requirement>
     </expand>
     <expand macro="version_command" />
     <command detect_errors="aggressive"><![CDATA[
@@ -25,21 +26,27 @@
 ${section.iupac_codes}
 
 #if $section.mask:
-  --mask "${section.mask}"
+  --mask '${section.mask}'
 #end if
 
 #if $section.select_haplotype:
-  --haplotype "${section.select_haplotype}"
+  --haplotype '${section.select_haplotype}'
 #end if
 @SAMPLE@
 
 #if $chain:
-  --chain "$chain_file"
+  --chain '$chain_file'
 #end if
 
 ## Primary Input/Outputs
---output "$output_file"
+#if str($rename) == "no"
+    --output '$output_file'
+#end if
 @INPUT_FILE@
+#if str($rename) == "yes":
+    #set basename=$input_file.element_identifier
+    | awk 'BEGIN {i=1} {if (match($0, /^>/)) {if (i==1) {name="${basename}"} else {name=sprintf("%s-%d","${basename}",i);} print(gensub(/>[^ ]+( ?.*)/, ">" name "\\1", 1)); i=i+1;} else {print}}' > '$output_file'
+#end if
 ]]>
     </command>
     <inputs>
@@ -56,6 +63,7 @@
             </param>
         </section>
         <param name="chain" type="boolean" truevalue="yes" falsevalue="no" label="Write a chain file for liftover" />
+        <param name="rename" type="boolean" truevalue="yes" falsevalue="no" label="Set output FASTA ID from name of VCF" />
     </inputs>
     <outputs>
         <data name="output_file" format="fasta" label="${tool.name} on ${on_string}: consensus fasta"/>
@@ -96,6 +104,21 @@
                 </assert_contents>
             </output>
         </test>
+        <test>
+            <expand macro="test_using_reference" ref="consensus.fa" />
+            <param name="input_file" ftype="vcf" value="consensus.vcf" />
+            <param name="mask" ftype="tabular" value="consensus.tab" />
+            <param name="chain" value="False" />
+            <param name="rename" value="True" />
+            <output name="output_file">
+                <assert_contents>
+                    <has_text text=">consensus.vcf" />
+                </assert_contents>
+                <assert_contents>
+                    <has_text text=">consensus.vcf-2" />
+                </assert_contents>
+            </output>
+        </test>
     </tests>
     <help><![CDATA[
 =====================================
@@ -108,6 +131,12 @@
 @BCFTOOLS_MANPAGE@#@EXECUTABLE@
 
 @BCFTOOLS_WIKI@
+
+The option to set the new consensus' FASTA ID from the name of the VCF is provided by post-processing
+the bcftools consensus output. It is primarily intended for use when the VCF is coming from a list
+collection where the elements of the list are named meaningfully (e.g. named after sample names). This
+is useful when consensus sequences are being prepared for, for example, feeding a multiple sequence
+alignment to a phylogeny program.
 ]]>
     </help>
     <expand macro="citations" />