view hicPlotMatrix.xml @ 11:c2521cba1c32 draft

planemo upload for repository https://github.com/maxplanck-ie/HiCExplorer/tree/master/galaxy/wrapper/ commit 2307743fd10f0babde52eec30289fe1682236287
author iuc
date Sat, 09 Jun 2018 15:32:09 -0400
parents 653c6fead9f9
children 40b33e101621
line wrap: on
line source

<tool id="hicexplorer_hicplotmatrix" name="@BINARY@" version="@WRAPPER_VERSION@.0">
    <description>plot a Hi-C contact matrix heatmap</description>
    <macros>
        <token name="@BINARY@">hicPlotMatrix</token>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements" />
    <command detect_errors="exit_code"><![CDATA[

        #if str($pca_conditional.pca_type) == 'bigwig':
            ln -s $pca_conditional.pca_bigwig pca.bw &&
            #set $pca = '--bigwig pca.bw'
        #elif str($pca_conditional.pca_type) == '':
            #set $pca = ''
        #end if

        @BINARY@

            --matrix '$matrix_h5_cooler'

            #if $title and $title is not None:
                --title '$title'
            #end if

            #if $scoreName and $scoreName is not None:
                --scoreName '$scoreName'
            #end if

            --outFileName plot.$image_file_format

            $perChromosome
            $clearMaskedBins

            ## special: --chromosomeOrder is optional, but if given needs at least one argument
            #set chroms = '" "'.join([ str($var.chromosome) for $var in $chromosomeOrder ])
            #if chroms:
                --chromosomeOrder "$chroms"
            #end if

            #if $region:
                --region '$region'
            #end if

            #if $region2:
                --region2 '$region2'
            #end if
            $log1p
            $log

            #if $colormap:
                --colorMap $colormap
            #end if

            #if $vMin:
                --vMin $vMin
            #end if

            #if $vMax:
                --vMax $vMax
            #end if

            $pca

        && mv plot.$image_file_format plot
]]>
    </command>
    <inputs>
        <expand macro='matrix_h5_cooler_macro' />

        <param argument="--title" type="text" optional="true" label="Plot title"/>
        <param argument="--scoreName" type="text" optional="true" label="Score name" help="The label for the heatmap legend."/>
        <param argument="--perChromosome" type="boolean" truevalue="--perChromosome" falsevalue="" checked="false"
            label="Plot per chromosome"
            help="Instead of plotting the whole matrix each chromosome is plotted next to the other. This parameter is not compatible with --region" />
        <param argument="--clearMaskedBins" type="boolean" truevalue="--clearMaskedBins" falsevalue="" checked="false"
            label="Remove masked bins from the matrix"  />

        <repeat name="chromosomeOrder" min="0" title="Chromosomes to include (and order to plot in):"
            help="This option overrides --region and --region2" >
            <param name="chromosome" type="text" >
                <validator type="empty_field" />
            </param>
        </repeat>

        <param argument="--region" type="text" optional="True" label="Plot only this region"
            help="The format is chr:start-end The plotted region contains the main diagonal and is symmetric unless  --region2 is given"/>
        <param argument="--region2" type="text" optional="True" label="Region two to plot"
            help="If given then only the region defined by --region and --region2 is plotted. The format is the same as --region"/>
        <param argument="--log1p" type="boolean" truevalue="--log1p" falsevalue="" checked="false" label="Plot the log1p of the matrix values (log(Hi-C contacts+1)). This option is recommended."/>
        <param argument="--log" type="boolean" truevalue="--log" falsevalue="" checked="false" label="Plot the log of the matrix values. (log(Hi-C contacts))"/>

        <expand macro="colormap" />

        <param argument="--vMin" type="float" optional="true" label="vMin" help="Minimum value of the plotted score."/>
        <param argument="--vMax" type="float" optional="true" label="vMax" help="Maximum value of the plotted score."/>

        <conditional name="pca_conditional">
            <param name='pca_type' label='Datatype of eigenvector file' type='select'>
                <option value='' selected="true"></option>
                <option value='bigwig'>bigwig</option>
            </param>
            <when value='' />
            <when value='bigwig'>
                <param name='pca_bigwig'  type="data" format="bigwig"
                            label="Eigenvector file"/>
            </when>
        </conditional>
        <param name="image_file_format" type="select" label="Image output format">
            <option value="png" selected="True">png</option>
            <option value="svg">svg</option>
        </param>
    </inputs>
    <outputs>
        <data format="png" name="outFileName" from_work_dir="plot" label="${tool.name} on ${matrix_h5_cooler.name} [${on_string}]: Plot">
            <change_format>
                <when input="image_file_format" value="svg" format="svg" />
            </change_format>
        </data>
    </outputs>
    <tests>
        <test>
            <param name="matrix_h5_cooler" value="Li_et_al_2015.h5"/>
            <conditional name="pca_conditional">
                <param name="pca_type" value=''/>
            </conditional>
            <param name="region" value="chrX:3000000-3500000"/>
            <param name="region2" value="chrX:3100000-3600000"/>
            <param name="log1p" value="True"/>
            <param name="clearMaskedBins" value="True"/>
            <param name="image_file_format" value="png" />
            <output name="outFileName" file="master_matrix_plot.png" ftype="png" compare="sim_size"/>
        </test>
        <test>
            <param name="matrix_h5_cooler" value="Li_et_al_2015.cool"/>
            <conditional name="pca_conditional">
                <param name="pca_type" value=''/>
            </conditional>
            <param name="region" value="X:3000000-3500000"/>
            <param name="image_file_format" value="png" />
            <output name="outFileName" file="Li_chrX30-35_cool.png" ftype="png" compare="sim_size"/>
        </test>
        <test>
            <param name="matrix_h5_cooler" value="pearson_small_50kb.cool"/>
            <param name="perChromosome" value="True"/>
            <conditional name="pca_conditional">
                <param name="pca_type" value='bigwig'/>
                <param name="pca_bigwig" value="pca1.bw"/>
            </conditional>
            <param name='colormap' value='hot'/>
            <param name="image_file_format" value="svg" />
            <output name="outFileName" file="small_matrix_50kb_pearson_pca1_plot.svg" ftype="svg" compare="sim_size" delta='35000'/>
        </test>
        <test>
            <param name="matrix_h5_cooler" value="pearson_small_50kb.h5"/>
            <param name="perChromosome" value="True"/>
            <conditional name="pca_conditional">
                <param name="pca_type" value='bigwig'/>
                <param name="pca_bigwig" value="pca1.bw"/>
            </conditional>
            <param name='colormap' value='hot'/>

            <param name="image_file_format" value="svg" />
            <output name="outFileName" file="small_matrix_50kb_pearson_pca1_plot.svg" ftype="svg" compare="sim_size" delta='35000'/>
        </test>
    </tests>
    <help><![CDATA[
Contact matrix plot
=======================

**hicPlotMatrix** is a visualization tool for Hi-C contact matrices. It supports to plot genome-wide contact matrices, one or multiple chromosomes, a region or two regions against each other.
Additionally it can plot the result of a principal component analysis obtained by ``hicPCA`` to have a better understanding of A / B compartments.

_________________

Usage
-----

This tool can be used on any h5 or cool Hi-C contact matrix. It is noteworthy that for comparisons of 2 matrices or more, they must all have the same or similar number of contacts.

_________________

Output
------

**hicPlotMatrix** outputs a heatmap of a contact matrix in either png or svg format, below is an example of such a plot:

.. image:: $PATH_TO_IMAGES/hicPlotMatrix.png
   :width: 50%

Contact matrix of *Drosophila melanogaster* embryos visualized using **hicPlotMatrix**. Hi-C matrix bins were merged to a 25 kb bin size using ``hicMergeMatrixBins`` and the matrix has then been corrected using ``hicCorrectMatrix`` before plotting.

Another example is available below using Hi-C data published by `Lieberman-Aiden <https://doi.org/10.1126/science.1181369>`_ in 2009, (`GSE18199 <https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE18199>`_). A Hi-C contact matrix has been plotted with the ``--perChr`` option and the first eigenvector (pca1) computed by ``hicPCA``. For this plot a pearson correlated matrix was used, which is computed by first creating an observed / expected matrix and then a pearson correlation matrix with ``hicTransform``.

.. image:: $PATH_TO_IMAGES/SRR0279XX_perChr_eigenvector1.png
   :width: 70 %

_________________

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

.. _readthedocs.io: http://hicexplorer.readthedocs.io/en/latest/index.html
.. _Colormaps: https://matplotlib.org/examples/color/colormaps_reference.html
]]></help>
    <expand macro="citations" />
</tool>