changeset 1:4c249c0aebad draft default tip

"planemo upload for repository https://github.com/phac-nml/snvphyl-galaxy commit 57067916cb7b9c5b65c1da59d4bbb846c3e3af2f"
author nml
date Tue, 23 Jun 2020 10:25:20 -0400
parents b42c82186e85
children
files consolidate_vcfs.xml macros.xml test-data/expected_regions.txt test-data/expected_regions_disabled.txt test-data/expected_regions_empty.txt test-data/expected_regions_v3.txt test-data/freebayes/v3.bcf test-data/mpileup/v3.bcf test-data/v3.bcf.gz
diffstat 9 files changed, 102 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/consolidate_vcfs.xml	Tue Aug 27 12:30:25 2019 -0400
+++ b/consolidate_vcfs.xml	Tue Jun 23 10:25:20 2020 -0400
@@ -1,8 +1,9 @@
-<tool id="consolidate_vcfs" name="Consolidate VCFs" version ="1.8.2">
+<tool id="consolidate_vcfs" name="Consolidate VCFs" version ="@VERSION@+galaxy1">
   <description>combine freebayes and mpileup files for use by vcf2snvalignment</description>
-    <requirements>
-      <requirement type="package" version="1.8.2">snvphyl-tools</requirement>
-    </requirements>
+  <macros>
+    <import>macros.xml</import>
+  </macros>
+  <expand macro="requirements"/>
   <command detect_errors="exit_code"><![CDATA[
 
         #set $name = str($freebayes).split('/')[-1]
@@ -24,6 +25,11 @@
 	  bcftools index $name &&
 	#end if
 
+	## If there is no density filtering performed we still need to output an empty file
+	#if not $use_density_filter:
+	  echo '#No density filtering' > '$filtered_density' &&
+	#end if
+
         consolidate_vcfs.pl
 
 
@@ -37,44 +43,37 @@
         #set $path = str($mpileup).split('/')[-1]
         --mpileup "$path"
 
-        #set $path = str($path).split('/')[-1]
-        #if $filtered_density:
-          --filtered-density-out "$filtered_density"
-        #end if
-
-        #if $use_density_filter.select_list == "no":
+        #if not $use_density_filter:
           --skip-density-filter
         #else
-          #if $use_density_filter.window_size:
-            --window-size "$use_density_filter.window_size"
+          #if $filtered_density:
+            --filtered-density-out '$filtered_density'
           #end if
-          #if $use_density_filter.threshold:
-            --density-threshold "$use_density_filter.threshold"
+
+          #if $window_size:
+            --window-size "$window_size"
+          #end if
+          #if $threshold:
+            --density-threshold "$threshold"
           #end if
         #end if
 
         ##mark where the output files will be sent to, simply have to match them up later in the xml output section
         -o $bcf_combined
+
   ]]>
   </command>
   <inputs>
-    <param name="coverage" type="integer" value="15" label="Minimum coverage"/>
-    <param name="mean_mapping" type="integer" value="30" label="Minimum mean mapping quality"/>
-    <param name="snv_abundance_ratio" type="text" value="0.75" optional="false" label="SNV abundance ratio"/>
-    <param name="freebayes" type="data" label="FreeBayes filtered BCF" help="" optional="false" format="bcf_bgzip,bcf" />
-    <param name="mpileup" type="data" label="Mpileup BCF" help="" optional="false" format="bcf_bgzip,bcf" />
-    <conditional name="use_density_filter">
-      <param name="select_list" type="select" label= "SNV density filtering">
-        <option value="yes">Apply</option>
-        <option value="no">Don't apply</option>
-      </param>
-      <when value="yes">
-        <param name="window_size" type="integer" label="Size of search window" format="" optional="false" value="100"/>
-        <param name="threshold"  type="integer" label="Density threshold cutoff" format="" optional="false" value="10"/>
-      </when>
-      <when value="no">
-      </when>
-    </conditional>
+    <param name="coverage" type="integer" value="15" label="Minimum coverage" help="(--coverage-cutoff)" />
+    <param name="mean_mapping" type="integer" value="30" label="Minimum mean mapping quality" help="(--min-mean-mapping)" />
+    <param name="snv_abundance_ratio" type="text" value="0.75" optional="false" label="SNV abundance ratio" help="(--snv-abundance-ratio)" />
+    <param name="freebayes" type="data" label="FreeBayes filtered BCF" optional="false" format="bcf_bgzip,bcf" help="(--vcfsplit)" />
+    <param name="mpileup" type="data" label="Mpileup BCF" optional="false" format="bcf_bgzip,bcf" help="(--mpileup)" />
+    <param name="use_density_filter" type="boolean" checked="true" label="Apply SNV density filtering" help="(--skip-density-filter)" />
+    <param name="window_size" type="integer" min="1" label="SNV Density Filtering: Size of search window" format="" optional="false" value="500"
+      help="(--window-size) Size of the search window used to find high-density SNV regions. Only valid if density filtering is enabled." />
+    <param name="threshold" type="integer" min="1" label="SNV Density Filtering: Density threshold cutoff" format="" optional="false" value="2"
+      help="(--density-threshold) The SNV threshold within a window to determine of this is a high-density SNV region. Only valid if density filtering is enabled." />
   </inputs>
   <outputs>
     <data format="bcf_bgzip" name="bcf_combined"/>
