diff hal_hal2fasta.xml @ 0:90503ee992eb draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/haltools commit 6244b9d15a5ad97ae20191e2f8fbafe2050c3cac
author iuc
date Fri, 06 Feb 2026 10:33:50 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hal_hal2fasta.xml	Fri Feb 06 10:33:50 2026 +0000
@@ -0,0 +1,185 @@
+<tool id="hal_hal2fasta" name="hal2fasta" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
+    <description>exports sequences from HAL to FASTA</description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements"/> 
+    <expand macro="stdio"/>
+    <command detect_errors="aggressive"><![CDATA[
+        hal2fasta
+            #if $mode.export == 'default':
+                --start $mode.start
+                --length $mode.length
+            #else if $mode.export == '--sequence':
+                --sequence '$mode.sequence'
+                --start $mode.start
+                --length $mode.length
+            #else if $mode.export == '--subtree':
+                --subtree
+            #end if
+            --lineWidth $lineWidth
+            $upper
+            $ucscSequenceNames
+            '$input_hal' '$refGenome' > temp.fasta
+            #if $compression.type == 'gz':
+                && gzip -c temp.fasta > '$out_file'
+            #else if $compression.type == 'bz2':
+                && bzip2 -c temp.fasta > '$out_file'
+            #else:
+                && mv temp.fasta '$out_file'
+            #end if
+    ]]></command>
+    <inputs>
+        <expand macro="input_hal"/>
+        <expand macro="params_refGenome"/>
+        <conditional name="mode">
+            <param name="export" type="select" label="Export options">
+                <option value="default" selected="true">Export full reference genome (default)</option>
+                <option value="--sequence">Export a reference sequence (--sequence)</option>
+                <option value="--subtree">Export all genomes in the reference genome subtree (--subtree)</option>
+            </param>
+            <when value="default">
+                <expand macro="params_start"/>
+                <expand macro="params_length"/>
+            </when>
+            <when value="--subtree"/>
+            <when value="--sequence">
+                <expand macro="params_sequence"/>
+                <expand macro="params_start"/>
+                <expand macro="params_length"/>
+            </when>
+        </conditional>
+        <param argument="--upper" type="boolean" truevalue="--upper" falsevalue="" checked="false" label="Uppercase bases" help="Convert all bases to uppercase"/>
+        <param argument="--ucscSequenceNames" type="boolean" truevalue="--ucscSequenceNames" falsevalue="" checked="false" label="Use UCSC convention" help="Use the UCSC convention of Genome.Sequence for names. By default, only sequence names are used"/>
+        <param argument="--lineWidth" type="integer" min="1" value="80" label="Line width" help="Line width for output"/>
+        <expand macro="params_conditional_compression"/>
+    </inputs>
+    <outputs>
+        <data name="out_file" format="fasta" label="${tool.name} on ${on_string}: Genome FASTA">
+            <change_format>
+                <when input="compression.type" value="gz" format="fasta.gz"/>
+                <when input="compression.type" value="bz2" format="fasta.bz2"/>
+            </change_format>
+        </data>
+    </outputs>
+    <tests>
+        <test expect_num_outputs="1">
+            <param name="input_hal" value="halTest.hal"/>
+            <param name="refGenome" value="Genome_0"/>
+            <output name="out_file" ftype="fasta">
+                <assert_contents>
+                    <has_line line=">Genome_0_seq"/>
+                    <has_line line="CCCGTAACCCAATCCACGGTGCCGGCGGCGAGATGTATTGTCTGGGCGCAAAGCCATTTCGCCACCACATGCTGCGCGAC"/>
+                    <has_n_lines n="23"/>
+                </assert_contents>
+            </output>
+        </test>
+        <test expect_num_outputs="1">
+            <param name="input_hal" value="halTest.hal"/>
+            <param name="refGenome" value="Genome_0"/>
+             <conditional name="compression">
+                <param name="type" value="gz"/>
+            </conditional>
+            <output name="out_file" ftype="fasta.gz" file="hal2fasta_output.fasta.gz"/>
+        </test>
+        <test expect_num_outputs="1">
+            <param name="input_hal" value="halTest.hal"/>
+            <param name="refGenome" value="Genome_0"/>
+             <conditional name="compression">
+                <param name="type" value="bz2"/>
+            </conditional>
+            <output name="out_file" ftype="fasta.bz2" file="hal2fasta_output.fasta.bz2"/>
+        </test>
+        <test expect_num_outputs="1">
+            <param name="input_hal" value="halTest.hal"/>
+            <param name="refGenome" value="Genome_0"/>
+            <param name="lineWidth" value="40"/>
+            <param name="upper" value="true"/>
+            <output name="out_file" ftype="fasta">
+                <assert_contents>
+                    <has_line line=">Genome_0_seq"/>
+                    <has_line line="TGCCGCGCGTGAGGTTGACACTCCGTTCGTGTTACATGTC"/>
+                    <has_n_lines n="45"/>
+                </assert_contents>
+            </output>
+        </test>
+        <test expect_num_outputs="1">
+            <param name="input_hal" value="halTest.hal"/>
+            <param name="refGenome" value="Genome_0"/>
+            <conditional name="mode">
+                <param name="export" value="--sequence"/>
+                <param name="sequence" value="Genome_0_seq"/>
+            </conditional>
+            <output name="out_file" ftype="fasta">
+                <assert_contents>
+                    <has_line line=">Genome_0_seq"/>
+                    <has_line line="CCCGTAACCCAATCCACGGTGCCGGCGGCGAGATGTATTGTCTGGGCGCAAAGCCATTTCGCCACCACATGCTGCGCGAC"/>
+                    <has_n_lines n="23"/>
+                </assert_contents>
+            </output>
+        </test>
+        <test expect_num_outputs="1">
+            <param name="input_hal" value="halTest.hal"/>
+            <param name="refGenome" value="Genome_0"/>
+            <conditional name="mode">
+                <param name="export" value="--subtree"/>
+            </conditional>
+            <output name="out_file" ftype="fasta">
+                <assert_contents>
+                    <has_line line=">Genome_0_seq"/>
+                    <has_line line=">Genome_1_seq"/>
+                    <has_line line=">Genome_2_seq"/>
+                    <has_line line=">Genome_3_seq"/>
+                    <has_line line="CCCGTAACCCAATCCACGGTGCCGGCGGCGAGATGTATTGTCTGGGCGCAAAGCCATTTCGCCACCACATGCTGCGCGAC"/>
+                    <has_n_lines n="226"/>
+                </assert_contents>
+            </output>
+        </test>
+        <test expect_num_outputs="1">
+            <param name="input_hal" value="halTest.hal"/>
+            <param name="refGenome" value="Genome_2"/>
+            <conditional name="mode">
+                <param name="export" value="--sequence"/>
+                <param name="sequence" value="Genome_2_seq"/>
+                <param name="start" value="50"/>
+                <param name="length" value="10"/>
+            </conditional>
+            <param name="ucscSequenceNames" value="true"/>
+            <output name="out_file" ftype="fasta">
+                <assert_contents>
+                    <has_line line=">Genome_2.Genome_2_seq"/>
+                    <has_line line="GAGGTTGACA"/>
+                    <has_n_lines n="2"/>
+                </assert_contents>
+            </output>
+        </test>
+        <!-- 
+        Does not pass currently due to a bug - that was fixed but not avalaible as release yet (16.12.2025)
+        https://github.com/ComparativeGenomicsToolkit/hal/issues/324
+
+        <test expect_num_outputs="1">
+            <param name="input_hal" value="halTest.hal"/>
+            <param name="genome" value="Genome_0"/>
+            <conditional name="mode">
+                <param name="export" value="default"/>
+                <param name="start" value="50"/>
+                <param name="length" value="10"/>
+            </conditional>
+            <param name="ucscSequenceNames" value="true"/>
+            <output name="out_file" ftype="fasta">
+                <assert_contents>
+                    <has_line line=">Genome_0.Genome_0_seq"/>
+                    <has_line line="GAGGTTGACA"/>
+                </assert_contents>
+            </output>
+        </test>
+        -->
+    </tests>
+    <help><![CDATA[
+hal2fasta exports sequence data from an input HAL file to an output FASTA file. 
+It can export a full genome, a single sequence of that genome, or all genomes in the entire subtree rooted of that genome.
+When exporting the full genome or a single sequence of that genome, the exported range can be limited using start and length.
+    ]]></help>
+    <expand macro="citation"/>
+    <expand macro="creator"/>
+</tool>
\ No newline at end of file