diff hicPCA.xml @ 8:b4b8343dd681 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:33:42 -0500
parents ebb9b94138c1
children 3ed8e85f4f4c
line wrap: on
line diff
--- a/hicPCA.xml	Mon Dec 16 08:36:03 2019 -0500
+++ b/hicPCA.xml	Mon Dec 16 14:33:42 2019 -0500
@@ -6,14 +6,42 @@
     </macros>
     <expand macro="requirements" />
     <command detect_errors="exit_code"><![CDATA[
+        ln -s '$matrix_h5_cooler' 'matrix.$matrix_h5_cooler.ext' &&
+        @BINARY@ --matrix 'matrix.$matrix_h5_cooler.ext'
 
-        hicPCA --matrix '$matrix_h5_cooler'
+        @CHROMOSOME_LIST@
 
         --outputFileName pca1.$outputFormat pca2.$outputFormat
         --format $outputFormat
 
+        #if $norm:
+            $norm
+        #end if
+
+        #if $extra_track_conditional.extra_track_selection == 'gene_density':
+            --extraTrack '$extra_track_conditional.extraTrack'
+        #elif $extra_track_conditional.extra_track_selection == 'histon_mark':
+            --extraTrack '$extra_track_conditional.extraTrack'
+            --histonMarkType '$extra_track_conditional.histonMarkType'
+        #end if
+
+        #if $pearsonMatrix:
+            --pearsonMatrix pearson.$matrix_h5_cooler.ext
+        #end if
+
+        #if $obsexpMatrix:
+            --obsexpMatrix obsexp.$matrix_h5_cooler.ext
+        #end if
+
         && mv pca1.$outputFormat pca1
         && mv pca2.$outputFormat pca2
+        #if $pearsonMatrix:
+            && mv pearson.$matrix_h5_cooler.ext pearson
+        #end if
+
+        #if $obsexpMatrix:
+            && mv obsexp.$matrix_h5_cooler.ext obsexp
+        #end if
 
 ]]>
     </command>
@@ -24,11 +52,35 @@
             <option value="bedgraph">bedgraph</option>
         </param>
 
+        <expand macro="chromosome_list" />
+
+        <param name='norm' type='boolean' truevalue='--norm' label='Use different expected value computation'/>
+
+        <conditional name="extra_track_conditional">
+            <param name='extra_track_selection' label='Extra track type' type='select'>
+                <option value='' selected='true'>No track</option>
+                <option value='gene_density'>Gene density</option>
+                <option value='histon_mark'>Histon mark coverage</option>
+            </param>
+            <when value='gene_density' >
+                <param name='extraTrack' type='data' format='bed' label='Correlate PCA with e.g. gene density or histon marks to flip sign'/>
+            </when>
+            <when value='histon_mark'>
+                <param name='extraTrack' type='data' format='bed' label='Correlate PCA with e.g. gene density or histon marks to flip sign'/>
+                <param name='histonMarkType' type='select' label="Histon mark type">
+                    <option value='active' selected="true">active</option>
+                    <option value="inactive">inactive</option>
+                </param>
+            </when>
+            <when value='' />
+        </conditional>
+
+        <param name='pearsonMatrix' type='boolean' truevalue='--pearsonMatrix' falsevalue='' label='Return internally used Pearson matrix'/>
+        <param name='obsexpMatrix' type='boolean' truevalue='--obsexpMatrix' falsevalue='' label='Return internally used observed / expected matrix'/>
+
     </inputs>
     <outputs>
-
         <data name="pca1" from_work_dir="pca1" format="bigwig" label="${tool.name} on ${matrix_h5_cooler.name} [${on_string}]: PC1">
-            <filter>outputFormat == 'bigwig'</filter>
             <change_format>
                 <when input="outputFormat" value="bedgraph" format="bedgraph" />
             </change_format>
@@ -39,21 +91,79 @@
             </change_format>
         </data>
 
-
+        <data name="pearson_outfile" from_work_dir="pearson" format="cool">
+            <filter>pearsonMatrix</filter>
+            <change_format>
+                <when input_dataset="matrix_h5_cooler" attribute="ext" value="h5" format="h5"/>
+            </change_format>
+        </data>
+        <data name="obsexp_outfile" from_work_dir="obsexp" format="cool">
+            <filter>obsexpMatrix</filter>
+            <change_format>
+                <when input_dataset="matrix_h5_cooler" attribute="ext" value="h5" format="h5"/>
+            </change_format>
+        </data>
     </outputs>
     <tests>
         <test>
