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 <stdio>
|
64
|
8 <exit_code range="255" level="fatal" description="Missing IWTomics package. Please be sure to have it installed before using this tool." />
|
|
9 <exit_code range="10" level="fatal" description="An error has occurred reading the header file for regions. Please try again." />
|
|
10 <exit_code range="11" level="fatal" description="Not all region files are present in the first column of header file for regions." />
|
|
11 <exit_code range="20" level="fatal" description="An error has occurred reading the header file for features. Please try again." />
|
|
12 <exit_code range="21" level="fatal" description="Not all feature files are present in the first column of header file for features." />
|
|
13 <exit_code range="30" level="fatal" description="An error has occurred reading the data. Please try again." />
|
|
14 <exit_code range="31" level="fatal" description="Not enough columns in input file." />
|
|
15 <exit_code range="32" level="fatal" description="Duplicated regions in region file." />
|
|
16 <exit_code range="33" level="fatal" description="Duplicated windows in feature file." />
|
|
17 <exit_code range="34" level="fatal" description="Overlapping windows in feature file." />
|
|
18 <exit_code range="35" level="fatal" description="Windows in feature files do not cover all regions in region files." />
|
|
19 <exit_code range="36" level="fatal" description="All windows in a feature file must have the same size." />
|
|
20 <exit_code range="40" level="fatal" description="An error has occurred smoothing the data. Please try again." />
|
66
|
21 <regex match="Error" source="both" level="fatal" description="An error has occurred. Please try again." />
|
18
|
22 </stdio>
|
|
23
|
|
24 <command>
|
|
25 <![CDATA[
|
|
26 Rscript $__tool_directory__/loadandplot.R outrdata="${outrdata}" outregions="${outregions}" outfeatures="${outfeatures}" outpdf="${outpdf}"
|
|
27
|
|
28 #set region_paths = '"\\|"'.join( [ str( $r ) for $r in $regions ] )
|
|
29 regionspaths="${region_paths}"
|
|
30 #set region_galaxyids = '","'.join( [ str( $r.hid ) for $r in $regions ] )
|
|
31 regionsgalaxyids="c(${region_galaxyids})"
|
|
32 #set region_names = '"\\|"'.join( [ str( $r.name ) for $r in $regions ] )
|
|
33 regionsfilenames="${region_names}"
|
|
34 #set region_header = '"\\|"'.join( [ str( $rh.regionsheader ) for $rh in $regionsheaderrepeat ] )
|
|
35 #if $region_header != "":
|
|
36 regionsheaderfile="${region_header}"
|
|
37 #end if
|
|
38
|
|
39 #set feature_paths = '"\\|"'.join( [ str( $f ) for $f in $features ] )
|
|
40 featurespaths="${feature_paths}"
|
|
41 #set feature_galaxyids = '","'.join( [ str( $f.hid ) for $f in $features ] )
|
|
42 featuresgalaxyids="c(${feature_galaxyids})"
|
|
43 #set feature_names = '"\\|"'.join( [ str( $f.name ) for $f in $features ] )
|
|
44 featuresfilenames="${feature_names}"
|
|
45 #set feature_header = '"\\|"'.join( [ str( $fh.featuresheader ) for $fh in $featuresheaderrepeat ] )
|
|
46 #if $feature_header != "":
|
|
47 featuresheaderfile="${feature_header}"
|
|
48 #end if
|
|
49
|
|
50 smoothing="'${conditionaltype.smoothing}'"
|
|
51 start.are.0based="${zerobased}"
|
|
52 #if $conditionaltype.smoothing == 'no':
|
|
53 alignment="'${conditionaltype.alignment}'"
|
|
54 #elif $conditionaltype.smoothing == 'locpoly':
|
|
55 alignment="'${conditionaltype.locpolyconditionalscale.alignment}'"
|
|
56 #if $conditionaltype.locpolyconditionalscale.alignment == 'scale':
|
|
57 scale="${conditionaltype.locpolyconditionalscale.scalegrid}"
|
|
58 #end if
|
|
59 bandwidth="${conditionaltype.locpolybandwidth}"
|
|
60 degree="${conditionaltype.locpolydegree}"
|
|
61 fill_gaps="${conditionaltype.fillgaps}"
|
|
62 #elif $conditionaltype.smoothing == 'kernel':
|
|
63 alignment="'${conditionaltype.kernelconditionalscale.alignment}'"
|
|
64 #if $conditionaltype.kernelconditionalscale.alignment == 'scale':
|
|
65 scale="${conditionaltype.kernelconditionalscale.scalegrid}"
|
|
66 #end if
|
|
67 bandwidth="${conditionaltype.kernelbandwidth}"
|
|
68 fill_gaps="${conditionaltype.fillgaps}"
|
|
69 #elif $conditionaltype.smoothing == 'splines':
|
|
70 alignment="'${conditionaltype.splinesconditionalscale.alignment}'"
|
|
71 #if $conditionaltype.splinesconditionalscale.alignment == 'scale':
|
|
72 scale="${conditionaltype.splinesconditionalscale.scalegrid}"
|
|
73 #end if
|
|
74 degree="${conditionaltype.splinesdegree}"
|
|
75 dist_knots="${conditionaltype.splinesdistknots}"
|
|
76 fill_gaps="${conditionaltype.fillgaps}"
|
|
77 #end if
|
|
78
|
|
79 average="${plotres.average}"
|
|
80 size="${plotres.size}"
|
|
81 plottype="'${plotres.conditionalplottype.plottype}'"
|
|
82 #if $plotres.conditionalplottype.plottype == 'boxplot':
|
|
83 #set probs = '","'.join( [ str( $p.prob ) for $p in $plotres.conditionalplottype.probabilitiessection.probabilities ] )
|
|
84 #if $probs != "":
|
|
85 probs="c(${plotres.conditionalplottype.probabilitiessection.prob0},${plotres.conditionalplottype.probabilitiessection.prob1},${plotres.conditionalplottype.probabilitiessection.prob2},${probs})"
|
|
86 #else:
|
|
87 probs="c(${plotres.conditionalplottype.probabilitiessection.prob0},${plotres.conditionalplottype.probabilitiessection.prob1},${plotres.conditionalplottype.probabilitiessection.prob2})"
|
|
88 #end if
|
|
89 #end if
|
|
90
|
52
|
91 >& /dev/null
|
18
|
92 ]]>
|
|
93 <!--
|
|
94 to print the stack add the following line at the end of the command and enable the corresponding entry in output
|
|
95 2> "${stackerr}"
|
|
96 -->
|
|
97 </command>
|
|
98
|
|
99 <inputs>
|
|
100 <!-- regions -->
|
|
101 <param format="tabular" name="regions" type="data" label="Select region files" multiple="true" help="" />
|
|
102 <repeat name="regionsheaderrepeat" title="Header file for regions (optional)" min="0" max="1" 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.">
|
|
103 <param format="tabular" name="regionsheader" type="data" label="Select header file" />
|
|
104 </repeat>
|
|
105
|
|
106 <!-- features -->
|
|
107 <param format="tabular" name="features" type="data" label="Select feature files" multiple="true" help="" />
|
|
108 <repeat name="featuresheaderrepeat" title="Header file for features (optional)" min="0" max="1" 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.">
|
|
109 <param format="tabular" name="featuresheader" type="data" label="Select header file" />
|
|
110 </repeat>
|
|
111
|
|
112 <!-- zero-base one-base -->
|
|
113 <param name="zerobased" type="select" label="Start positions are:" multiple="false" help="">
|
|
114 <option value="TRUE">0-based</option>
|
|
115 <option value="FALSE">1-based</option>
|
|
116 </param>
|
|
117
|
|
118 <!-- conditional smoothing -->
|
|
119 <conditional name="conditionaltype">
|
|
120 <!-- smoothing -->
|
|
121 <param name="smoothing" type="select" label="Smoothing" help="Type of smoothing to be applied to the feature curves.">
|
|
122 <option value="no">No</option>
|
|
123 <option value="locpoly">Local Polynomials</option>
|
|
124 <option value="kernel">Gaussian Kernel</option>
|
|
125 <option value="splines">B-Splines</option>
|
|
126 </param>
|
|
127 <!-- conditional choice: smoothing=no -->
|
|
128 <when value="no">
|
|
129 <param name="alignment" type="select" label="Region alignment" help="">
|
|
130 <option value="center">Center - Alignment on the central position</option>
|
|
131 <option value="left">Left - Alignment on the starting position</option>
|
|
132 <option value="right">Right - Alignment on the ending position</option>
|
|
133 </param>
|
|
134 </when>
|
|
135 <!-- conditional choice: smoothing=locpoly -->
|
|
136 <when value="locpoly">
|
|
137 <!-- conditional region alignment -->
|
|
138 <conditional name="locpolyconditionalscale">
|
|
139 <param name="alignment" type="select" label="Region alignment" help="">
|
|
140 <option value="center">Center - Alignment on the central position</option>
|
|
141 <option value="left">Left - Alignment on the starting position</option>
|
|
142 <option value="right">Right - Alignment on the ending position</option>
|
|
143 <option value="scale">Scale - Scaling all regions to the same length</option>
|
|
144 </param>
|
|
145 <when value="scale">
|
|
146 <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." />
|
|
147 </when>
|
|
148 </conditional>
|
|
149
|
|
150 <param name="locpolybandwidth" type="integer" value="5" min="2" label="Bandwidth for smoothing" help="" />
|
|
151 <param name="locpolydegree" type="integer" value="3" min="0" label="Degree of local polynomial" help="" />
|
|
152
|
|
153 <!-- fill gaps -->
|
|
154 <param name="fillgaps" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Use smoothing to fill gaps (NA measurements)" help="" />
|
|
155 </when>
|
|
156 <!-- conditional choice: smoothing=kernel -->
|
|
157 <when value="kernel">
|
|
158 <!-- conditional region alignment -->
|
|
159 <conditional name="kernelconditionalscale">
|
|
160 <param name="alignment" type="select" label="Region alignment" help="">
|
|
161 <option value="center">Center - Alignment on the central position</option>
|
|
162 <option value="left">Left - Alignment on the starting position</option>
|
|
163 <option value="right">Right - Alignment on the ending position</option>
|
|
164 <option value="scale">Scale - Scaling all regions to the same length</option>
|
|
165 </param>
|
|
166 <when value="scale">
|
|
167 <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." />
|
|
168 </when>
|
|
169 </conditional>
|
|
170
|
|
171 <param name="kernelbandwidth" type="integer" value="5" min="2" label="Bandwidth for smoothing" help="" />
|
|
172
|
|
173 <!-- fill gaps -->
|
|
174 <param name="fillgaps" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Use smoothing to fill gaps (NA measurements)" help="" />
|
|
175 </when>
|
|
176 <!-- conditional choice: smoothing=splines -->
|
|
177 <when value="splines">
|
|
178 <!-- conditional region alignment -->
|
|
179 <conditional name="splinesconditionalscale">
|
|
180 <param name="alignment" type="select" label="Region alignment" help="">
|
|
181 <option value="center">Center - Alignment on the central position</option>
|
|
182 <option value="left">Left - Alignment on the starting position</option>
|
|
183 <option value="right">Right - Alignment on the ending position</option>
|
|
184 <option value="scale">Scale - Scaling all regions to the same length</option>
|
|
185 </param>
|
|
186 <when value="scale">
|
|
187 <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." />
|
|
188 </when>
|
|
189 </conditional>
|
|
190
|
|
191 <param name="splinesdegree" type="integer" value="3" min="0" label="Degree of B-splines" help="" />
|
|
192 <param name="splinesdistknots" type="integer" value="10" min="2" label="Distance between nodes (approximate)" help="" />
|
|
193
|
|
194 <!-- fill gaps -->
|
|
195 <param name="fillgaps" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Use smoothing to fill gaps (NA measurements)" help="" />
|
|
196 </when>
|
|
197 </conditional>
|
|
198
|
|
199 <!-- plot IWTomics results -->
|
|
200 <section name="plotres" title="Plot data" expanded="True">
|
|
201 <!-- average -->
|
|
202 <param name="average" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Plot the mean curves" help="" />
|
|
203 <!-- sample size in each position -->
|
|
204 <param name="size" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Plot sample size in each position" help="" />
|
|
205 <!-- conditional plot type -->
|
|
206 <conditional name="conditionalplottype">
|
|
207 <!-- plot type -->
|
|
208 <param name="plottype" type="select" label="Plot type" help="">
|
|
209 <option value="boxplot">Pointwise quantile curves (boxplot)</option>
|
|
210 <option value="curves">Curves (aligned)</option>
|
|
211 </param>
|
|
212 <!-- conditional choice: plottype=boxplot -->
|
|
213 <when value="boxplot">
|
|
214 <section name="probabilitiessection" title="Probabilities" expanded="True" help="Probabilities corresponding to the quantile curves to be drawn.">
|
|
215 <param name="prob0" size="3" type="float" value="0.25" min="0.0" max="1.0" label="Probability" />
|
|
216 <param name="prob1" size="3" type="float" value="0.5" min="0.0" max="1.0" label="Probability" />
|
|
217 <param name="prob2" size="3" type="float" value="0.75" min="0.0" max="1.0" label="Probability" />
|
|
218 <repeat name="probabilities" title="Probabilities">
|
|
219 <param name="prob" size="3" type="float" value="0.5" min="0.0" max="1.0" label="Probability" />
|
|
220 </repeat>
|
|
221 </section>
|
|
222 </when>
|
|
223 </conditional>
|
|
224 </section>
|
|
225 </inputs>
|
|
226
|
|
227 <outputs>
|
52
|
228 <!--<data format="txt" name="stackerr" label="iwtomics.loadandplot.stackerr.txt" from_work_dir="iwtomics.loadandplot.stackerr.txt" />-->
|
18
|
229 <data format="rdata" name="outrdata" label="${tool.name} on ${on_string}: IWTomicsData Object" from_work_dir="iwtomics.loadandplot.RData" />
|
|
230 <data format="tabular" name="outregions" label="${tool.name} on ${on_string}: Region Dataset IDs" from_work_dir="iwtomics.loadandplot.regions.txt" />
|
|
231 <data format="tabular" name="outfeatures" label="${tool.name} on ${on_string}: Feature IDs" from_work_dir="iwtomics.loadandplot.features.txt" />
|
|
232 <data format="pdf" name="outpdf" label="${tool.name} on ${on_string}: Plotted Data" from_work_dir="iwtomics.loadandplot.pdf" />
|
|
233 </outputs>
|
|
234
|
56
|
235 <tests>
|
|
236 <test>
|
|
237 <param name="regions" value="input/Controls_regions.bed,input/Elements1_regions.bed,input/Elements2_regions.bed,input/Elements3_regions.bed" ftype="bed" />
|
|
238 <param name="regionsheader" value="input/regions.header.txt" ftype="tabular" />
|
|
239 <param name="features" value="input/Feature1.bed,input/Feature2.bed" ftype="bed" />
|
|
240 <param name="featuresheader" value="input/features.header.bed.txt" ftype="tabular" />
|
|
241 <param name="zerobased" value="TRUE" />
|
|
242 <param name="smoothing" value="kernel" />
|
|
243 <param name="alignment" value="center" />
|
|
244 <param name="kernelbandwidth" value="5" />
|
|
245 <param name="fillgaps" value="TRUE" />
|
|
246 <param name="average" value="TRUE" />
|
|
247 <param name="size" value="TRUE" />
|
|
248 <param name="plottype" value="boxplot" />
|
|
249 <param name="prob0" value="0.25" />
|
|
250 <param name="prob1" value="0.5" />
|
|
251 <param name="prob2" value="0.75" />
|
|
252 <output name="outrdata" file="output_loadandplot/iwtomics.loadandplot.RData" compare="sim_size" />
|
|
253 <output name="outregions" file="output_loadandplot/iwtomics.loadandplot.regions.txt" />
|
|
254 <output name="outfeatures" file="output_loadandplot/iwtomics.loadandplot.features.txt" />
|
|
255 <output name="outpdf" file="output_loadandplot/iwtomics.loadandplot.pdf" compare="sim_size" />
|
|
256 </test>
|
|
257 </tests>
|
|
258
|
18
|
259 <help>
|
|
260 This tool imports a collection of genomic region datasets, and associates to each region
|
|
261 multiple genomic feature measurements. It allows to align the regions in multiple ways
|
|
262 (center, left, right or scale alignment), to smooth the feature curves (possibly filling gaps in the
|
|
263 measurements) and to create a graphical representation of the feature measurements in each
|
|
264 region datasets (aligned curves or pointwise quantile curves).
|
|
265
|
|
266 -----
|
|
267
|
|
268 **Region datasets**
|
|
269
|
|
270 Each region dataset can be provided as a BED or Tabular file with tab delimited columns chr
|
|
271 start end (extra columns present in the input file are ignored). Regions can be of different
|
|
272 length::
|
|
273
|
|
274 chr2 49960150 50060150
|
|
275 chr2 55912445 56012445
|
|
276 ...
|
|
277
|
|
278 -----
|
|
279
|
|
280 **Feature measurements**
|
|
281
|
|
282 Feature measurements corresponding to all the regions can be provided as a BED or Tabular
|
|
283 file with tab delimited columns chr start end value::
|
|
284
|
|
285 chr2 49960150 49962150 0.9426
|
|
286 chr2 49962150 49964150 0.7816
|
|
287 ...
|
|
288
|
|
289 Each feature must be measured in windows of a fixed size inside all the regions (missing
|
|
290 values must be indicated as NA). Another way to import feature measurements is from a
|
|
291 Tabular file with the first three columns chr start end corresponding to the different genomic
|
|
292 regions, followed on the same row by all the measurements in fixed-size windows::
|
|
293
|
|
294 chr2 49960150 50060150 0.9426 0.7816 0.8921 ... ... 1.2063
|
|
295 chr2 55912445 56012445 0.8719 0.9975 1.1619 ... ... 0.9601
|
|
296 ...
|
|
297
|
|
298 -----
|
|
299
|
|
300 **Output**
|
|
301
|
|
302 The tool returns:
|
|
303
|
|
304 1. RData with the IWTomicsData object, that stores the aligned genomic region datasets, and their associated feature measurements;
|
|
305 2. Region dataset identifiers;
|
|
306 3. Feature identifiers;
|
|
307 4. PDF file with the plotted data.
|
|
308
|
|
309 1-3 can be used as input of the tool *IWTomics Test and Plot*
|
|
310
|
|
311 -----
|
|
312
|
|
313 .. class:: infomark
|
|
314
|
|
315 **Notes**
|
|
316
|
54
|
317 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
|
318
|
|
319 It implements a simplified version of the methods *smooth* and *plot* for *IWTomicsData* objects.
|
|
320 The complete version can be found in the *R/Bioconductor* package *IWTomics* (see vignette_).
|
|
321
|
|
322 .. _vignette: https://bioconductor.org/packages/release/bioc/vignettes/IWTomics/inst/doc/IWTomics.pdf
|
54
|
323
|
|
324 Example data can be found at:
|
|
325
|
|
326 1. Simulated_data_
|
|
327 2. ETn_data_
|
|
328
|
|
329 .. _Simulated_data: https://usegalaxy.org/u/fabio-cumbo/h/iwtomics-example
|
|
330 .. _ETn_data: https://usegalaxy.org/u/fabio-cumbo/h/iwtomics-etn-example
|
18
|
331 </help>
|
|
332
|
|
333 <citations>
|
|
334 <citation type="bibtex">
|
|
335 @ARTICLE{
|
|
336 iwt-functional-data,
|
|
337 author = {Pini, Alessia and Vantini, Simone},
|
|
338 title = {Interval-Wise Testing for functional data},
|
|
339 journal = {Journal of Nonparametric Statistics},
|
|
340 year = {2017},
|
|
341 volume = {29},
|
|
342 number = {2},
|
|
343 pages = {407-424}
|
|
344 }
|
|
345 </citation>
|
|
346 <citation type="bibtex">
|
|
347 @MANUAL{
|
|
348 iwtomics,
|
|
349 author = {Cremona, Marzia A and Pini, Alessia and Chiaromonte, Francesca and Vantini, Simone},
|
|
350 title = {IWTomics: Interval-Wise Testing for Omics Data},
|
54
|
351 note = {R package version 1.0.0},
|
18
|
352 year = {2017}
|
|
353 }
|
|
354 </citation>
|
|
355 </citations>
|
|
356
|
|
357 </tool>
|