diff hicCorrectMatrix.xml @ 13:9949f055db84 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hicexplorer commit 3b41d687ff30583540d055f6995de00530cca81d-dirty"
author bgruening
date Mon, 16 Dec 2019 14:31:21 -0500
parents 92fc291ceb1a
children 1e622e371512
line wrap: on
line diff
--- a/hicCorrectMatrix.xml	Mon Dec 16 08:34:41 2019 -0500
+++ b/hicCorrectMatrix.xml	Mon Dec 16 14:31:21 2019 -0500
@@ -6,58 +6,56 @@
     </macros>
     <expand macro="requirements" />
     <command detect_errors="exit_code"><![CDATA[
-
-        hicCorrectMatrix
+        ln -s '$matrix_h5_cooler' 'matrix.$matrix_h5_cooler.ext' &&
+        
+        @BINARY@
             $mode.mode_selector
-            --matrix '$matrix_h5_cooler'
+            --matrix 'matrix.$matrix_h5_cooler.ext'
 
             ## special: --chromosomes is optional, but if given needs at least one argument
-            #set chroms = '" "'.join([ str($var.chromosome) for $var in $chromosomes ])
+            #set chroms = ' '.join([ '\'' + str($var.chromosome) + '\'' for $var in $chromosomes ])
             #if chroms
-                --chromosomes "$chroms"
+                --chromosomes $chroms
             #end if
 
             #if $mode.mode_selector == 'correct':
-
-                --iterNum $mode.iterNum
-                --outFileName matrix.$mode.outputFormat
+                #if $mode.correctionMethod.correctionMethod_selector == 'ice':
+                    --correctionMethod ICE
+                    --iterNum $mode.correctionMethod.iterNum
+                    
 
-                #if $mode.filterThreshold_low and $mode.filterThreshold_large:
-                    --filterThreshold $mode.filterThreshold_low $mode.filterThreshold_large
-                #end if
+                    #if $mode.correctionMethod.filterThreshold_low and $mode.correctionMethod.filterThreshold_large:
+                        --filterThreshold $mode.correctionMethod.filterThreshold_low $mode.correctionMethod.filterThreshold_large
+                    #end if
 
-                #if $mode.inflationCutoff:
-                    --inflationCutoff $mode.inflationCutoff
-                #end if
+                    #if $mode.correctionMethod.inflationCutoff:
+                        --inflationCutoff $mode.correctionMethod.inflationCutoff
+                    #end if
 
-                #if $mode.transCutoff:
-                    --transCutoff $mode.transCutoff
-                #end if
+                    #if $mode.correctionMethod.transCutoff:
+                        --transCutoff $mode.correctionMethod.transCutoff
+                    #end if
 
-                #if $mode.sequencedCountCutoff:
-                    --sequencedCountCutoff $mode.sequencedCountCutoff
+                    #if $mode.correctionMethod.sequencedCountCutoff:
+                        --sequencedCountCutoff $mode.correctionMethod.sequencedCountCutoff
+                    #end if
+
+                    $mode.correctionMethod.skipDiagonal
+                    $mode.correctionMethod.perchr
+                #else:
+                    --correctionMethod KR
                 #end if
-
-                $mode.skipDiagonal
-                $mode.perchr
-
-            #elif $mode.mode_selector == 'merge_failed':
+                --outFileName matrix.$matrix_h5_cooler.ext
+            #elif $mode.mode_selector == 'diagnostic_plot':
                 --plotName diagnostic_plot.png
-                --outMatrixFile corrected_matrix.npz.h5
+                ##--outMatrixFile corrected_matrix.npz.h5
                 #if $mode.xMax:
                     --xMax $mode.xMax
                 #end if
-                #if $mode.filterThreshold_low and $mode.filterThreshold_large:
-                    --filterThreshold '$mode.filterThreshold_low' '$mode.filterThreshold_large'
-                #end if
-            #else:
-                --plotName diagnostic_plot.png
-                #if $mode.xMax:
-                    --xMax $mode.xMax
-                #end if
+                $mode.perchr
             #end if
         #if $mode.mode_selector == 'correct':
-            && mv matrix.$mode.outputFormat matrix
+            && mv matrix.$matrix_h5_cooler.ext matrix
         #end if
 ]]>
     </command>
