view chicPlotViewpoint.xml @ 4:ac7999229ac6 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hicexplorer commit db84cc85222518217286b42262935edd3a49c98e"
author iuc
date Fri, 14 Aug 2020 06:02:35 -0400
parents dbf82dd7bdb3
children 031872f8e2e0
line wrap: on
line source

<tool id="hicexplorer_chicplotviewpoint" name="@BINARY@" version="@WRAPPER_VERSION@.1">
    <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 &&

        #if $tar_input_conditional.tar_input_selector == 'tar_input':
            ln -s '$tar_input_conditional.interactionFiles' viewpoints.tar && 
            tar -C interactionFiles -xvf viewpoints.tar &&

            #if $differentialFiles:
                ln -s '$tar_input_conditional.differentialFiles' differential.tar && 
                tar -C differentialFolder -xvf differential.tar &&
            #end if
            #if $significantFiles:
                ln -s '$tar_input_conditional.significantFiles' significantFiles.tar && 
                tar -C significantFolder -xvf significantFiles.tar &&
            #end if
        #else:
            #for $file in $tar_input_conditional.interactionFiles:
                #set identifier = @ESCAPE_IDENTIFIER_FILE@
                ln -s '$file' 'interactionFiles/$identifier' &&
            #end for

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

            #for $file in $tar_input_conditional.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 $tar_input_conditional.interactionFiles ])
            #set $differentialfileslist = ' '.join([ '\'differentialFolder/%s\'' % @ESCAPE_IDENTIFIER_FILE@ for $file in $tar_input_conditional.differentialFiles ])
            #set $significantfileslist = ' '.join([ '\'significantFolder/%s\'' % @ESCAPE_IDENTIFIER_FILE@ for $file in $tar_input_conditional.significantFiles ])

        #end if

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

                #if $tar_input_conditional.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@
            $truncateZeroPvalues
            #if $batchmode_conditional.batchmode_selector == 'optionSinglemode':
                && mv out_plot.$image_file_format plots/out_plot.$image_file_format
            #end if

            #if $tar:
                && cd plots
                && tar -cvf ../plots.tar *
                && cd ..
                && rm -rf plots
            #end if
    ]]></command>
    <inputs>
        <conditional name="tar_input_conditional">
            <param name="tar_input_selector" type="select" label="Compute files individually or in batch mode">
                <option value="tar_input">Tar file</option>
                <option value="interval_input" selected="True">Interval files</option>
            </param>
            <when value="tar_input">
                <param name='interactionFiles' type="data" format="tar" label="Interaction files" multiple="false"/>
                <param name='differentialFiles' type="data" format="tar" label="Rejected H0 files" multiple="true" optional='false'/>
                <param name='significantFiles' type="data" format="tar" label="Significant interaction files" multiple="true" optional='false'/>
            </when>
            <when value="interval_input">
                <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'/>
            </when>
        </conditional>

        <param name="rangeUpstream" type="integer" value="100000"  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="100000"  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'/>
        <param name='truncateZeroPvalues' type='boolean' truevalue='--truncateZeroPvalues'  falsevalue="" checked="false" label="Truncate zeros by setting them to one."
                    help="Sets all p-values which are equal to zero to one. This has the effect that the associated positions are not disturbing the presenation of small p-values."/>
  
        <param name='tar' type='boolean' checked="false" truevalue='True' label="tar output to one file"
                help="The output is tarred to one file and not written to a collection. Set this option if the number of files is large."/>
    
    </inputs>
    <outputs>
        <collection name="plotsCollection" type="list" label="cHi-C viewpoint plots">
            <discover_datasets pattern="__name_and_ext__" directory="plots" />
        </collection>
        <data name="plotsTar" from_work_dir="plots.tar" format="tar" label="cHi-C viewpoint plots tar">
            <filter>tar</filter>
        </data>
    </outputs>
    <tests>
        <test>
            <conditional name="tar_input_conditional">
                <param name="tar_input_selector" value='interval_input'/>
                <param name="interactionFiles" value="cHi-C/chicViewpoint/output_1/FL-E13-5_chr1_chr1_14300280_14300280_Eya1.txt,cHi-C/chicViewpoint/output_1/FL-E13-5_chr1_chr1_4487435_4487435_Sox17.txt,cHi-C/chicViewpoint/output_1/FL-E13-5_chr1_chr1_19093103_19093103_Tfap2d.txt,cHi-C/chicViewpoint/output_1/MB-E10-5_chr1_chr1_4487435_4487435_Sox17.txt,cHi-C/chicViewpoint/output_1/MB-E10-5_chr1_chr1_14300280_14300280_Eya1.txt,cHi-C/chicViewpoint/output_1/MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d.txt"/>
                <param name="differentialFiles" value="cHi-C/chicDifferentialTest/batch_mode_fisher_outfile/FL-E13-5_MB-E10-5_chr1_chr1_4487435_4487435_Sox17_H0_rejected.txt,cHi-C/chicDifferentialTest/batch_mode_fisher_outfile/FL-E13-5_MB-E10-5_chr1_chr1_14300280_14300280_Eya1_H0_rejected.txt,cHi-C/chicDifferentialTest/batch_mode_fisher_outfile/FL-E13-5_MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d_H0_rejected.txt"/>
                <param name="significantFiles" value="cHi-C/chicSignificantInteractions/output_5/FL-E13-5_chr1_chr1_4487435_4487435_Sox17_significant_interactions.txt,cHi-C/chicSignificantInteractions/output_5/FL-E13-5_chr1_chr1_14300280_14300280_Eya1_significant_interactions.txt,cHi-C/chicSignificantInteractions/output_5/FL-E13-5_chr1_chr1_19093103_19093103_Tfap2d_significant_interactions.txt,cHi-C/chicSignificantInteractions/output_5/MB-E10-5_chr1_chr1_4487435_4487435_Sox17_significant_interactions.txt,cHi-C/chicSignificantInteractions/output_5/MB-E10-5_chr1_chr1_14300280_14300280_Eya1_significant_interactions.txt,cHi-C/chicSignificantInteractions/output_5/MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d_significant_interactions.txt"/>
            </conditional>


            <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="truncateZeroPvalues" value='True'/>

            <param name='backgroundModelFile' value='cHi-C/background.txt'/>
            <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>
            <conditional name="tar_input_conditional">
                <param name="tar_input_selector" value='interval_input'/>
                <param name="interactionFiles" value="cHi-C/chicViewpoint/output_1/FL-E13-5_chr1_chr1_14300280_14300280_Eya1.txt"/>
            </conditional>

            <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>

        <test>
            <conditional name="tar_input_conditional">
                <param name="tar_input_selector" value='interval_input'/>
                <param name="interactionFiles" value="cHi-C/chicViewpoint/output_1/FL-E13-5_chr1_chr1_14300280_14300280_Eya1.txt"/>
            </conditional>

            <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>

        <test>
            <conditional name="tar_input_conditional">
                <param name="tar_input_selector" value='interval_input'/>
                <param name="interactionFiles" value="cHi-C/chicViewpoint/output_1/FL-E13-5_chr1_chr1_14300280_14300280_Eya1.txt,cHi-C/chicViewpoint/output_1/FL-E13-5_chr1_chr1_4487435_4487435_Sox17.txt,cHi-C/chicViewpoint/output_1/FL-E13-5_chr1_chr1_19093103_19093103_Tfap2d.txt,cHi-C/chicViewpoint/output_1/MB-E10-5_chr1_chr1_4487435_4487435_Sox17.txt,cHi-C/chicViewpoint/output_1/MB-E10-5_chr1_chr1_14300280_14300280_Eya1.txt,cHi-C/chicViewpoint/output_1/MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d.txt"/>
                <param name="differentialFiles" value="cHi-C/chicDifferentialTest/batch_mode_fisher_outfile/FL-E13-5_MB-E10-5_chr1_chr1_4487435_4487435_Sox17_H0_rejected.txt,cHi-C/chicDifferentialTest/batch_mode_fisher_outfile/FL-E13-5_MB-E10-5_chr1_chr1_14300280_14300280_Eya1_H0_rejected.txt,cHi-C/chicDifferentialTest/batch_mode_fisher_outfile/FL-E13-5_MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d_H0_rejected.txt"/>
                <param name="significantFiles" value="cHi-C/chicSignificantInteractions/output_5/FL-E13-5_chr1_chr1_4487435_4487435_Sox17_significant_interactions.txt,cHi-C/chicSignificantInteractions/output_5/FL-E13-5_chr1_chr1_14300280_14300280_Eya1_significant_interactions.txt,cHi-C/chicSignificantInteractions/output_5/FL-E13-5_chr1_chr1_19093103_19093103_Tfap2d_significant_interactions.txt,cHi-C/chicSignificantInteractions/output_5/MB-E10-5_chr1_chr1_4487435_4487435_Sox17_significant_interactions.txt,cHi-C/chicSignificantInteractions/output_5/MB-E10-5_chr1_chr1_14300280_14300280_Eya1_significant_interactions.txt,cHi-C/chicSignificantInteractions/output_5/MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d_significant_interactions.txt"/>
            </conditional>

            <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="truncateZeroPvalues" value='True'/>

            <param name='backgroundModelFile' value='cHi-C/background.txt'/>
            <param name='xFold' value='1.5'/>
            <param name='tar' value='True'/>
            <output name="plotsTar" file="cHi-C/chicPlotViewpoint/batchMode/plots.tar" ftype='tar' compare="sim_size" delta='40000' />
        </test>

        <test>
            <conditional name="tar_input_conditional">
                <param name="tar_input_selector" value='tar_input'/>
                <param name="interactionFiles" value="cHi-C/chicViewpoint/output_1.tar"/>
                <param name="differentialFiles" value="cHi-C/chicDifferentialTest/batch_mode_fisher_outfile.tar"/>
                <param name="significantFiles" value="cHi-C/chicSignificantInteractions/significantFilesFolder.tar"/>
            </conditional>

            <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="truncateZeroPvalues" value='True'/>

            <param name='backgroundModelFile' value='cHi-C/background.txt'/>
            <param name='xFold' value='1.5'/>
            <param name='tar' value='True'/>
            <output name="plotsTar" file="cHi-C/chicPlotViewpoint/batchMode/plots.tar" ftype='tar' compare="sim_size" delta='40000' />
        </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.txt viewpoint2.txt --range 500000 500000  --backgroundModelFile background_model.txt --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.txt --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>