58
|
1 <tool id="iwtomics_loadandplot" name="IWTomics Load" version="@VERSION@.0">
|
18
|
2 <description>Smooth and Plot</description>
|
|
3 <macros>
|
|
4 <import>macros.xml</import>
|
|
5 </macros>
|
|
6 <expand macro="requirements" />
|
|
7
|
74
|
8 <command detect_errors="exit_code">
|
18
|
9 <![CDATA[
|
70
|
10 Rscript '$__tool_directory__/loadandplot.R' outrdata='${outrdata}' outregions='${outregions}' outfeatures='${outfeatures}' outpdf='${outpdf}'
|
18
|
11
|
72
|
12 #set region_paths = '|'.join( [ str( $r ) for $r in $regions ] )
|
70
|
13 regionspaths='${region_paths}'
|
72
|
14 #set region_galaxyids = ','.join( [ str( $r.hid ) for $r in $regions ] )
|
70
|
15 regionsgalaxyids='c(${region_galaxyids})'
|
72
|
16 #set region_names = '|'.join( [ str( $r.name ) for $r in $regions ] )
|
70
|
17 regionsfilenames='${region_names}'
|
72
|
18 #set region_header = $regionsheadersection.regionsheader
|
18
|
19 #if $region_header != "":
|
70
|
20 regionsheaderfile='${region_header}'
|
18
|
21 #end if
|
70
|
22
|
72
|
23 #set feature_paths = '|'.join( [ str( $f ) for $f in $features ] )
|
70
|
24 featurespaths='${feature_paths}'
|
72
|
25 #set feature_galaxyids = ','.join( [ str( $f.hid ) for $f in $features ] )
|
70
|
26 featuresgalaxyids='c(${feature_galaxyids})'
|
72
|
27 #set feature_names = '|'.join( [ str( $f.name ) for $f in $features ] )
|
70
|
28 featuresfilenames='${feature_names}'
|
72
|
29 #set feature_header = $featuresheadersection.featuresheader
|
18
|
30 #if $feature_header != "":
|
70
|
31 featuresheaderfile='${feature_header}'
|
18
|
32 #end if
|
|
33
|
72
|
34 smoothing="'${conditionaltype.smoothing}'"
|
70
|
35 start.are.0based='${zerobased}'
|
18
|
36 #if $conditionaltype.smoothing == 'no':
|
72
|
37 alignment="'${conditionaltype.alignment}'"
|
18
|
38 #elif $conditionaltype.smoothing == 'locpoly':
|
72
|
39 alignment="'${conditionaltype.locpolyconditionalscale.alignment}'"
|
18
|
40 #if $conditionaltype.locpolyconditionalscale.alignment == 'scale':
|
70
|
41 scale='${conditionaltype.locpolyconditionalscale.scalegrid}'
|
18
|
42 #end if
|
70
|
43 bandwidth='${conditionaltype.locpolybandwidth}'
|
|
44 degree='${conditionaltype.locpolydegree}'
|
|
45 fill_gaps='${conditionaltype.fillgaps}'
|
18
|
46 #elif $conditionaltype.smoothing == 'kernel':
|
72
|
47 alignment="'${conditionaltype.kernelconditionalscale.alignment}'"
|
18
|
48 #if $conditionaltype.kernelconditionalscale.alignment == 'scale':
|
70
|
49 scale='${conditionaltype.kernelconditionalscale.scalegrid}'
|
18
|
50 #end if
|
70
|
51 bandwidth='${conditionaltype.kernelbandwidth}'
|
|
52 fill_gaps='${conditionaltype.fillgaps}'
|
18
|
53 #elif $conditionaltype.smoothing == 'splines':
|
72
|
54 alignment="'${conditionaltype.splinesconditionalscale.alignment}'"
|
18
|
55 #if $conditionaltype.splinesconditionalscale.alignment == 'scale':
|
70
|
56 scale='${conditionaltype.splinesconditionalscale.scalegrid}'
|
18
|
57 #end if
|
70
|
58 degree='${conditionaltype.splinesdegree}'
|
|
59 dist_knots='${conditionaltype.splinesdistknots}'
|
|
60 fill_gaps='${conditionaltype.fillgaps}'
|
18
|
61 #end if
|
|
62
|
70
|
63 average='${plotres.average}'
|
|
64 size='${plotres.size}'
|
72
|
65 plottype="'${plotres.conditionalplottype.plottype}'"
|
18
|
66 #if $plotres.conditionalplottype.plottype == 'boxplot':
|
72
|
67 #set probs = ','.join( [ str( $p.prob ) for $p in $plotres.conditionalplottype.probabilitiessection.probabilities ] )
|
18
|
68 #if $probs != "":
|
70
|
69 probs='c(${plotres.conditionalplottype.probabilitiessection.prob0},${plotres.conditionalplottype.probabilitiessection.prob1},${plotres.conditionalplottype.probabilitiessection.prob2},${probs})'
|
18
|
70 #else:
|
70
|
71 probs='c(${plotres.conditionalplottype.probabilitiessection.prob0},${plotres.conditionalplottype.probabilitiessection.prob1},${plotres.conditionalplottype.probabilitiessection.prob2})'
|
18
|
72 #end if
|
74
|
73 #end if
|
18
|
74 ]]>
|
|
75 </command>
|
|
76
|
|
77 <inputs>
|
|
78 <!-- regions -->
|
|
79 <param format="tabular" name="regions" type="data" label="Select region files" multiple="true" help="" />
|
70
|
80 <section name="regionsheadersection" title="Insert header file for regions (optional)" expanded="false" help="Tabular file. Column 1: names of the region files; Column 2: unique identifiers of the region datasets (spaces and special characters are not allowed); Column 3: name of the region datasets to be used in the output.">
|
|
81 <param format="tabular" name="regionsheader" type="data" label="Select header file" optional="true" />
|
|
82 </section>
|
18
|
83
|
|
84 <!-- features -->
|
|
85 <param format="tabular" name="features" type="data" label="Select feature files" multiple="true" help="" />
|
70
|
86 <section name="featuresheadersection" title="Insert header file for features (optional)" expanded="false" help="Tabular file. Column 1: names of the feature files; Column 2: unique identifiers of the features (spaces and special characters are not allowed); Column 3: name of the features to be used in the output.">
|
|
87 <param format="tabular" name="featuresheader" type="data" label="Select header file" optional="true" />
|
|
88 </section>
|
18
|
89
|
|
90 <!-- zero-base one-base -->
|
|
91 <param name="zerobased" type="select" label="Start positions are:" multiple="false" help="">
|
|
92 <option value="TRUE">0-based</option>
|
|
93 <option value="FALSE">1-based</option>
|
|
94 </param>
|
|
95
|
|
96 <!-- conditional smoothing -->
|
|
97 <conditional name="conditionaltype">
|
|
98 <!-- smoothing -->
|
|
99 <param name="smoothing" type="select" label="Smoothing" help="Type of smoothing to be applied to the feature curves.">
|
|
100 <option value="no">No</option>
|
|
101 <option value="locpoly">Local Polynomials</option>
|
|
102 <option value="kernel">Gaussian Kernel</option>
|
|
103 <option value="splines">B-Splines</option>
|
|
104 </param>
|
|
105 <!-- conditional choice: smoothing=no -->
|
|
106 <when value="no">
|
|
107 <param name="alignment" type="select" label="Region alignment" help="">
|
|
108 <option value="center">Center - Alignment on the central position</option>
|
|
109 <option value="left">Left - Alignment on the starting position</option>
|
|
110 <option value="right">Right - Alignment on the ending position</option>
|
|
111 </param>
|
|
112 </when>
|
|
113 <!-- conditional choice: smoothing=locpoly -->
|
|
114 <when value="locpoly">
|
|
115 <!-- conditional region alignment -->
|
|
116 <conditional name="locpolyconditionalscale">
|
|
117 <param name="alignment" type="select" label="Region alignment" help="">
|
|
118 <option value="center">Center - Alignment on the central position</option>
|
|
119 <option value="left">Left - Alignment on the starting position</option>
|
|
120 <option value="right">Right - Alignment on the ending position</option>
|
|
121 <option value="scale">Scale - Scaling all regions to the same length</option>
|
|
122 </param>
|
|
123 <when value="scale">
|
|
124 <param name="scalegrid" type="integer" value="0" min="0" label="Number of grid points" help="Number of equally-spaced grid points over which the smoothed curves are evaluated." />
|
|
125 </when>
|
|
126 </conditional>
|
|
127
|
|
128 <param name="locpolybandwidth" type="integer" value="5" min="2" label="Bandwidth for smoothing" help="" />
|
|
129 <param name="locpolydegree" type="integer" value="3" min="0" label="Degree of local polynomial" help="" />
|
|
130
|
|
131 <!-- fill gaps -->
|
|
132 <param name="fillgaps" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Use smoothing to fill gaps (NA measurements)" help="" />
|
|
133 </when>
|
|
134 <!-- conditional choice: smoothing=kernel -->
|
|
135 <when value="kernel">
|
|
136 <!-- conditional region alignment -->
|
|
137 <conditional name="kernelconditionalscale">
|
|
138 <param name="alignment" type="select" label="Region alignment" help="">
|
|
139 <option value="center">Center - Alignment on the central position</option>
|
|
140 <option value="left">Left - Alignment on the starting position</option>
|
|
141 <option value="right">Right - Alignment on the ending position</option>
|
|
142 <option value="scale">Scale - Scaling all regions to the same length</option>
|
|
143 </param>
|
|
144 <when value="scale">
|
|
145 <param name="scalegrid" type="integer" value="0" min="0" label="Number of grid points" help="Number of equally-spaced grid points over which the smoothed curves are evaluated." />
|
|
146 </when>
|
|
147 </conditional>
|
|
148
|
|
149 <param name="kernelbandwidth" type="integer" value="5" min="2" label="Bandwidth for smoothing" help="" />
|
|
150
|
|
151 <!-- fill gaps -->
|
|
152 <param name="fillgaps" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Use smoothing to fill gaps (NA measurements)" help="" />
|
|
153 </when>
|
|
154 <!-- conditional choice: smoothing=splines -->
|
|
155 <when value="splines">
|
|
156 <!-- conditional region alignment -->
|
|
157 <conditional name="splinesconditionalscale">
|
|
158 <param name="alignment" type="select" label="Region alignment" help="">
|
|
159 <option value="center">Center - Alignment on the central position</option>
|
|
160 <option value="left">Left - Alignment on the starting position</option>
|
|
161 <option value="right">Right - Alignment on the ending position</option>
|
|
162 <option value="scale">Scale - Scaling all regions to the same length</option>
|
|
163 </param>
|
|
164 <when value="scale">
|
|
165 <param name="scalegrid" type="integer" value="0" min="0" label="Number of grid points" help="Number of equally-spaced grid points over which the smoothed curves are evaluated." />
|
|
166 </when>
|
|
167 </conditional>
|
|
168
|
|
169 <param name="splinesdegree" type="integer" value="3" min="0" label="Degree of B-splines" help="" />
|
|
170 <param name="splinesdistknots" type="integer" value="10" min="2" label="Distance between nodes (approximate)" help="" />
|
|
171
|
|
172 <!-- fill gaps -->
|
|
173 <param name="fillgaps" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Use smoothing to fill gaps (NA measurements)" help="" />
|
|
174 </when>
|
|
175 </conditional>
|
|
176
|
|
177 <!-- plot IWTomics results -->
|
|
178 <section name="plotres" title="Plot data" expanded="True">
|
|
179 <!-- average -->
|
|
180 <param name="average" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Plot the mean curves" help="" />
|
|
181 <!-- sample size in each position -->
|
|
182 <param name="size" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Plot sample size in each position" help="" />
|
|
183 <!-- conditional plot type -->
|
|
184 <conditional name="conditionalplottype">
|
|
185 <!-- plot type -->
|
|
186 <param name="plottype" type="select" label="Plot type" help="">
|
|
187 <option value="boxplot">Pointwise quantile curves (boxplot)</option>
|
|
188 <option value="curves">Curves (aligned)</option>
|
|
189 </param>
|
|
190 <!-- conditional choice: plottype=boxplot -->
|
|
191 <when value="boxplot">
|
|
192 <section name="probabilitiessection" title="Probabilities" expanded="True" help="Probabilities corresponding to the quantile curves to be drawn.">
|
|
193 <param name="prob0" size="3" type="float" value="0.25" min="0.0" max="1.0" label="Probability" />
|
|
194 <param name="prob1" size="3" type="float" value="0.5" min="0.0" max="1.0" label="Probability" />
|
|
195 <param name="prob2" size="3" type="float" value="0.75" min="0.0" max="1.0" label="Probability" />
|
|
196 <repeat name="probabilities" title="Probabilities">
|
|
197 <param name="prob" size="3" type="float" value="0.5" min="0.0" max="1.0" label="Probability" />
|
|
198 </repeat>
|
|
199 </section>
|
|
200 </when>
|
|
201 </conditional>
|
|
202 </section>
|
|
203 </inputs>
|
|
204
|
|
205 <outputs>
|
|
206 <data format="rdata" name="outrdata" label="${tool.name} on ${on_string}: IWTomicsData Object" from_work_dir="iwtomics.loadandplot.RData" />
|
|
207 <data format="tabular" name="outregions" label="${tool.name} on ${on_string}: Region Dataset IDs" from_work_dir="iwtomics.loadandplot.regions.txt" />
|
|
208 <data format="tabular" name="outfeatures" label="${tool.name} on ${on_string}: Feature IDs" from_work_dir="iwtomics.loadandplot.features.txt" />
|
|
209 <data format="pdf" name="outpdf" label="${tool.name} on ${on_string}: Plotted Data" from_work_dir="iwtomics.loadandplot.pdf" />
|
|
210 </outputs>
|
|
211
|
56
|
212 <tests>
|
|
213 <test>
|
|
214 <param name="regions" value="input/Controls_regions.bed,input/Elements1_regions.bed,input/Elements2_regions.bed,input/Elements3_regions.bed" ftype="bed" />
|
|
215 <param name="regionsheader" value="input/regions.header.txt" ftype="tabular" />
|
|
216 <param name="features" value="input/Feature1.bed,input/Feature2.bed" ftype="bed" />
|
|
217 <param name="featuresheader" value="input/features.header.bed.txt" ftype="tabular" />
|
|
218 <param name="zerobased" value="TRUE" />
|
|
219 <param name="smoothing" value="kernel" />
|
|
220 <param name="alignment" value="center" />
|
|
221 <param name="kernelbandwidth" value="5" />
|
|
222 <param name="fillgaps" value="TRUE" />
|
|
223 <param name="average" value="TRUE" />
|
|
224 <param name="size" value="TRUE" />
|
|
225 <param name="plottype" value="boxplot" />
|
|
226 <param name="prob0" value="0.25" />
|
|
227 <param name="prob1" value="0.5" />
|
|
228 <param name="prob2" value="0.75" />
|
|
229 <output name="outrdata" file="output_loadandplot/iwtomics.loadandplot.RData" compare="sim_size" />
|
|
230 <output name="outregions" file="output_loadandplot/iwtomics.loadandplot.regions.txt" />
|
|
231 <output name="outfeatures" file="output_loadandplot/iwtomics.loadandplot.features.txt" />
|
|
232 <output name="outpdf" file="output_loadandplot/iwtomics.loadandplot.pdf" compare="sim_size" />
|
|
233 </test>
|
|
234 </tests>
|
|
235
|
68
|
236 <help><![CDATA[
|
18
|
237 This tool imports a collection of genomic region datasets, and associates to each region
|
|
238 multiple genomic feature measurements. It allows to align the regions in multiple ways
|
|
239 (center, left, right or scale alignment), to smooth the feature curves (possibly filling gaps in the
|
|
240 measurements) and to create a graphical representation of the feature measurements in each
|
|
241 region datasets (aligned curves or pointwise quantile curves).
|
|
242
|
|
243 -----
|
|
244
|
|
245 **Region datasets**
|
|
246
|
|
247 Each region dataset can be provided as a BED or Tabular file with tab delimited columns chr
|
|
248 start end (extra columns present in the input file are ignored). Regions can be of different
|
|
249 length::
|
|
250
|
|
251 chr2 49960150 50060150
|
|
252 chr2 55912445 56012445
|
|
253 ...
|
|
254
|
|
255 -----
|
|
256
|
|
257 **Feature measurements**
|
|
258
|
|
259 Feature measurements corresponding to all the regions can be provided as a BED or Tabular
|
|
260 file with tab delimited columns chr start end value::
|
|
261
|
|
262 chr2 49960150 49962150 0.9426
|
|
263 chr2 49962150 49964150 0.7816
|
|
264 ...
|
|
265
|
|
266 Each feature must be measured in windows of a fixed size inside all the regions (missing
|
|
267 values must be indicated as NA). Another way to import feature measurements is from a
|
|
268 Tabular file with the first three columns chr start end corresponding to the different genomic
|
|
269 regions, followed on the same row by all the measurements in fixed-size windows::
|
|
270
|
|
271 chr2 49960150 50060150 0.9426 0.7816 0.8921 ... ... 1.2063
|
|
272 chr2 55912445 56012445 0.8719 0.9975 1.1619 ... ... 0.9601
|
|
273 ...
|
|
274
|
|
275 -----
|
|
276
|
|
277 **Output**
|
|
278
|
|
279 The tool returns:
|
|
280
|
|
281 1. RData with the IWTomicsData object, that stores the aligned genomic region datasets, and their associated feature measurements;
|
|
282 2. Region dataset identifiers;
|
|
283 3. Feature identifiers;
|
|
284 4. PDF file with the plotted data.
|
|
285
|
|
286 1-3 can be used as input of the tool *IWTomics Test and Plot*
|
|
287
|
|
288 -----
|
|
289
|
|
290 .. class:: infomark
|
|
291
|
|
292 **Notes**
|
|
293
|
54
|
294 This Galaxy tool has been developed by Fabio Cumbo (Third University of Rome, Italy - fabio.cumbo@iasi.cnr.it) and Marzia A. Cremona (The Pennsylvania State University, USA - mac78@psu.edu).
|
18
|
295
|
|
296 It implements a simplified version of the methods *smooth* and *plot* for *IWTomicsData* objects.
|
|
297 The complete version can be found in the *R/Bioconductor* package *IWTomics* (see vignette_).
|
|
298
|
|
299 .. _vignette: https://bioconductor.org/packages/release/bioc/vignettes/IWTomics/inst/doc/IWTomics.pdf
|
54
|
300
|
|
301 Example data can be found at:
|
|
302
|
|
303 1. Simulated_data_
|
|
304 2. ETn_data_
|
|
305
|
|
306 .. _Simulated_data: https://usegalaxy.org/u/fabio-cumbo/h/iwtomics-example
|
|
307 .. _ETn_data: https://usegalaxy.org/u/fabio-cumbo/h/iwtomics-etn-example
|
68
|
308 ]]></help>
|
18
|
309
|
70
|
310 <expand macro="citations" />
|
18
|
311
|
|
312 </tool>
|