@@ -70,35 +68,44 @@
             </param>
             <when value="diagnostic_plot">
                 <expand macro="xMax" />
+                <param argument="--perchr" name="perchr" type="boolean" truevalue="--perchr" falsevalue="" checked="false"
+                            label="Compute statistics for each chromosome separately" />
             </when>
             <when value="correct">
-                <param argument="--iterNum" name="iterNum" type="integer" optional="true" value="500"
-                    label="Number of iterations" />
+                <conditional name='correctionMethod'>
+                    <param name='correctionMethod_selector' type='select' label='Correction method'>
+                        <option value='ice'>Iterative_correction (Imakaev)</option>
+                        <option value='kr'>Knights-Ruiz</option>
+                    </param>
 
-                <param argument="--inflationCutoff" name="inflationCutoff" type="float" optional="true"
-                    label="Inflation cutoff" value=""
-                    help="Value corresponding to the maximum number of times a bin can be scaled up during the iterative correction.
-                    For example, a inflationCutoff of 3 will filter out all bins that were expanded 3 times or more during the iterative correction."/>
+                    <when value='ice'>
+                        <param argument="--iterNum" name="iterNum" type="integer" optional="true" value="500"
+                            label="Number of iterations" />
 
-                <param argument="--transCutoff" name="transCutoff" type="float" optional="true"
-                    label="Trans region cutoff" value=""
-                    help="Clip high counts in the top -transcut trans regions (i.e. between chromosomes). A usual value is 0.05."/>
+                        <param argument="--inflationCutoff" name="inflationCutoff" type="float" optional="true"
+                            label="Inflation cutoff" value=""
+                            help="Value corresponding to the maximum number of times a bin can be scaled up during the iterative correction.
+                            For example, a inflationCutoff of 3 will filter out all bins that were expanded 3 times or more during the iterative correction."/>
 
-                <param argument="--sequencedCountCutoff" name="sequencedCountCutoff" optional="true" type="float"
-                    label="Sequenced count cutoff"
-                    help="Each bin receives a value indicating the fraction that is covered by reads.
-                        A cutoff of 0.5 will discard all those bins that have less than half of the bin covered."/>
+                        <param argument="--transCutoff" name="transCutoff" type="float" optional="true"
+                            label="Trans region cutoff" value=""
+                            help="Clip high counts in the top -transcut trans regions (i.e. between chromosomes). A usual value is 0.05."/>
 
-                <param argument="--skipDiagonal" name="skipDiagonal" type="boolean" truevalue="--skipDiagonal" falsevalue="" checked="false"
-                    label="Skip diagonal counts"/>
+                        <param argument="--sequencedCountCutoff" name="sequencedCountCutoff" optional="true" type="float"
+                            label="Sequenced count cutoff"
+                            help="Each bin receives a value indicating the fraction that is covered by reads.
+                                A cutoff of 0.5 will discard all those bins that have less than half of the bin covered."/>
 
-                <param argument="--perchr" name="perchr" type="boolean" truevalue="--perchr" falsevalue="" checked="false"
-                    label="Normalize each chromosome separately" />
-                <expand macro="filterThreshold" />
-                <param name='outputFormat' type='select' label="Output file format">
-                    <option value='h5'>HiCExplorer format</option>
-                    <option value="cool">cool</option>
-                </param>
+                        <param argument="--skipDiagonal" name="skipDiagonal" type="boolean" truevalue="--skipDiagonal" falsevalue="" checked="false"
+                            label="Skip diagonal counts"/>
+
+                        <param argument="--perchr" name="perchr" type="boolean" truevalue="--perchr" falsevalue="" checked="false"
+                            label="Normalize each chromosome separately" />
+                        <expand macro="filterThreshold" />
+                    </when>
+                    <when value='kr'>
+                    </when>
+                </conditional>
             </when>
         </conditional>
 
@@ -112,9 +119,9 @@
 
     </inputs>
     <outputs>
-        <data name="outFileName" from_work_dir="matrix" format="h5">
+        <data name="outFileName" from_work_dir="matrix" format="cool">
             <change_format>
-                <when input="mode.outputFormat" value="cool" format="cool" />
+                <when input_dataset="matrix_h5_cooler" attribute="ext" value="h5" format="h5"/>
             </change_format>
             <filter>mode['mode_selector'] == "correct"</filter>
 
