diff hicConvertFormat.xml @ 8:c0737631eea1 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hicexplorer commit 07802a6bd441d9da888cfb8283f8c2135704f7c9
author iuc
date Wed, 18 Oct 2023 10:33:29 +0000
parents 2a24ce221cd7
children 2ba6cee8e4db
line wrap: on
line diff
--- a/hicConvertFormat.xml	Tue Jan 10 19:02:29 2023 +0000
+++ b/hicConvertFormat.xml	Wed Oct 18 10:33:29 2023 +0000
@@ -39,6 +39,15 @@
                 --bedFileHicpro "matrix.bed"
                 --inputFormat hicpro
             #end if
+            #if $xml_path.inputFormat_selector == 'option2Dtext':
+                --matrices "matrix.2Dtext"
+                #if $xml_path.resolutions:
+                    #set $resolutions = ' '.join([ '"%s"' % $resolution for $resolution in str($xml_path.resolutions).split(" ") ])
+                    --resolutions $resolutions
+                #end if
+                --chromosomeSizes "chromosomeSizes.txt"
+                --inputFormat 2D-text
+            #end if
             #if $xml_path.inputFormat_selector == 'optionHic':
                 --matrices "matrix.hic"
                 #if $xml_path.resolutions:
@@ -77,7 +86,12 @@
                 ln -s '$xml_path.matrixHicpro' "matrix.hicpro" &&
                 ln -s '$xml_path.bedHicpro' "matrix.bed" &&
             #end if
+            #if $xml_path.inputFormat_selector == 'option2Dtext':
+               ln -s '$xml_path.matrix2Dtext' "matrix.2Dtext" &&
 
+               ln -s '$xml_path.chromosomeSizes' "chromosomeSizes.txt" &&
+
+            #end if
             #if $xml_path.inputFormat_selector == 'optionHic':
                 ln -s '$xml_path.matrixHic' "matrix.hic" &&
             #end if
@@ -87,6 +101,9 @@
 
             --outputFormat $outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector
             --outFileName 'matrix.$outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector'
+            #if $outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector == 'hicpro':
+                --bedFileHicpro intervalls.bed
+            #end if
 
         ### Set up links to matrices to have correct ending
         #else if $outputSingleMultiple_conditional.outputSingleMultiple_selector == 'multipleMatrix':
@@ -108,6 +125,10 @@
                     ln -s '$xml_path.matrix_h5_cooler' "matrix.hicpro" &&
                     ln -s '$xml_path.bedHicpro' "matrix.bed" &&
                 #end if
+                #if $xml_path.inputFormat_selector == 'option2Dtext':
+                    ln -s '$xml_path.chromosomeSizes' "chromosomeSizes.txt" &&
+
+                #end if
                 #if $xml_path.inputFormat_selector == 'optionHic':
                     ln -s '$xml_path.matrix_h5_cooler' "matrix.hic" &&
                 #end if
@@ -132,7 +153,19 @@
                     #end for
                     #set $m = ' '.join([ '"%s_matrix.homer"' % $counter for $counter, $matrix in enumerate($xml_manyToOne.matrixHomer) ])
                 #end if
-                 #if $xml_manyToOne.inputFormat_conditional.inputFormat_selector == 'optionHicpro':
+                #if $xml_manyToOne.inputFormat_conditional.inputFormat_selector == 'option2Dtext':
+                    #for $counter, $m in enumerate($xml_manyToOne.matrix2Dtext):
+                        ln -s '$m' "${counter}_matrix.matrix2Dtext" &&
+                    #end for
+                    #set $m = ' '.join([ '"%s_matrix.matrix2Dtext"' % $counter for $counter, $matrix in enumerate($xml_manyToOne.matrix2Dtext) ])
+                    #if $xml_manyToOne.resolutions:
+                        #set $resolutions = ' '.join([ '"%s"' % $resolution for $resolution in str($xml_manyToOne.resolutions).split(" ") ])
+                    --resolutions $resolutions
+                    #end if
+                    --chromosomeSizes "chromosomeSizes.txt"
+
+                #end if
+                #if $xml_manyToOne.inputFormat_conditional.inputFormat_selector == 'optionHicpro':
                     #for $counter, $m in enumerate($xml_manyToOne.matrixHicpro):
                         ln -s '$m' "${counter}_matrix.hicpro" &&
                     #end for
@@ -171,6 +204,11 @@
                     --bedFileHicpro "matrix.bed"
                     --inputFormat hicpro
                 #end if
+                #if $xml_path.inputFormat_selector == 'option2Dtext':
+                    --matrices "matrix.2Dtext"
+                    --chromosomeSizes "chromosomeSizes.txt"
+                    --inputFormat 2D-text
+                #end if
                 #if $xml_path.inputFormat_selector == 'optionHic':
                     --matrices "matrix.hic"
                     --inputFormat hic
