0
|
1 <tool name="Heatmap" id="ceas_heatmapr" version="0.1.0">
|
|
2 <description>Draw the scores heatmap near a given interval set and use k-means to cluster the intervals</description>
|
|
3 <macros>
|
|
4 <import>ceas_macros.xml</import>
|
|
5 </macros>
|
|
6 <expand macro="requirements_bx" />
|
|
7 <command>
|
1
|
8 #set $wfiles = str($wfile)
|
0
|
9 #set $ttitle = "\""+str($title)+"\""
|
|
10 #set $txlabel = "\""+str($xlabel)+"\""
|
|
11 #set $tylabel = "\""+str($ylabel)+"\""
|
|
12 #for $m in $more
|
1
|
13 #set $wfiles = $wfiles + "," + str($m.wfile)
|
0
|
14 ###set $ttitle = $ttitle + ",\"" + str($m.title)+"\""
|
|
15 #set $txlabel = $txlabel + ",\"" + str($m.xlabel)+"\""
|
|
16 #set $tylabel = $tylabel + ",\"" + str($m.ylabel)+"\""
|
|
17 #end for
|
|
18 #set $advparam = " --title="+str($ttitle)+" --subtitle="+str($txlabel)+" --y_label="+str($tylabel)
|
|
19
|
|
20 #if $methodadvopt.methodadvopt_select == "kmeans"
|
|
21 #set $methodopt = " --method="+str($methodadvopt.methodadvopt_select)+" -k "+str($methodadvopt.kmeans)+" --k_wigindex="+str($methodadvopt.k_wigindex)
|
|
22 #else if $methodadvopt.methodadvopt_select == "none"
|
|
23 #set $methodopt = " --method="+str($methodadvopt.methodadvopt_select)
|
|
24 #else
|
|
25 #set $methodopt = " --method="+str($methodadvopt.methodadvopt_select)+" --s_wigindex="+str($methodadvopt.s_wigindex)
|
|
26 #end if
|
|
27
|
|
28 #if $advopt.advopt_select == "yes"
|
|
29 #set $advparam = $advparam+" -s "+str($advopt.saturation)+" --upstream="+str($advopt.upstrm)+" --downstream="+str($advopt.dnstrm)+" --pf-res="+str($advopt.step)+" --fontsize="+str($advopt.fontsize)+" --col="+str($advopt.colors)+" --pic_width="+str($advopt.pic_width)+" --pic_height="+str($advopt.pic_height)+" "+str($advopt.horizontal_line)+" "+str($advopt.vertical_line)+" "+str($advopt.dir)+" "+str($advopt.set_seed)
|
|
30
|
|
31 #if $advopt.zmax.value
|
|
32 #set $advparam = $advparam+" --zmax="+str($advopt.zmax)
|
|
33 #end if
|
|
34 #if $advopt.zmin.value
|
|
35 #set $advparam = $advparam+" --zmin="+str($advopt.zmin)
|
|
36 #end if
|
|
37 #else
|
|
38 #set $advparam = " "
|
|
39 #end if
|
|
40 ##
|
1
|
41 heatmapr -b "$bfile" -w "$wfiles"
|
0
|
42 #if $wfile.extension == "wig"
|
|
43 --wig_format="wig"
|
|
44 #elif $wfile.extension == "bigwig"
|
|
45 --wig_format="bigwig"
|
|
46 #end if
|
|
47 --name=$name $methodopt $advparam &> $log &&
|
|
48 Rscript output_kmeans.r
|
|
49 </command>
|
|
50 <inputs>
|
|
51 <param name="name" type="hidden" value="output"/>
|
|
52 <param format="bed" name="bfile" type="data" label="BED file(center will be aligned, 100,000 lines max)" />
|
|
53 <param format="wig,bigwig" name="wfile" type="data" label="wig / bigwig file" />
|
|
54 <param name="title" type="text" label="Title for the whole heatmap plot" value="Heatmap" />
|
|
55 <param name="xlabel" type="text" label="Subtitle for heatmap plot" value="subtitle" />
|
|
56 <param name="ylabel" type="text" label="Y-label for heatmap plot" value="Y-label" />
|
|
57 <repeat name="more" title="More wig / bigwig files">
|
|
58 <param format="wig,bigwig" name="wfile" type="data" label="WIGGLE file" />
|
|
59 <param name="xlabel" type="text" label="Subtitle for heatmap plot" value="subtitle" />
|
|
60 <param name="ylabel" type="text" label="Y-label for heatmap plot" value="Y-label" />
|
|
61 </repeat>
|
|
62 <conditional name="methodadvopt">
|
|
63 <param name="methodadvopt_select" type="select" label="choose sort/clustering method">
|
|
64 <option value="kmeans">cluster - kmeans</option>
|
|
65 <option value="median">only sort - median</option>
|
|
66 <option value="maximum">only sort - maximun</option>
|
|
67 <option value="mean">only sort - mean</option>
|
|
68 <option value="none">none - keep original order of bed.</option>
|
|
69 </param>
|
|
70 <when value="kmeans">
|
|
71 <param name="kmeans" type="integer" label="K-means number" value="5">
|
|
72 <validator type="in_range" max="10" min="3" message="K-means is out of range, K-means has to be between 3 to 10" /></param>
|
|
73 <param name="k_wigindex" type="text" label="use which wigs to calc kmeans. input 'all' or sth like '1,2,4' (use the 1st, 2nd and 4th wig.)" value="all" />
|
|
74 </when>
|
|
75 <when value="median">
|
|
76 <param name="s_wigindex" type="integer" label="key wig file for sorting" value="1" />
|
|
77 </when>
|
|
78 <when value="maximum">
|
|
79 <param name="s_wigindex" type="integer" label="key wig file for sorting" value="1" />
|
|
80 </when>
|
|
81 <when value="mean">
|
|
82 <param name="s_wigindex" type="integer" label="key wig file for sorting" value="1" />
|
|
83 </when>
|
|
84 </conditional>
|
|
85 <conditional name="advopt">
|
|
86 <param name="advopt_select" type="select" label="Advanced Options">
|
|
87 <option value="no">No</option>
|
|
88 <option value="yes">Yes</option>
|
|
89 </param>
|
|
90 <when value="yes">
|
|
91 <param name="step" type="integer" label="Step" value="10">
|
|
92 <validator type="in_range" max="1000" min="5" message="step is out of range, step has to be between 5 to 1000" />
|
|
93 </param>
|
|
94 <param name="saturation" type="float" label="Saturation" value="0.01" />
|
|
95 <param name="upstrm" type="integer" label="Upstream" value="500">
|
|
96 <validator type="in_range" max="10000" min="100" message="Upstream is out of range, Upstream has to be between 100 to 10000" />
|
|
97 </param>
|
|
98 <param name="dnstrm" type="integer" label="Downstream" value="500">
|
|
99 <validator type="in_range" max="10000" min="100" message="Downstream is out of range, Downstream has to be between 100 to 10000" />
|
|
100 </param>
|
|
101 <param name="fontsize" type="integer" label="Image fontsize. (better not change)" value="1" />
|
|
102 <param name="colors" type="text" size="100" label="colorRamp for the legend of heatmap, from low value to high, use ','to split" value="053061,2166AC,4393C3,92C5DE,D1E5F0,F7F7F7,FDDBC7,F4A582,D6604D,B2182B,67001F" />
|
|
103 <param name="pic_width" type="integer" label="Heatmap width" value="1920">
|
|
104 <validator type="in_range" max="16000" min="1600" message="Heatmap wodth is out of range, width has to be between 1600 to 16000" />
|
|
105 </param>
|
|
106 <param name="pic_height" type="integer" label="Heatmap height" value="1440">
|
|
107 <validator type="in_range" max="12000" min="1200" message="Heatmap height is out of range, height has to be between 1200 to 12000" />
|
|
108 </param>
|
|
109 <param name="zmin" type="text" label="minimum value in image" />
|
|
110 <param name="zmax" type="text" label="maximum value in image" />
|
|
111 <param name="horizontal_line" type="boolean" label="Plot classified lines?" checked="no" truevalue="-z" falsevalue=" " />
|
|
112 <param name="vertical_line" type="boolean" label="Plot vertical line?" checked="no" truevalue="-v" falsevalue=" " />
|
|
113 <param name="dir" type="boolean" label="consider the direction (+/-) while profiling" checked="no" truevalue="--dir" falsevalue=" " />
|
|
114 <param name="set_seed" type="boolean" label="Set seed to make result reproducible (for developers)" checked="no" truevalue="--set-seed" falsevalue=" " />
|
|
115 </when>
|
|
116 <when value="no" />
|
|
117 </conditional>
|
|
118 </inputs>
|
|
119 <outputs>
|
|
120 <data format="png" name="outputpng" label="Heatmap image" from_work_dir="output_r.heatmap.png"/>
|
|
121 <data format="txt" name="outputr" label="Heatmapr R script" from_work_dir="output_kmeans.r"/>
|
|
122 <data format="tabular" name="outputbed" label="Heatmap k-means classified regions" from_work_dir="output_peak_classid"/>
|
|
123 <data format="txt" name="log" label="Heatmap log" />
|
|
124 </outputs>
|
|
125 <expand macro="stdio" />
|
|
126 <tests>
|
|
127 <test>
|
|
128 <param name="wfile" value="treatment.wig" />
|
|
129 <param name="bfile" value="peak.bed" />
|
|
130 <param name="title" value="title" />
|
|
131 <param name="xlabel" value="xlabel" />
|
|
132 <param name="ylabel" value="ylabel" />
|
|
133 <param name="methodadvopt_select" value="kmeans" />
|
|
134 <param name="kmeans" value="5" />
|
|
135 <param name="advopt_select" value="yes" />
|
|
136 <param name="k_wigindex" value="1" />
|
|
137 <param name="step" value="10" />
|
|
138 <param name="upstrm" value="500" />
|
|
139 <param name="dnstrm" value="400" />
|
|
140 <param name="fontsize" value="2" />
|
|
141 <param name="colors" value="053061,2166AC,4393C3,92C5DE,D1E5F0,F7F7F7,FDDBC7,F4A582,D6604D,B2182B,67001F" />
|
|
142 <param name="zmin" value="" />
|
|
143 <param name="zmax" value="" />
|
|
144 <param name="pic_width" value="1600" />
|
|
145 <param name="pic_height" value="1200" />
|
|
146 <param name="horizontal_line" value="-z" />
|
|
147 <param name="vertical_line" value="-v" />
|
|
148 <param name="dir" value=" " />
|
|
149 <param name="set_seed" value="--set-seed" />
|
|
150 <output name="outputbed">
|
|
151 <assert_contents>
|
|
152 <has_text_matching expression="1\tchr19\t58470227\t58470701\tMACS_peak_9625\t113.34" />
|
|
153 </assert_contents>
|
|
154 </output>
|
|
155 </test>
|
|
156 </tests>
|
|
157 <help>
|
|
158 This tool draws the scores heatmap near a given interval set..It's
|
|
159 based on sitrpro script in Hyunjin Shin's library. Original code is
|
|
160 written by Jian Ma. It uses
|
|
161 R module for kmeans clustering and draw the heatmap.
|
|
162
|
|
163 .. class:: warningmark
|
|
164
|
|
165 **NEED IMPROVEMENT**
|
|
166
|
|
167 -----
|
|
168
|
|
169 **Parameters**
|
|
170
|
|
171 - **BED file** contains the regions to extract the scores from WIGGLE
|
|
172 - **K-means (Advanced)** defines the number of classes in k-means
|
|
173 clustering.
|
|
174 files.
|
|
175 - **WIGGLE file** contains the scores for heatmap.
|
|
176 - **More WIGGLE file** click the *Add new More WIGGLE files* to add
|
|
177 more. All the heatmap for the WIGGLE files will be aligned and
|
|
178 clutered together.
|
|
179 - **Advanced Options** to turn on advanced settings. You will lose
|
|
180 advanced settings and go back to default parameters when you choose
|
|
181 'No'.
|
|
182 - **Upstream/Downstream (Advanced)** size around regions in BED file.
|
|
183 - **Step (Advanced)** is the profiling resolution in bps.
|
|
184 - **Saturation** before the script use the score data to draw heatmap,
|
|
185 it will saturate the data to a narrow scale. For example, if you set
|
|
186 the option to 0.1, The data smaller than 10% of the data or bigger
|
|
187 than 90% of the data will be saturated to 10% or 90% of the data.
|
|
188 - **col_low/col_high** is the color of legend for images.
|
|
189 - **pic_width/pic_height** is the size of heatmap image.
|
|
190 - **zmin/zmax** is the max value and min value for the legend bar.
|
|
191 - **horizontal_line** lines in black to separate the clusters.
|
|
192
|
|
193 -----
|
|
194
|
|
195 **Outputs**
|
|
196
|
|
197 - *PNG file* is the heatmap image
|
|
198 - *clustering result file* Contain the clustering results from the
|
|
199 tool. The 'Score' column (5th column) contains the cluster indices.
|
|
200 - *Log* for job log. If you see errors, please attached this in
|
|
201 the bug report
|
|
202
|
|
203 </help>
|
|
204
|
|
205 </tool>
|