diff hapcut2.xml @ 2:800f8086da7d draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc commit 908fb9148a3a116dbf7ccd16e0992e7882e748c2
author iuc
date Tue, 30 Apr 2024 08:38:15 +0000
parents 271eb7f4b8bc
children
line wrap: on
line diff
--- a/hapcut2.xml	Sun May 08 10:44:03 2022 +0000
+++ b/hapcut2.xml	Tue Apr 30 08:38:15 2024 +0000
@@ -1,17 +1,16 @@
-<tool id="hapcut2" name="Hapcut2" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@+ga@GA_VERSION_SUFFIX@">
-  <description> - haplotype assembly for diploid organisms</description>
+<tool id="hapcut2" name="Hapcut2" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="23.2">
+  <description>haplotype assembly for diploid organisms</description>
+  <macros>
+    <token name="@TOOL_VERSION@">1.3.4</token>
+    <token name="@VERSION_SUFFIX@">1</token>
+    <import>macros.xml</import>   
+  </macros>
   <xrefs>
     <xref type="bio.tools">hapcut2</xref>
   </xrefs>
-  <macros>
-    <token name="@TOOL_VERSION@">1.3.3</token>
-    <token name="@VERSION_SUFFIX@">0</token>
-    <token name="@GA_VERSION_SUFFIX@">1</token>
-  </macros>
   <requirements>
-    <requirement type="package" version="1.3.3">hapcut2</requirement>
+    <requirement type="package" version="@TOOL_VERSION@">hapcut2</requirement>
   </requirements>
-
   <command detect_errors="exit_code"><![CDATA[
 
 ## Prep inputs
@@ -19,23 +18,31 @@
 ln -s '$input_bam' input.bam
 && ln -s '$input_vcf' input.vcf
 
+## Set reference genome if required
+#if $optimization.choice in ['pacbio', 'ont']:
+  #if $optimization.reference_genome.source == 'index':
+    #set $ref_genome_path = $optimization.reference_genome.index.fields.path
+  #else
+    #set $ref_genome_path = $optimization.reference_genome.fasta
+  #end if
+#end if
 
 ## Run program
 ## =====================================================================
 ## Extract variant fragments from alignment
-&& extractHAIRS --bam input.bam --VCF input.vcf --out frags.dat
+&& extractHAIRS --bam 'input.bam' --VCF 'input.vcf' --out frags.dat
 #if $optimization.choice == 'pacbio':
   --pacbio 1
-  --ref '$optimization.reference_fasta'
+  --ref '$ref_genome_path'
 #elif $optimization.choice == 'ont':
   --ont 1
-  --ref '$optimization.reference_fasta'
+  --ref '$ref_genome_path'
 #elif $optimization.choice == 'hic':
   --HiC 1
 #end if
 
 #if $advanced.minIS
---minIS $advanced.minIS
+  --minIS $advanced.minIS
 #end if
 
 #if $advanced.maxIS
@@ -47,13 +54,11 @@
 #if $optimization.choice == 'hic':
   --HiC 1
 #end if
-
   ]]></command>
 
   <inputs>
-    <param name="input_bam" type="data" format="bam" label="Input BAM file"/>
-    <param name="input_vcf" type="data" format="vcf" label="Input VCF file"/>
-
+    <param name="input_bam" argument="--bam" type="data" format="bam" label="Input BAM file" help="Coordinate-sorted BAM file"/>
+    <param name="input_vcf" argument="--VCF" type="data" format="vcf" label="Input VCF file" help="Variant file with genotypes for a single individual"/>
     <conditional name="optimization">
       <!-- TODO: include 10X (requires extra processing step) -->
       <param name="choice" type="select" display="radio" label="Optimization">
@@ -62,71 +67,111 @@
         <option value="ont">Oxford Nanopore</option>
         <option value="hic">Hi-C</option>
       </param>
-
+      <when value="default"></when>
       <when value="pacbio">
-        <param name="reference_fasta" type="data" format="fasta"
-          label="Reference genome fasta file"
-          help="The reference genome is required for long-read optimization."
-        />
+        <expand macro="reference_genome_input"/>
       </when>
-
       <when value="ont">
-        <param name="reference_fasta" type="data" format="fasta"
-          label="Reference genome fasta file"
-          help="The reference genome is required for long-read optimization."
-        />
+        <expand macro="reference_genome_input"/>
       </when>
+      <when value="hic"></when>
     </conditional>
 
-    <param name="output_phased" type="boolean" label="Output phased VCF file?"
-      checked="true"
-      help="Output variant calls on the haplotype assembly"
-    />
-    <param name="output_fragments" type="boolean" label="Output fragments file?"
-      help="Output fragments collected by extractHAIRS"
-    />
-
+    <param name="output_phased" type="boolean" label="Output phased VCF file?" checked="true" help="Output variant calls on the haplotype assembly"/>
+    <param name="output_fragments" type="boolean" label="Output fragments file?" help="Output fragments collected by extractHAIRS"/>
 
     <section name="advanced" title="Advanced parameters">
-      <param name="maxIS" type="integer" label="Maximum insert size"
-        optional="true" value="1000"
-        help="Maximum insert size for a paired-end read to be considered as a single fragment for phasing."
-      />
-
-      <param name="minIS" type="integer" label="Minimum insert size"
-        optional="true" value="0"
-        help="Minimum insert size for a paired-end read to be considered as a single fragment for phasing."
-      />
+      <param argument="--maxIS" type="integer" label="Maximum insert size" optional="true" value="1000" min="0" help="Maximum insert size for a paired-end read to be considered as a single fragment for phasing"/>
+      <param argument="--minIS" type="integer" label="Minimum insert size" optional="true" value="0" min="0" help="Minimum insert size for a paired-end read to be considered as a single fragment for phasing"/>
     </section>
   </inputs>
 
   <outputs>