@@ -189,7 +227,10 @@
                 #if $xml_manyToOne.inputFormat_conditional.inputFormat_selector == 'optionHomer':
                     --inputFormat homer
                 #end if
-
+                #if $xml_manyToOne.inputFormat_conditional.inputFormat_selector == 'option2Dtext':
+                    
+                    --inputFormat 2D-text
+                #end if
                 #if $xml_manyToOne.inputFormat_conditional.inputFormat_selector == 'optionHicpro':
                     --inputFormat hicpro
                     --bedFileHicpro '$bed'
@@ -205,139 +246,180 @@
         #if $outputSingleMultiple_conditional.outputSingleMultiple_selector == 'singleMatrix':
             #if $outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector == 'ginteractions':
                 && mv 'matrix.${outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector}.tsv' matrix_out
+            #else if $outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector == 'hicpro':
+                && mv matrix.hicpro matrix_out
             #else:
                 && mv 'matrix.$outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector' matrix_out
             #end if
         #else if $outputSingleMultiple_conditional.outputSingleMultiple_selector == 'multipleMatrix':
             && mv matrix.mcool matrix_out
         #end if
+
 ]]>
     </command>
     <inputs>
-
         <conditional name="outputSingleMultiple_conditional">
             <param name="outputSingleMultiple_selector" type="select" label="Choose output matrix type">
                 <option value="singleMatrix" selected="True">single matrix</option>
                 <option value="multipleMatrix">multiple matrix</option>
             </param>
-            <when value='singleMatrix'>
-                <expand macro='convertFormat_single_macro' />
-                <expand macro='convertFormat_single_output_macro' />
+            <when value="singleMatrix">
+                <expand macro="convertFormat_single_macro" />
+                <expand macro="convertFormat_single_output_macro" />
             </when>
-            <when value='multipleMatrix'>
+            <when value="multipleMatrix">
                 <conditional name="resolutionOrManyToOne_conditional">
                     <param name="resolutionOrManyToOne_selector" type="select" label="Choose input file type">
-                        <option value='resolution_option' >Create out of one matrix a multi matrix with diffrerent resolutions</option>
-                        <option value='manyToOne_option'>Create out of n matrices one multi matrix</option>
+                        <option value="resolution_option" >Create out of one matrix a multi matrix with diffrerent resolutions</option>
+                        <option value="manyToOne_option">Create out of n matrices one multi matrix</option>
                     </param>
-                    <when value='resolution_option'>
-                        <param name='resolutions' type='text' label='To be stored resolutions' help="Resolutions can be specified seperated with a space, e.g. '10000 20000 50000'">
-                            <validator type="expression" message="Only numeric characters and the a space as seperator are allowed.">value.replace(' ', '').isnumeric()</validator>
+                    <when value="resolution_option">
+                        <param name="resolutions" type="text" label="To be stored resolutions" help="Resolutions can be specified seperated with a space, e.g. '10000 20000 50000'">
+                            <validator type="expression" message="Only numeric characters and a space as seperator are allowed.">value.replace(' ', '').isnumeric()</validator>
                         </param>
-                        <expand macro='convertFormat_single_macro' />
+                        <expand macro="convertFormat_single_macro" />
                     </when>
-                    <when value='manyToOne_option'>
-                        <expand macro='convertFormat_multiple_macro' />
+                    <when value="manyToOne_option">
+                        <expand macro="convertFormat_multiple_macro" />
                     </when>
                 </conditional>
             </when>
         </conditional>
-        <param name='storeAppliedCorrection' type="boolean" truevalue="--store_applied_correction" falsevalue="" label="Store applied correction factors in column count" help="Option only for cool input files" />
-        <param name='enforceInteger' type="boolean" truevalue="--enforce_integer" falsevalue="" label="Enforce integer for count column" help="Option only for cool input files" />
+        <param name="storeAppliedCorrection" type="boolean" truevalue="--store_applied_correction" falsevalue="" label="Store applied correction factors in column count" help="Option only for cool input files" />
+        <param name="enforceInteger" type="boolean" truevalue="--enforce_integer" falsevalue="" label="Enforce integer for count column" help="Option only for cool input files" />
     </inputs>
     <outputs>
-        <data name='output_converted_matrix' from_work_dir='matrix_out' format='cool' label='Converted matrix'>
-            <filter>outputSingleMultiple_conditional.outputSingleMultiple_selector == 'singleMatrix'</filter>
+        <data name="output_converted_matrix" from_work_dir="matrix_out" format="cool" label="Converted matrix in cool format">
+            <filter>outputSingleMultiple_conditional['outputSingleMultiple_selector'] == 'singleMatrix'</filter>
             <change_format>
                 <when input="outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector" value="h5" format="h5" />
                 <when input="outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector" value="homer" format="zip" />
                 <when input="outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector" value="ginteractions" format="tabular" />