@@ -130,16 +137,63 @@
             <param name="matrix_h5_cooler" value="small_test_matrix.h5"/>
 
             <param name="mode_selector" value="correct"/>
+            <param name='correctionMethod_selector' value='ice'/>
             <repeat name="chromosomes">
                 <param name="chromosome" value="chrUextra"/>
             </repeat>
             <repeat name="chromosomes">
                 <param name="chromosome" value="chr3LHet"/>
             </repeat>
-            <param name='outputFormat' value='h5'/>
             <param name='filterThreshold_low' value='-2.0' />
             <param name='filterThreshold_large' value='4' />
-            <output name="outFileName" file="hicCorrectMatrix_result1.npz.h5" ftype="h5" compare="sim_size"/>
+            <output name="outFileName" ftype="h5">
+                <assert_contents>
+                    <has_h5_keys keys='correction_factors,intervals,matrix,nan_bins'/>
+                </assert_contents>
+            </output>
+        </test>
+        <test>
+            <param name="matrix_h5_cooler" value="small_test_matrix.h5"/>
+
+            <param name="mode_selector" value="correct"/>
+            <param name='correctionMethod_selector' value='kr'/>
+            
+            <output name="outFileName" ftype="h5">
+                <assert_contents>
+                    <has_h5_keys keys='correction_factors,intervals,matrix'/>
+                </assert_contents>
+            </output>
+        </test>
+        <test>
+            <param name="matrix_h5_cooler" value="small_test_matrix.cool"/>
+
+            <param name="mode_selector" value="correct"/>
+            <param name='correctionMethod_selector' value='kr'/>
+            
+            <output name="outFileName" ftype="cool">
+                <assert_contents>
+                    <has_h5_keys keys='bins,chroms,indexes,pixels'/>
+                </assert_contents>
+            </output>
+        </test>
+        <test>
+            <param name="matrix_h5_cooler" value="small_test_matrix.h5"/>
+
+            <param name="mode_selector" value="correct"/>
+            <param name='correctionMethod_selector' value='ice'/>
+            <repeat name="chromosomes">
+                <param name="chromosome" value="chrUextra"/>
+            </repeat>
+            <repeat name="chromosomes">
+                <param name="chromosome" value="chr3LHet"/>
+            </repeat>
+            <param name='filterThreshold_low' value='-2.0' />
+            <param name='filterThreshold_large' value='4' />
+            <output name="outFileName" ftype="h5">
+                <assert_contents>
+                    <has_h5_keys keys='correction_factors,intervals,matrix,nan_bins'/>
+                </assert_contents>
+            </output>
         </test>
         <test>
             <param name="matrix_h5_cooler" value="small_test_matrix.h5"/>
@@ -150,7 +204,7 @@
             <repeat name="chromosomes">
                 <param name="chromosome" value="chr3LHet"/>
             </repeat>
-            <output name="diagnostic_plot" file="diagnostic_plot.png" ftype="png" compare="sim_size"/>
+            <output name="diagnostic_plot" file="hicCorrectMatrix/diagnostic_plot.png" ftype="png" compare="sim_size"/>
         </test>
     </tests>
     <help><![CDATA[
@@ -211,7 +265,7 @@
 Correct
 _______
 
-Run the iterative correction and outputs the corrected matrix. This matrix can then be used with all downstream analysis tools such as ``hicPlotMatrix``, ``hicPlotTADs``, ``hicPlotViewpoint``, ``hicAggregateContacts`` for **visualization of Hi-C data**, ``hicCorrelate``, ``hicPlotDistVsCounts``, ``hicTransform``, ``hicFindTADs``, ``hicPCA`` **for data and scores computation on Hi-C data**.
+Run the iterative correction and outputs the corrected matrix. This matrix can then be used with all downstream analysis tools such as ``hicPlotMatrix``, ``pyGenomeTracks``, ``hicPlotViewpoint``, ``hicAggregateContacts`` for **visualization of Hi-C data**, ``hicCorrelate``, ``hicPlotDistVsCounts``, ``hicTransform``, ``hicFindTADs``, ``hicPCA`` **for data and scores computation on Hi-C data**.
 
 It is noteworthy that ``hicSumMatrices`` and ``hicMergeMatrixBins`` **must be performed on uncorrected matrices**.