-    <data name="haplotype" format="txt" from_work_dir="haplotype.out"
-      label="${tool.name} on ${on_string}: Haplotype block"
-    />
-    <data name="haplotype_phased" format="vcf" from_work_dir="haplotype.out.phased.VCF"
-      label="${tool.name} on ${on_string}: Phased haplotype VCF"
-    >
+    <data name="haplotype" format="txt" from_work_dir="haplotype.out" label="${tool.name} on ${on_string}: Haplotype block"/>
+    <data name="haplotype_phased" format="vcf" from_work_dir="haplotype.out.phased.VCF" label="${tool.name} on ${on_string}: Phased haplotype VCF">
       <filter>output_phased</filter>
     </data>
-    <data name="frags" format="txt" from_work_dir="frags.dat"
-      label="${tool.name} on ${on_string}: Fragments"
-    >
+    <data name="frags" format="txt" from_work_dir="frags.dat" label="${tool.name} on ${on_string}: Fragments">
       <filter>output_fragments</filter>
     </data>
   </outputs>
 
   <tests>
+    <!-- Defaults -->
+    <test expect_num_outputs="1">
+      <param name="input_bam" ftype="bam" value="input.bam"/>
+      <param name="input_vcf" ftype="vcf" value="input.vcf"/>
+      <param name="output_fragments" value="0"/>
+      <param name="output_phased" value="0"/>
+      <conditional name="optimization">
+        <param name="choice" value="default"/>
+      </conditional>
+      <output name="haplotype" ftype="txt" file="output_haplotype.out"/>
+    </test>
+
+    <!-- Defaults with all outputs -->
+    <test expect_num_outputs="3">
+      <param name="input_bam" ftype="bam" value="input.bam"/>
+      <param name="input_vcf" ftype="vcf" value="input.vcf"/>
+      <param name="output_fragments" value="1"/>
+      <param name="output_phased" value="1"/>
+      <conditional name="optimization">
+        <param name="choice" value="default"/>
+      </conditional>
+      <output name="frags" ftype="txt" file="output_frag.dat"/>
+      <output name="haplotype" ftype="txt" file="output_haplotype.out"/>
+      <output name="haplotype_phased" ftype="vcf" file="output_haplotype.out.phased.vcf"/>
+    </test>
+
+    <!-- Hi-C optimization -->
     <test expect_num_outputs="3">
       <param name="input_bam" ftype="bam" value="input.bam"/>
       <param name="input_vcf" ftype="vcf" value="input.vcf"/>
       <param name="output_fragments" value="1"/>
       <param name="output_phased" value="1"/>
-      <param name="optimization" value="default"/>
+      <conditional name="optimization">
+        <param name="choice" value="default"/>
+      </conditional>
       <output name="frags" ftype="txt" file="output_frag.dat"/>
       <output name="haplotype" ftype="txt" file="output_haplotype.out"/>
       <output name="haplotype_phased" ftype="vcf" file="output_haplotype.out.phased.vcf"/>
     </test>
+
+    <!-- Pacbio optimization with ref genome -->
+    <test expect_num_outputs="3">
+      <param name="input_bam" ftype="bam" value="input.bam"/>
+      <param name="input_vcf" ftype="vcf" value="input.vcf"/>
+      <param name="output_fragments" value="1"/>
+      <param name="output_phased" value="1"/>
+      <conditional name="optimization">
+        <param name="choice" value="pacbio"/>
+      </conditional>
+      <conditional name="reference_genome">
+        <param name="source" value="history"/>
+      </conditional>
+      <param name="fasta" ftype="fasta" value="ref.fasta"/>
+      <output name="frags" ftype="txt" file="output_frag.dat"/>
+      <output name="haplotype" ftype="txt" file="output_haplotype.out"/>
+      <output name="haplotype_phased" ftype="vcf" file="output_haplotype.out.phased.vcf"/>
+    </test>
+
+    <!-- Oxford nanopore optimization with ref genome -->
+    <test expect_num_outputs="3">
+      <param name="input_bam" ftype="bam" value="input.bam"/>
+      <param name="input_vcf" ftype="vcf" value="input.vcf"/>
+      <param name="output_fragments" value="1"/>
+      <param name="output_phased" value="1"/>
+      <output name="frags" ftype="txt" file="output_frag.dat"/>
+      <output name="haplotype" ftype="txt" file="output_haplotype.out"/>
+      <output name="haplotype_phased" ftype="vcf" file="output_haplotype.out.phased.vcf"/>
+      <conditional name="optimization">
+        <param name="optimization" value="ont"/>
+      </conditional>
+      <conditional name="reference_genome">
+        <param name="source" value="history"/>
+      </conditional>
+      <param name="fasta" ftype="fasta" value="ref.fasta"/>
+    </test>
   </tests>
 
   <help><![CDATA[
@@ -172,6 +217,7 @@
 
   ]]></help>
   <citations>
-    <citation type="doi">https://doi.org/10.1101/gr.213462.116</citation>
+      <citation type="doi">10.1101/gr.213462.116</citation>
   </citations>
+  <expand macro="creator"/>
 </tool>