@@ -87,10 +86,11 @@
       <param name="mpileup" value="mpileup/v1.bcf" />
       <param name="mean_mapping" value="30" />
       <param name="snv_abundance_ratio" value="0.75" />
+      <param name="use_density_filter" value="true" />
       <param name="window_size" value="500" />
       <param name="threshold" value="2" />
       <output name="bcf_combined" file="v1.bcf.gz" compare="sim_size" delta="500"/>
-      <output name="filtered_density" file="expected_regions.txt"/>
+      <output name="filtered_density" file="expected_regions_empty.txt"/>
     </test>
     <test>
       <param name="coverage" value="5"/>
@@ -98,18 +98,63 @@
       <param name="mpileup" value="mpileup/v2.bcf" />
       <param name="mean_mapping" value="30" />
       <param name="snv_abundance_ratio" value="0.75" />
+      <param name="use_density_filter" value="true" />
       <param name="window_size" value="500" />
       <param name="threshold" value="2" />
       <output name="bcf_combined" file="v2.bcf.gz" compare="sim_size" delta="500"/>
-      <output name="filtered_density" file="expected_regions.txt"/>
+      <output name="filtered_density" file="expected_regions_empty.txt"/>
+    </test>
+    <test>
+      <param name="coverage" value="5"/>
+      <param name="freebayes" value="freebayes/v3.bcf" />
+      <param name="mpileup" value="mpileup/v3.bcf" />
+      <param name="mean_mapping" value="30" />
+      <param name="snv_abundance_ratio" value="0.75" />
+      <param name="use_density_filter" value="true" />
+      <param name="window_size" value="10" />
+      <param name="threshold" value="3" />
+      <output name="bcf_combined" file="v3.bcf.gz" compare="sim_size" delta="250"/>
+      <output name="filtered_density" file="expected_regions_v3.txt"/>
+    </test>
+    <test>
+      <param name="coverage" value="5"/>
+      <param name="freebayes" value="freebayes/v3.bcf" />
+      <param name="mpileup" value="mpileup/v3.bcf" />
+      <param name="mean_mapping" value="30" />
+      <param name="snv_abundance_ratio" value="0.75" />
+      <param name="use_density_filter" value="true" />
+      <param name="window_size" value="10" />
+      <param name="threshold" value="4" />
+      <output name="bcf_combined" file="v3.bcf.gz" compare="sim_size" delta="250"/>
+      <output name="filtered_density" file="expected_regions_empty.txt"/>
+    </test>
+    <test>
+      <param name="coverage" value="5"/>
+      <param name="freebayes" value="freebayes/v3.bcf" />
+      <param name="mpileup" value="mpileup/v3.bcf" />
+      <param name="mean_mapping" value="30" />
+      <param name="snv_abundance_ratio" value="0.75" />
+      <param name="window_size" value="1" />
+      <param name="threshold" value="2" />
+      <output name="bcf_combined" file="v3.bcf.gz" compare="sim_size" delta="250"/>
+      <output name="filtered_density" file="expected_regions_empty.txt"/>
+    </test>
+    <test>
+      <param name="coverage" value="5"/>
+      <param name="freebayes" value="freebayes/v3.bcf" />
+      <param name="mpileup" value="mpileup/v3.bcf" />
+      <param name="mean_mapping" value="30" />
+      <param name="snv_abundance_ratio" value="0.75" />
+      <param name="use_density_filter" value="false" />
+      <param name="window_size" value="10" />
+      <param name="threshold" value="3" />
+      <output name="bcf_combined" file="v3.bcf.gz" compare="sim_size" delta="250"/>
+      <output name="filtered_density" file="expected_regions_disabled.txt"/>
     </test>
   </tests>
 
   <help>
   Merges variant and non-variant calls (in VCF format) produced from two independent base callers, FreeBayes, and SAMtools/BCFtools. Produces a merged set of high-quality variant and non-variant calls (in BCF format).  Optionally, produces a list of SNV-dense regions above the passed thresholds.
   </help>
-
-  <citations>
-  </citations>
-
+  <expand macro="citations"/>
 </tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml	Tue Jun 23 10:25:20 2020 -0400
@@ -0,0 +1,16 @@
+<macros>
+  <token name="@VERSION@">1.8.2</token>
+
+  <xml name="requirements">
+    <requirements>
+      <requirement type="package" version="@VERSION@">snvphyl-tools</requirement>
+      <yield/>
+    </requirements>
+  </xml>
+  <xml name="citations">
+    <citations>
+      <citation type="doi">10.1099/mgen.0.000116</citation>
+      <yield/> 
+    </citations>
+  </xml>
+</macros>
--- a/test-data/expected_regions.txt	Tue Aug 27 12:30:25 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-#Calculation and writing of high density regions has completed.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/expected_regions_disabled.txt	Tue Jun 23 10:25:20 2020 -0400
@@ -0,0 +1,1 @@
+#No density filtering
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/expected_regions_empty.txt	Tue Jun 23 10:25:20 2020 -0400
@@ -0,0 +1,1 @@
+#Calculation and writing of high density regions has completed.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/expected_regions_v3.txt	Tue Jun 23 10:25:20 2020 -0400
@@ -0,0 +1,2 @@
+reference	4	8
+#Calculation and writing of high density regions has completed.
Binary file test-data/freebayes/v3.bcf has changed
Binary file test-data/mpileup/v3.bcf has changed
Binary file test-data/v3.bcf.gz has changed