view hal_halReplaceGenome.xml @ 0:de9294f0826f 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:36:13 +0000
parents
children
line wrap: on
line source

<tool id="hal_halreplacegenome" name="halReplaceGenome" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>replaces a genome in a HAL file</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/> 
    <expand macro="stdio"/>
    <command detect_errors="aggressive"><![CDATA[
        ## Copy input HAL to ensure that it is not modified.
        cp '$input_hal' writable_hal.hal && 
        halReplaceGenome
            #if $replaceTop.useTopAlignment == 'true':
                --topAlignmentFile '$replaceTop.topAlignmentFile'
            #else:
                --noTopAlignment
            #end if
            #if $replaceBottom.useBottomAlignment == 'true':
                --bottomAlignmentFile '$replaceBottom.bottomAlignmentFile'
            #else:
                --noBottomAlignment
            #end if
            $noMarkAncestors
            writable_hal.hal '$refGenome' &&
        ## echo 'ok' to check it with assert_stdout. This is needed because there is no other stdout output, 
        ## and the output HAL file checksum always changes even with identical inputs.
        echo 'ok'
    ]]></command>
    <inputs>
        <expand macro="input_hal"/>
        <expand macro="params_refGenome"/>
        <conditional name="replaceTop">
            <param name="useTopAlignment" type="select" label="Top alignment" help="A top alignment file is required if the reference genome to be replaced is not the root. If none is provided, all top segments are removed even for the non-root reference genome. This produces an invalid HAL file, at least temporarily">
                <option value="true" selected="true">Yes, provide top alignment (default)</option>
                <option value="false">No, remove all top segments (--noTopAlignment)</option>
            </param>
            <when value="true">
                <param name="topAlignmentFile" type="data" format="hal" label="Top alignment file" help="HAL file containing an alignment of the reference genome, its parent, and its siblings (--topAlignmentFile)"/>
            </when>
            <when value="false"/>
        </conditional>
        <conditional name="replaceBottom">
            <param name="useBottomAlignment" type="select" label="Bottom alignment" help="A bottom alignment file is required if the reference genome to be replaced is not a leaf. If none is provided, all bottom segments are removed even for the non-leaf reference genome. This produces an invalid HAL file, at least temporarily">
                <option value="true" selected="true">Yes, provide bottom alignment (default)</option>
                <option value="false">No, remove all bottom segments (--noBottomAlignment)</option>
            </param>
            <when value="true">
                <param name="bottomAlignmentFile" type="data" format="hal" label="Bottom alignment file" help="HAL file containing an alignment of the reference genome and its children (--bottomAlignmentFile)"/>
            </when>
            <when value="false"/>
        </conditional>
        <expand macro="params_noMarkAncestors"/>
    </inputs>
    <outputs>
        <data name="out_file" format="hal" label="${tool.name} on ${on_string}" from_work_dir="writable_hal.hal"/>
    </outputs>
    <tests>
        <test expect_num_outputs="1">
            <param name="input_hal" value="halTest.hal"/>
            <param name="refGenome" value="Genome_2"/>
            <conditional name="replaceTop">
                <param name="useTopAlignment" value="true"/>
                <param name="topAlignmentFile" value="halReplaceGenome_top_input.hal"/>
            </conditional>
            <conditional name="replaceBottom">
                <param name="useBottomAlignment" value="false"/>
            </conditional>
            <output name="out_file" ftype="hal">
                <assert_contents>
                    <has_size min="55000"/>
                </assert_contents>
            </output>
            <assert_stdout>
                <has_line line="ok"/>
            </assert_stdout>
        </test>
        <test expect_num_outputs="1">
            <param name="input_hal" value="halTestExtended.hal"/>
            <param name="refGenome" value="Insert"/>
            <conditional name="replaceTop">
                <param name="useTopAlignment" value="true"/>
                <param name="topAlignmentFile" value="halReplaceGenome2_top_input.hal"/>
            </conditional>
            <conditional name="replaceBottom">
                <param name="useBottomAlignment" value="true"/>
                <param name="bottomAlignmentFile" value="halReplaceGenome2_bot_input.hal"/>
            </conditional>
            <param name="noMarkAncestors" value="true"/>
            <output name="out_file" ftype="hal">
                <assert_contents>
                    <has_size min="80000"/>
                </assert_contents>
            </output>
            <assert_stdout>
                <has_line line="ok"/>
            </assert_stdout>
        </test>
    </tests>
    <help><![CDATA[
halReplaceGenome replaces an existing genome from an input HAL file while keeping the overall tree topology intact. 
Depending on whether the genome is a root, leaf, or internal node, separate top and bottom alignment files may be required to reconnect the genome correctly to its parent and children.
Options exist to remove top or bottom alignment segments explicitly.
By default, ancestor nodes are marked for update to ensure consistency of the alignment after replacement. 
This behavior can be disabled when ancestor updates are not required.

A new HAL file is created as output instead of modifying the input HAL file.

-----

.. class:: warningmark

Running the tool on a HAL file in mmap format may fail or generate an invalid new HAL file, while the HDF5 format can run successfully. It is recommended to convert the input to HDF5 format first using halExtract.
    ]]></help>
    <expand macro="citation"/>
    <expand macro="creator"/>
</tool>