view chicPlotViewpoint.xml @ 1:61e2d34c5b99 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hicexplorer commit 5744259254d4254a29cb7a6687fbbfd103301064"
author bgruening
date Wed, 05 Feb 2020 19:55:06 -0500
parents ae8bf5420df2
children 136ebddd6ec3
line wrap: on
line source

<tool id="hicexplorer_chicplotviewpoint" name="@BINARY@" version="@WRAPPER_VERSION@.0">
    <description>creates plots for viewpoints</description>
    <macros>
        <token name="@BINARY@">chicPlotViewpoint</token>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements" />
    <command detect_errors="exit_code"><![CDATA[
        #import re

        mkdir interactionFiles &&
        mkdir differentialFolder &&
        mkdir significantFolder &&
        mkdir plots &&

        
        #for $file in $interactionFiles:
            #set identifier = @ESCAPE_IDENTIFIER_FILE@
            ln -s '$file' 'interactionFiles/$identifier' &&
        #end for

        #if $differentialFiles:
            #for $file in $differentialFiles:
                #set identifier = @ESCAPE_IDENTIFIER_FILE@
                ln -s '$file' 'differentialFolder/$identifier' &&
            #end for
        #end if

        #if $significantFiles:
            #for $file in $significantFiles:
                #set identifier = @ESCAPE_IDENTIFIER_FILE@
                ln -s '$file' 'significantFolder/$identifier' &&
            #end for
        #end if

        #if $batchmode_conditional.batchmode_selector == 'optionSinglemode':
            #set $interactonfileslist = ' '.join([ '\'interactionFiles/%s\'' % @ESCAPE_IDENTIFIER_FILE@ for $file in $interactionFiles ])
            #set $differentialfileslist = ' '.join([ '\'differentialFolder/%s\'' % @ESCAPE_IDENTIFIER_FILE@ for $file in $differentialFiles ])
            #set $significantfileslist = ' '.join([ '\'significantFolder/%s\'' % @ESCAPE_IDENTIFIER_FILE@ for $file in $significantFiles ])
        
        #end if

        @BINARY@
            #if $batchmode_conditional.batchmode_selector == 'optionSinglemode':
                --interactionFile $interactonfileslist
                #if $differentialFiles:
                    --differentialTestResult $differentialfileslist
                #end if

                #if $significantFiles:
                    --significantInteractions $significantfileslist 
                #end if

                -o out_plot.$image_file_format
            #else:
                --interactionFile $batchmode_conditional.interactionFilesOrderFile
                --interactionFileFolder interactionFiles
                #if $batchmode_conditional.differentialFilesOrderFile:
                    --differentialTestResult $batchmode_conditional.differentialFilesOrderFile
                    --differentialTestResultsFolder differentialFolder
                #end if
                #if $batchmode_conditional.significantInteractionFilesOrderFile:
                    --significantInteractions $batchmode_conditional.significantInteractionFilesOrderFile
                    --significantInteractionFileFolder significantFolder
                #end if
                --plotSampleNumber $batchmode_conditional.computeSampleNumber

                --batchMode
                --outputFolder plots
                --outputFormat $image_file_format


            #end if

            --range $rangeUpstream $rangeDownstream
            #if $backgroundModelFile:
                --backgroundModelFile $backgroundModelFile
            #end if

            #if $dpi:
                --dpi $dpi
            #end if 

            #if $maxPValue:
                --maxPValue $maxPValue
            #end if

            #if $minPValue:
                --minPValue $minPValue
            #end if

            --binResolution $resolution
            #if $colormap:
                --colorMapPvalue $colormap
            #end if

            $pvalue
            #if $xFold:
                --xFold $xFold
            #end if
            --colorList $colorList
            --threads @THREADS@

            #if $batchmode_conditional.batchmode_selector == 'optionSinglemode':
                && mv out_plot.$image_file_format plots/out_plot.$image_file_format
            #end if
    ]]></command>
    <inputs>
        <param name='interactionFiles' type="data" format="interval" label="Interaction files" multiple="true"/>
        <param name='differentialFiles' type="data" format="interval" label="Rejected H0 files" multiple="true" optional='true'/>
        <param name='significantFiles' type="data" format="interval" label="Significant interaction files" multiple="true" optional='true'/>
        
        <param name="rangeUpstream" type="integer" value="500000"  label="Upstream range" help='Defines the region upstream of a reference point which should be considered in the analysis.' />
        <param name="rangeDownstream" type="integer" value="500000"  label="Downstream range" help='Defines the region upstream of a reference point which should be considered in the analysis.' />   
        <param argument="--backgroundModelFile" type="data" format='tabular'
                        label="Background model"
                        help="The background file computed by chicViewpointBackgroundModel" optional='true'/>
     
        <conditional name="batchmode_conditional">
            <param name="batchmode_selector" type="select" label="Compute files individually or in batch mode">
                <option value="optionBatchmode">Batch processing</option>
                <option value="optionSinglemode" selected="True">Single file processing</option>
            </param>
            <when value="optionBatchmode">
                <param name='interactionFilesOrderFile' type="data" format="txt" label="Interaction file order"/> 
                <param name='differentialFilesOrderFile' type="data" format="txt" label="Rejected H0 file order" optional='true'/>
                <param name='significantInteractionFilesOrderFile' type="data" format="txt" label="Significant file order" optional='true'/>
                <param name='computeSampleNumber' type="integer" value='2' label="Plot n sample in one plot"/> 

            </when>
            <when value="optionSinglemode">              
            </when>
        </conditional>


        <param argument="--maxPValue" type="float" optional="true" label="Max p-value" help="Maximum value of the plotted p-value."/>
        <param argument="--minPValue" type="float" optional="true" label="Min p-value" help="Minimum value of the plotted p-value."/>
        <param name='resolution' type='integer' value='1000' label='Resolution of cHi-C data' help='Resolution of the bin in genomic units. Values are usually e.g. 1000 for a 1kb, 5000 for a 5kb or 10000 for a 10kb resolution.' optional='true'/>
        <param name='pvalue' type='boolean' truevalue='--pValue'  falsevalue="" checked="false" label="Plot p-values as a colorbar"/>
        <expand macro="colormap" />

        <param name='xFold' type='float' value='' label='X-fold mean background' help='Plot x-fold region for the mean background.' optional='true'/>

        <param name="image_file_format" type="select" label="Image output format">
            <option value="png" selected="True">png</option>
            <option value="svg">svg</option>
            <option value="pdf">pdf</option>
        </param>
        <param name='dpi' type='integer' label='DPI for image' help='Change the default resolution of the plot.' optional='true'/>
        <param name='colorList' type='text' value='g b c m y k' label='Color list' help='Colorlist for the viewpoint lines. For all available colors please check matplotlib documentation: https://matplotlib.org/3.1.0/gallery/color/named_colors.html' optional='true'/>

    
    </inputs>
    <outputs>
        <collection name="plotsCollection" type="list" label="cHi-C viewpoint plots">
            <discover_datasets pattern="__name_and_ext__" directory="plots" />
        </collection>
      
    </outputs>
    <tests>
        <test>
            <param name="interactionFiles" value="cHi-C/chicViewpoint/output_1/FL-E13-5_chr1_chr1_14300280_14300280_Eya1.bed,cHi-C/chicViewpoint/output_1/FL-E13-5_chr1_chr1_4487435_4487435_Sox17.bed,cHi-C/chicViewpoint/output_1/FL-E13-5_chr1_chr1_19093103_19093103_Tfap2d.bed,cHi-C/chicViewpoint/output_1/MB-E10-5_chr1_chr1_4487435_4487435_Sox17.bed,cHi-C/chicViewpoint/output_1/MB-E10-5_chr1_chr1_14300280_14300280_Eya1.bed,cHi-C/chicViewpoint/output_1/MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d.bed"/>
            <param name="differentialFiles" value="cHi-C/chicDifferentialTest/batch_mode_fisher_outfile/FL-E13-5_MB-E10-5_chr1_chr1_4487435_4487435_Sox17_H0_rejected.bed,cHi-C/chicDifferentialTest/batch_mode_fisher_outfile/FL-E13-5_MB-E10-5_chr1_chr1_14300280_14300280_Eya1_H0_rejected.bed,cHi-C/chicDifferentialTest/batch_mode_fisher_outfile/FL-E13-5_MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d_H0_rejected.bed"/>
            <param name="significantFiles" value="cHi-C/chicSignificantInteractions/output_5/FL-E13-5_chr1_chr1_4487435_4487435_Sox17_output_significant.bed,cHi-C/chicSignificantInteractions/output_5/FL-E13-5_chr1_chr1_14300280_14300280_Eya1_output_significant.bed,cHi-C/chicSignificantInteractions/output_5/FL-E13-5_chr1_chr1_19093103_19093103_Tfap2d_output_significant.bed,cHi-C/chicSignificantInteractions/output_5/MB-E10-5_chr1_chr1_4487435_4487435_Sox17_output_significant.bed,cHi-C/chicSignificantInteractions/output_5/MB-E10-5_chr1_chr1_14300280_14300280_Eya1_output_significant.bed,cHi-C/chicSignificantInteractions/output_5/MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d_output_significant.bed"/>

            
            <conditional name="batchmode_conditional">
                <param name="batchmode_selector" value='optionBatchmode'/>
                <param name="interactionFilesOrderFile" value='cHi-C/chicViewpoint/fileNames_two_matrices.txt'/>
                <param name="differentialFilesOrderFile" value='cHi-C/chicDifferentialTest/rejectedFilesList.txt'/>
                <param name="significantInteractionFilesOrderFile" value='cHi-C/chicSignificantInteractions/output_5_significant_files.txt'/>
                <param name='computeSampleNumber' value='2'/>
            </conditional>
            <param name="pvalue" value='True'/>
            <param name="alpha" value='0.5'/>
            <param name='backgroundModelFile' value='cHi-C/background.bed'/>
            <param name='xFold' value='1.5'/>
            <output_collection name="plotsCollection" type="list" count="3">
                <element name="Eya1_FL-E13-5_MB-E10-5_chr1_chr1_14300280" file="cHi-C/chicPlotViewpoint/batchMode/two/Eya1_FL-E13-5_MB-E10-5_chr1_chr1_14300280.png" ftype="png" compare='sim_size' delta='40000'/>
                <element name="Sox17_FL-E13-5_MB-E10-5_chr1_chr1_4487435" file="cHi-C/chicPlotViewpoint/batchMode/two/Sox17_FL-E13-5_MB-E10-5_chr1_chr1_4487435.png" ftype="png" compare='sim_size' delta='40000'/>
                <element name="Tfap2d_FL-E13-5_MB-E10-5_chr1_chr1_19093103" file="cHi-C/chicPlotViewpoint/batchMode/two/Tfap2d_FL-E13-5_MB-E10-5_chr1_chr1_19093103.png" ftype="png" compare='sim_size' delta='40000'/>
            </output_collection>

        </test>
        <test>
            <param name="interactionFiles" value="cHi-C/chicViewpoint/output_1/FL-E13-5_chr1_chr1_14300280_14300280_Eya1.bed"/>
            
            <conditional name="batchmode_conditional">
                <param name="batchmode_selector" value='optionSinglemode'/>
            </conditional>

            <output_collection name="plotsCollection" type="list" count="1">
                <element name="out_plot" file="cHi-C/chicPlotViewpoint/FL-E13-5_chr1_chr1_14300280_14300280_Eya1.png" ftype="png" compare='sim_size' delta='40000'/>

            </output_collection>
        </test>
    </tests>
    <help><![CDATA[

Plot of viewpoints
==================

chicPlotViewpoint plots one or many viewpoints with the average background model and the computed p-value per sample. Moreover it can highlight differential interactions of two samples and or significant regions.

An example usage is:

`$ chicPlotViewpoint --interactionFile viewpoint1.bed viewpoint2.bed --range 500000 500000  --backgroundModelFile background_model.bed --pValue --outFileName viewpoint1_2.png --dpi 300`


In batch mode the list of file names and the folders containing the files need to be given:

`$ chicPlotViewpoint --interactionFile viewpoint_names.txt -interactionFileFolder viewpointFilesFolder --differentialTestResult rejected_H0.txt --differentialTestResultsFolder differentialFolder --range 500000 500000 --backgroundModelFile background_model.bed --pValue --outputFolder plotsFOlder --dpi 300 --threads 20`


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

.. _readthedocs.io: http://hicexplorer.readthedocs.io/en/latest/index.html
]]></help>
    <expand macro="citations" />
</tool>