view chicAggregateStatistic.xml @ 5:989cec209ba2 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hicexplorer commit 3e5c2f8ce3e540b0474746a33ee20b4a374dd38c"
author iuc
date Fri, 11 Dec 2020 21:29:31 +0000
parents d6f5e51e97ec
children b53973719d7b
line wrap: on
line source

<tool id="hicexplorer_chicaggregatestatistic" name="@BINARY@" version="@WRAPPER_VERSION@.1">
    <description>computes with a target file the to be tested regions for chicDifferentialTest</description>
    <macros>
        <token name="@BINARY@">chicAggregateStatistic</token>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements" />
    <command detect_errors="exit_code"><![CDATA[
        #import re
        mkdir interactionFiles &&
        mkdir targetFolder &&
        mkdir aggregatedFilesFolder &&


        #if $tar_input_conditional.tar_input_selector == 'tar_input':
            ln -s '$tar_input_conditional.interactionFiles' viewpoints.tar && 
            tar -C interactionFiles -xvf viewpoints.tar &&
            
            #if $targetFiles:
                ln -s '$tar_input_conditional.targetFiles' targetFiles.tar && 
                tar -C targetFolder -xvf targetFiles.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 $targetFiles:
                #set identifier = @ESCAPE_IDENTIFIER_FILE@
                ln -s '$file' 'targetFolder/$identifier' &&
            #end for

        #end if


        #if $batchmode_conditional.batchmode_selector == 'optionSinglemode':
            #set $interactonfileslist = ' '.join([ 'interactionFiles/%s' % @ESCAPE_IDENTIFIER_FILE@ for $file in $interactionFiles ])
            #set $targetfileslist = ' '.join([ 'targetFolder/%s' % @ESCAPE_IDENTIFIER_FILE@ for $file in $targetFiles ])

        #end if
        @BINARY@
            #if $batchmode_conditional.batchmode_selector == 'optionSinglemode':
                --interactionFile $interactonfileslist
                --targetFile $targetfileslist
            #else:
                --interactionFile $batchmode_conditional.interactionFilesOrderFile
                --interactionFileFolder interactionFiles
                --targetFileFolder targetFolder
                --targetFile $batchmode_conditional.targetFilesOrderFile
                --batchMode
                --writeFileNamesToFile aggregatedFilesBatch.txt
            #end if

            --outputFolder aggregatedFilesFolder
            -suffix aggregated.txt
            --threads @THREADS@

        #if $tar:
            && cd aggregatedFilesFolder
            && tar -cvf ../aggregatedFilesFolder.tar *
            && cd ..
            && rm -rf aggregatedFilesFolder
        #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='targetFiles' type="data" format="tar" label="Target files" multiple="false"/>
            </when>
            <when value="interval_input">
                <param name='interactionFiles' type="data" format="interval" label="Interaction files" multiple="true"/>
                <param name='targetFiles' type="data" format="interval" label="Target files" multiple="true"/>
            </when>
        </conditional>
        

        <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='targetFilesOrderFile' type="data" format="txt" label="Target file order"/>

            </when>
            <when value="optionSinglemode">
            </when>
        </conditional>
        <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="aggregatedFilesCollection" type="list" label="Aggregated files">
        
            <discover_datasets pattern="__name__" format='interval' directory="aggregatedFilesFolder" />
        </collection>
        <data name="aggregatedFileNames" from_work_dir="aggregatedFilesBatch.txt" format="txt" label="${tool.name} aggregated file names">
            <filter>batchmode_conditional.batchmode_selector == 'optionBatchmode'</filter>
        </data>
        <data name="aggregatedFilesFolderTar" from_work_dir="aggregatedFilesFolder.tar" format="tar" label="Aggregated files tar.gz">
            <filter>tar</filter>
        </data>
    </outputs>
    <tests>
        <test>
            <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_19093103_19093103_Tfap2d.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_4487435_4487435_Sox17.txt"/>
            <param name="targetFiles" value="cHi-C/chicSignificantInteractions/output_5_target/FL-E13-5_MB-E10-5_chr1_chr1_4487435_4487435_Sox17_target.txt,cHi-C/chicSignificantInteractions/output_5_target/FL-E13-5_MB-E10-5_chr1_chr1_14300280_14300280_Eya1_target.txt,cHi-C/chicSignificantInteractions/output_5_target/FL-E13-5_MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d_target.txt"/>

            <conditional name="batchmode_conditional">
                <param name="batchmode_selector" value='optionBatchmode'/>
                <param name="interactionFilesOrderFile" value='cHi-C/chicViewpoint/fileNames_two_matrices.txt'/>
                <param name="targetFilesOrderFile" value='cHi-C/chicSignificantInteractions/output_5_target_list.txt'/>
            </conditional>

            <output_collection name="aggregatedFilesCollection" type="list" count="6">
                <element name="FL-E13-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt" file="cHi-C/chicAggregateStatistic/batch_mode/FL-E13-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt" ftype="interval" lines_diff="4"/>
                <element name="MB-E10-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt" file="cHi-C/chicAggregateStatistic/batch_mode/MB-E10-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt" ftype="interval" lines_diff="4"/>

                <element name="FL-E13-5_chr1_chr1_4487435_4487435_Sox17_aggregated.txt" file="cHi-C/chicAggregateStatistic/batch_mode/FL-E13-5_chr1_chr1_4487435_4487435_Sox17_aggregated.txt" ftype="interval" lines_diff="4"/>
                <element name="MB-E10-5_chr1_chr1_4487435_4487435_Sox17_aggregated.txt" file="cHi-C/chicAggregateStatistic/batch_mode/MB-E10-5_chr1_chr1_4487435_4487435_Sox17_aggregated.txt" ftype="interval" lines_diff="4"/>

                <element name="FL-E13-5_chr1_chr1_19093103_19093103_Tfap2d_aggregated.txt" file="cHi-C/chicAggregateStatistic/batch_mode/FL-E13-5_chr1_chr1_19093103_19093103_Tfap2d_aggregated.txt" ftype="interval" lines_diff="4"/>
                <element name="MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d_aggregated.txt" file="cHi-C/chicAggregateStatistic/batch_mode/MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d_aggregated.txt" ftype="interval" lines_diff="4"/>
            </output_collection>

            <output name="aggregatedFileNames" file="cHi-C/chicAggregateStatistic/batch_mode_file_names.txt" ftype="txt" compare="sim_size" delta='40000'/>
        </test>
        <test>
            <param name="interactionFiles" value="cHi-C/chicViewpoint/output_1/FL-E13-5_chr1_chr1_14300280_14300280_Eya1.txt,cHi-C/chicViewpoint/output_1/MB-E10-5_chr1_chr1_14300280_14300280_Eya1.txt"/>
            <param name="targetFiles" value="cHi-C/chicSignificantInteractions/output_5_target/FL-E13-5_MB-E10-5_chr1_chr1_14300280_14300280_Eya1_target.txt"/>

            <conditional name="batchmode_conditional">
                <param name="batchmode_selector" value='optionSinglemode'/>
            </conditional>

            <output_collection name="aggregatedFilesCollection" type="list" count="2">
                <element name="FL-E13-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt" file="cHi-C/chicAggregateStatistic/regular_mode/FL-E13-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt" ftype="interval" lines_diff="4"/>
                <element name="MB-E10-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt" file="cHi-C/chicAggregateStatistic/regular_mode/MB-E10-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt" ftype="interval" lines_diff="4"/>
            </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_19093103_19093103_Tfap2d.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_4487435_4487435_Sox17.txt"/>
                <param name="targetFiles" value="cHi-C/chicSignificantInteractions/output_5_target/FL-E13-5_MB-E10-5_chr1_chr1_4487435_4487435_Sox17_target.txt,cHi-C/chicSignificantInteractions/output_5_target/FL-E13-5_MB-E10-5_chr1_chr1_14300280_14300280_Eya1_target.txt,cHi-C/chicSignificantInteractions/output_5_target/FL-E13-5_MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d_target.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="targetFilesOrderFile" value='cHi-C/chicSignificantInteractions/output_5_target_list.txt'/>
            </conditional>

            <param name='tar' value='True'/>

            <output name="aggregatedFilesFolderTar" file="cHi-C/chicAggregateStatistic/batch_mode.tar" ftype='tar' compare="sim_size" delta='40000' />
            <output name="aggregatedFileNames" file="cHi-C/chicAggregateStatistic/batch_mode_file_names.txt" ftype="txt" 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="targetFiles" value="cHi-C/chicSignificantInteractions/targetFolder.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="targetFilesOrderFile" value='cHi-C/chicSignificantInteractions/output_5_target_list.txt'/>
            </conditional>

            <param name='tar' value='True'/>

            <output name="aggregatedFilesFolderTar" file="cHi-C/chicAggregateStatistic/batch_mode.tar" ftype='tar' compare="sim_size" delta='40000' />
            <output name="aggregatedFileNames" file="cHi-C/chicAggregateStatistic/batch_mode_file_names.txt" ftype="txt" compare="sim_size" delta='40000'/>
        </test>
    </tests>
    <help><![CDATA[

Aggregate statistic for differential testing
============================================

chicAggregateStatistic is a preprocessing tool for chicDifferentialTest. It takes two consecutive viewpoint files and one target file and creates one
file containing all locations which should be tested for differential interactions. Either one target file for two consecutive viewpoint files or one
target file for all viewpoints is accepted.

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>