-            <param name="matrix_h5_cooler" value="small_test_matrix_50kb_res.h5"/>
-            <param name="outputFormat" value="bedgraph" />
-            <output name="pca1" file="pca1.bedgraph" ftype="bedgraph" compare="sim_size"/>
-            <output name="pca2" file="pca2.bedgraph" ftype="bedgraph" compare="sim_size"/>
+            <param name="matrix_h5_cooler" value="small_test_matrix.cool"/>
+            <param name="outputFormat" value="bigwig" />
+            <conditional name="extra_track_conditional">
+                <param name="extra_track_selection" value=""/>
+            </conditional>
+
+            <output name="pca1" file="hicPCA/pca1_test1.bw" ftype="bigwig" compare="sim_size" delta='40000'/>
+            <output name="pca2" file="hicPCA/pca2_test1.bw" ftype="bigwig" compare="sim_size" delta='40000'/>
+        </test>
+        <test>
+            <param name="matrix_h5_cooler" value="small_test_matrix.h5"/>
+            <param name="outputFormat" value="bigwig" />
+            <conditional name="extra_track_conditional">
+                <param name="extra_track_selection" value="gene_density"/>
+                <param name="extraTrack" value="dm3_genes.bed.gz" />
+            </conditional>
+
+            <repeat name="chromosome_list">
+                <param name="chromosomes" value="chrX"/>
+            </repeat>
+            <repeat name="chromosome_list">
+                <param name="chromosomes" value="chrXHet"/>
+            </repeat>
+
+            <output name="pca1" file="hicPCA/pca1_test2.bw" ftype="bigwig" compare="sim_size" delta='40000'/>
+            <output name="pca2" file="hicPCA/pca2_test2.bw" ftype="bigwig" compare="sim_size" delta='40000'/>
         </test>
         <test>
-            <param name="matrix_h5_cooler" value="small_test_matrix_50kb_res.h5"/>
+            <param name="matrix_h5_cooler" value="small_test_matrix.h5"/>
 
             <param name="outputFormat" value="bigwig" />
-            <output name="pca1" file="pca1.bw" ftype="bigwig" compare="sim_size"/>
-            <output name="pca2" file="pca2.bw" ftype="bigwig" compare="sim_size"/>
+            <conditional name="extra_track_conditional">
+                <param name="extra_track_selection" value=""/>
+            </conditional>
+            <param name='norm' value='True'/>
+            <param name='pearsonMatrix' value='True'/>
+            <param name='obsexpMatrix' value='True'/>
+
+            <repeat name="chromosome_list">
+                <param name="chromosomes" value="chrX"/>
+            </repeat>
+            <repeat name="chromosome_list">
+                <param name="chromosomes" value="chrXHet"/>
+            </repeat>
+
+            <output name="pca1" file="hicPCA/pca1_test3.bw" ftype="bigwig" compare="sim_size" delta='40000'/>
+            <output name="pca2" file="hicPCA/pca2_test3.bw" ftype="bigwig" compare="sim_size" delta='40000'/>
+
+            <output name="pearson_outfile" ftype="h5">
+                <assert_contents>
+                    <has_h5_keys keys='intervals,matrix'/>
+                </assert_contents>
+            </output>   
+            <output name="obsexp_outfile" ftype="h5">
+                <assert_contents>
+                    <has_h5_keys keys='intervals,matrix'/>
+                </assert_contents>
+            </output>
         </test>
     </tests>
     <help><![CDATA[
@@ -78,7 +188,7 @@
 
 Output
 ------
-Two files are outputed by **hicPCA**, one with the first (pca1) and one with the second (pca2) eigenvector as bigwig or bedgraph. These files can be plotted alongside Hi-C heatmaps, gene density or external datasets such as open chromatin or histone marks enrichment using ``hicPlotTADs`` or ``hicPlotMatrix``.
+Two files are outputed by **hicPCA**, one with the first (pca1) and one with the second (pca2) eigenvector as bigwig or bedgraph. These files can be plotted alongside Hi-C heatmaps, gene density or external datasets such as open chromatin or histone marks enrichment using ``pyGenomeTracks`` or ``hicPlotMatrix``.
 
 For example, below you can find a ``hicPlotMatrix`` of the Pearson correlation matrix derived from a contact matrix for chromosome 6 in mouse computed with ``hicTransform`` (which is part of A/B compartments computation). The optional data track at the bottom shows the first eigenvector for A/B compartment obtained using **hicPCA**.