+                <when input="outputSingleMultiple_conditional.outputFormat_conditional.outputFormat_selector" value="hicpro" format="tabular" />
             </change_format>
         </data>
-        <data name='output_converted_matrix_multi' from_work_dir='matrix_out' format='mcool' label='Converted matrix mcool'>
-            <filter>outputSingleMultiple_conditional.outputSingleMultiple_selector == 'multipleMatrix'</filter>
+        <data name="output_converted_matrix_bed" from_work_dir="intervalls.bed" format="tabular" label="Converted matrix in tabular format">
+            <filter>outputSingleMultiple_conditional['outputFormat_conditional']['outputFormat_selector'] == 'hicpro'</filter>
+        </data>
+        <data name="output_converted_matrix_multi" from_work_dir="matrix_out" format="mcool" label="Converted matrix in mcool format">
+            <filter>outputSingleMultiple_conditional['outputSingleMultiple_selector'] == 'multipleMatrix'</filter>
         </data>
     </outputs>
     <tests>
-        <test>
-            <conditional name='outputSingleMultiple_conditional'>
-                <param name='outputSingleMultiple_selector' value='singleMatrix' />
-                <conditional name='inputFormat_conditional'>
-                    <param name='inputFormat_selector' value='optionCool' />
-                    <param name='matrix_h5_cooler' value='small_test_matrix.cool' />
+        <test expect_num_outputs="1">
+            <conditional name="outputSingleMultiple_conditional">
+                <param name="outputSingleMultiple_selector" value="singleMatrix" />
+                <conditional name="inputFormat_conditional">
+                    <param name="inputFormat_selector" value="optionCool" />
+                    <param name="matrix_h5_cooler" value="small_test_matrix.cool" />
                 </conditional>
 
-                <conditional name='outputFormat_conditional'>
-                    <param name='outputFormat_selector' value='h5' />
+                <conditional name="outputFormat_conditional">
+                    <param name="outputFormat_selector" value="h5" />
+                </conditional>
+            </conditional>
+            <output name="output_converted_matrix" ftype="h5">
+                <assert_contents>
+                    <has_h5_keys keys="intervals,matrix,nan_bins" />
+                </assert_contents>
+            </output>
+        </test>
+        <test expect_num_outputs="1">
+            <conditional name="outputSingleMultiple_conditional">
+                <param name="outputSingleMultiple_selector" value="singleMatrix" />
+                <conditional name="inputFormat_conditional">
+                    <param name="inputFormat_selector" value="option2Dtext" />
+                    <param name="matrix2Dtext" value="hicConvertFormat/GSM1436265_RAD21_ENCFF002EMQ.txt" />
+                    <param name="resolutions" value="10000" />
+                    <param name="chromosomeSizes" value="hicConvertFormat/hg19.chrom.sizes" />
+                </conditional>
+
+                <conditional name="outputFormat_conditional">
+                    <param name="outputFormat_selector" value="h5" />
                 </conditional>
             </conditional>
             <output name="output_converted_matrix" ftype="h5">
                 <assert_contents>
-                    <has_h5_keys keys='intervals,matrix,nan_bins' />
+                    <has_h5_keys keys="intervals,matrix" />
                 </assert_contents>
             </output>
         </test>
-        <test>
-            <conditional name='outputSingleMultiple_conditional'>
-                <param name='outputSingleMultiple_selector' value='singleMatrix' />
-                <conditional name='inputFormat_conditional'>
-                    <param name='inputFormat_selector' value='optionH5' />
-                    <param name='matrix_h5_cooler' value='small_test_matrix.h5' />
+        <test expect_num_outputs="1">
+            <conditional name="outputSingleMultiple_conditional">
+                <param name="outputSingleMultiple_selector" value="singleMatrix" />
+                <conditional name="inputFormat_conditional">
+                    <param name="inputFormat_selector" value="optionH5" />
+                    <param name="matrix_h5_cooler" value="small_test_matrix.h5" />
                 </conditional>
 
-                <conditional name='outputFormat_conditional'>
-                    <param name='outputFormat_selector' value='cool' />
+                <conditional name="outputFormat_conditional">
+                    <param name="outputFormat_selector" value="cool" />
                 </conditional>
             </conditional>
             <output name="output_converted_matrix" ftype="cool">
                 <assert_contents>
-                    <has_h5_keys keys='bins,chroms,indexes,pixels' />
+                    <has_h5_keys keys="bins,chroms,indexes,pixels" />
                 </assert_contents>
             </output>
         </test>
