view hicNormalize.xml @ 6:28f739bc89c3 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hicexplorer commit fa140a9f660eab2459e21b0b637b129d7de24c02
author iuc
date Tue, 10 Jan 2023 17:50:20 +0000
parents 6d54ef23d5f3
children 706a83c64f45
line wrap: on
line source

<tool id="hicexplorer_hicnormalize" name="@BINARY@" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@">
    <description>normalizes a matrix to norm range or smallest read count</description>
    <macros>
        <token name="@BINARY@">hicNormalize</token>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements" />
    <command detect_errors="exit_code"><![CDATA[
        #import re

        mkdir output &&
        #for $counter, $m in enumerate($matrix_h5_cooler_multiple):
            ln -s '$m' '${counter}_matrix.$m.ext' &&
        #end for
        #set $m = ' '.join([ '\'%s_matrix.%s\'' % ($counter, $matrix.ext) for $counter, $matrix in enumerate($matrix_h5_cooler_multiple) ])
        #set $m_out = ' '.join([ "'output/%s_norm_%s'" % ($counter, @ESCAPE_IDENTIFIER_MATRIX@) for $counter, $matrix in enumerate($matrix_h5_cooler_multiple) ])

        @BINARY@ --matrices $m
        #if $normalize_conditional.normalize == 'multiplicative':
            --multiplicativeValue $normalize_conditional.multiplicativeValue
        #end if
        --normalize $normalize_conditional.normalize
        #if $zero_threshold_value:
            --setToZeroThreshold $zero_threshold_value
        #end if

        --outFileName $m_out
]]>
    </command>
    <inputs>
        <expand macro='matrix_h5_cooler_multiple_macro' />
        <conditional name="normalize_conditional">
            <param name='normalize' type='select' label='Normalize matrices'>
                <option value='norm_range'>0 to 1 range</option>
                <option value='smallest'>Smallest read count</option>
                <option value='multiplicative'>Multiply by value</option>
            </param>
            <when value='norm_range' />
            <when value='smallest' />
            <when value='multiplicative'>
                <param name="multiplicativeValue" type="float" value="1.0" label="Multiplicative value" />
            </when>
        </conditional>
        <param name="zero_threshold_value" type="float" value="1.0" optional='True' label="Set values below this threshold to zero" />
    </inputs>
    <outputs>
        <data format='cool' name="normalize_matrix">
            <discover_datasets pattern="__name_and_ext__" directory="output" visible="true" />
            <change_format>
                <when input_dataset="matrix_h5_cooler_multiple" attribute="ext" value="h5" format="h5" />
            </change_format>
        </data>
    </outputs>
    <tests>
        <test>
            <param name="matrix_h5_cooler_multiple" value="small_test_matrix.cool" />
            <param name='normalize' value='norm_range' />
            <output name="normalize_matrix">
                <discovered_dataset designation="0_norm_small_test_matrix" ftype="cool">
                    <assert_contents>
                        <has_h5_keys keys="bins,chroms,indexes,pixels" />
                    </assert_contents>
                </discovered_dataset>
            </output>
        </test>
        <test>
            <param name="matrix_h5_cooler_multiple" value="small_test_matrix.cool,small_test_matrix.cool" />
            <param name='normalize' value='smallest' />
            <output name="normalize_matrix">
                <discovered_dataset designation="0_norm_small_test_matrix" ftype="cool">
                    <assert_contents>
                        <has_h5_keys keys="bins,chroms,indexes,pixels" />
                    </assert_contents>
                </discovered_dataset>
                <discovered_dataset designation="1_norm_small_test_matrix" ftype="cool">
                    <assert_contents>
                        <has_h5_keys keys="bins,chroms,indexes,pixels" />
                    </assert_contents>
                </discovered_dataset>
            </output>
        </test>
        <test>
            <param name="matrix_h5_cooler_multiple" value="small_test_matrix.h5,small_test_matrix.h5" />
            <param name='normalize' value='smallest' />
            <output name="normalize_matrix">
                <discovered_dataset designation="0_norm_small_test_matrix" ftype="h5">
                    <assert_contents>
                        <has_h5_keys keys="intervals,matrix" />
                    </assert_contents>
                </discovered_dataset>
                <discovered_dataset designation="1_norm_small_test_matrix" ftype="h5">
                    <assert_contents>
                        <has_h5_keys keys="intervals,matrix" />
                    </assert_contents>
                </discovered_dataset>
            </output>
        </test>
    </tests>
    <help><![CDATA[

Normalization of matrices
=========================

**hicNormalize** normalizes either each matrix to a 0 - 1 value range, to the smallest read coverage or with a user given factor.

_________________

Output
------

The normalized matrices.

_________________

| For more information about HiCExplorer please consider our documentation on readthedocs.io_

.. _readthedocs.io: http://hicexplorer.readthedocs.io/en/latest/index.html
.. _`Lieberman-Aiden et al. (2009)`: https://doi.org/10.1126/science.1181369
]]>    </help>
    <expand macro="citations" />
</tool>