-        <test>
-            <conditional name='outputSingleMultiple_conditional'>
-                <param name='outputSingleMultiple_selector' value='singleMatrix' />
-                <conditional name='inputFormat_conditional'>
-                    <param name='inputFormat_selector' value='optionCool' />
-                    <param name='matrix_h5_cooler' value='hicConvertFormat/small_test_matrix_chr4.cool' />
+        <test expect_num_outputs="1">
+            <conditional name="outputSingleMultiple_conditional">
+                <param name="outputSingleMultiple_selector" value="singleMatrix" />
+                <conditional name="inputFormat_conditional">
+                    <param name="inputFormat_selector" value="optionCool" />
+                    <param name="matrix_h5_cooler" value="hicConvertFormat/small_test_matrix_chr4.cool" />
                 </conditional>
 
-                <conditional name='outputFormat_conditional'>
-                    <param name='outputFormat_selector' value='homer' />
+                <conditional name="outputFormat_conditional">
+                    <param name="outputFormat_selector" value="homer" />
                 </conditional>
             </conditional>
             <output name="output_converted_matrix" file="hicConvertFormat/small_test_matrix_chr4.homer" ftype="zip" compare="sim_size" delta="40000" />
         </test>
-        <test>
-            <conditional name='outputSingleMultiple_conditional'>
-                <param name='outputSingleMultiple_selector' value='singleMatrix' />
-                <conditional name='inputFormat_conditional'>
-                    <param name='inputFormat_selector' value='optionCool' />
-                    <param name='matrix_h5_cooler' value='hicConvertFormat/small_test_matrix_chr4.cool' />
+        <test expect_num_outputs="1">
+            <conditional name="outputSingleMultiple_conditional">
+                <param name="outputSingleMultiple_selector" value="singleMatrix" />
+                <conditional name="inputFormat_conditional">
+                    <param name="inputFormat_selector" value="optionCool" />
+                    <param name="matrix_h5_cooler" value="hicConvertFormat/small_test_matrix_chr4.cool" />
                 </conditional>
 
-                <conditional name='outputFormat_conditional'>
-                    <param name='outputFormat_selector' value='ginteractions' />
+                <conditional name="outputFormat_conditional">
+                    <param name="outputFormat_selector" value="ginteractions" />
                 </conditional>
             </conditional>
             <output name="output_converted_matrix" file="hicConvertFormat/small_test_matrix_chr4.ginteractions.tsv" ftype="tabular" />
         </test>
-        <test>
-            <conditional name='outputSingleMultiple_conditional'>
-                <param name='outputSingleMultiple_selector' value='multipleMatrix' />
-                <conditional name='resolutionOrManyToOne_conditional'>
-                    <param name='resolutionOrManyToOne_selector' value='resolution_option' />
-                    <param name='resolutions' value='5000 10000 20000' />
-                    <conditional name='inputFormat_conditional'>
-                        <param name='inputFormat_selector' value='optionH5' />
-                        <param name='matrix_h5_cooler' value='small_test_matrix.h5' />
+        <test expect_num_outputs="2">
+            <conditional name="outputSingleMultiple_conditional">
+                <param name="outputSingleMultiple_selector" value="singleMatrix" />
+                <conditional name="inputFormat_conditional">
+                    <param name="inputFormat_selector" value="optionCool" />
+                    <param name="matrix_h5_cooler" value="hicConvertFormat/small_test_matrix_chr4.cool" />
+                </conditional>
+
+                <conditional name="outputFormat_conditional">
+                    <param name="outputFormat_selector" value="hicpro" />
+                </conditional>
+            </conditional>
+            <output name="output_converted_matrix" file="hicConvertFormat/small_test_matrix_chr4.hicpro" ftype="tabular" />
+            <output name="output_converted_matrix_bed" file="hicConvertFormat/small_test_matrix_chr4.bed" ftype="tabular" />
+        </test>
+        <test expect_num_outputs="2">
+            <conditional name="outputSingleMultiple_conditional">
+                <param name="outputSingleMultiple_selector" value="multipleMatrix" />
+                <conditional name="resolutionOrManyToOne_conditional">
+                    <param name="resolutionOrManyToOne_selector" value="resolution_option" />
+                    <param name="resolutions" value="5000 10000 20000" />
+                    <conditional name="inputFormat_conditional">
+                        <param name="inputFormat_selector" value="optionH5" />
+                        <param name="matrix_h5_cooler" value="small_test_matrix.h5" />
                     </conditional>
                 </conditional>
             </conditional>
-            <output name="output_converted_matrix" ftype="cool">
+            <output name="output_converted_matrix_multi" ftype="mcool">
                 <assert_contents>
-                    <has_h5_keys keys='resolutions' />
+                    <has_h5_keys keys="resolutions" />
                 </assert_contents>
             </output>
         </test>