comparison xy_plot.xml @ 3:319fa5a9fc1b draft

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/xy_plot commit facdb350072c8492654c90040fea3109dc9b51cd
author devteam
date Wed, 07 Dec 2016 18:29:23 -0500
parents 23657fcaaa5c
children ecb437f1d298
comparison
equal deleted inserted replaced
2:23657fcaaa5c 3:319fa5a9fc1b
1 <tool id="XY_Plot_1" name="Plotting tool" version="1.0.1"> 1 <tool id="XY_Plot_1" name="Plotting tool" version="1.0.2">
2 <description>for multiple series and graph types</description> 2 <description>for multiple series and graph types</description>
3 <requirements> 3 <requirements>
4 <requirement type="package" version="2.11.0">R</requirement> 4 <requirement type="package" version="3.2.1">R</requirement>
5 </requirements> 5 <requirement type="package" version="2.11.1">fontconfig</requirement>
6 <command interpreter="bash">r_wrapper.sh $script_file</command> 6 </requirements>
7 <command interpreter="bash">r_wrapper.sh $script_file</command>
8 <configfiles>
9 <configfile name="script_file">
10 ## Setup R error handling to go to stderr
11 options( show.error.messages=F,
12 error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
13 ## Determine range of all series in the plot
14 xrange = c( NULL, NULL )
15 yrange = c( NULL, NULL )
16 #for $i, $s in enumerate( $series )
17 s${i} = read.table( "${s.input.file_name}", h=${s.header} )
18 x${i} = s${i}[,${s.xcol}]
19 yrange = 0
20 #for $column in str($s.ycol).split(','):
21 y${i}${column} = s${i}[,${column}]
22 yrange = range(y${i}${column}, yrange, na.rm=TRUE )
23 #end for
24 xrange = range( x${i}, xrange, na.rm=TRUE )
25 #end for
26 ## Open output PDF file
27 #if $outftype.value == "pdf"
28 pdf("outfile.pdf")
29 #else
30 "${outftype}"( "outfile.${outftype}" , type="cairo")
31 #end if
32 ## Dummy plot for axis / labels
33 plot( NULL, type="n", xlim=xrange, ylim=yrange, main="${main}", xlab="${xlab}", ylab="${ylab}" )
34 ## Plot each series
35 #for $i, $s in enumerate( $series )
36 #if $s.series_type['type'] == "line"
37 #for $column in str($s.ycol).split(','):
38 lines( x${i}, y${i}${column}, lty=${s.series_type.lty}, lwd=${s.series_type.lwd}, col=${s.series_type.col} )
39 #end for
40 #elif $s.series_type.type == "points"
41 #for $column in str($s.ycol).split(','):
42 points( x${i}, y${i}${column}, pch=${s.series_type.pch}, cex=${s.series_type.cex}, col=${s.series_type.col} )
43 #end for
44 #end if
45 #end for
46 ## Close the PDF file
47 devname = dev.off()
48 </configfile>
49 </configfiles>
7 50
8 <inputs> 51 <inputs>
9 <param name="main" type="text" value="" label="Plot Title"/> 52 <param name="main" type="text" value="" label="Plot Title"/>
10 <param name="xlab" type="text" value="" label="Label for x axis"/> 53 <param name="xlab" type="text" value="" label="Label for x axis"/>
11 <param name="ylab" type="text" value="" label="Label for y axis"/> 54 <param name="ylab" type="text" value="" label="Label for y axis"/>
55 <param name="outftype" type="select" label="Output File Type">
56 <option value="pdf">PDF</option>
57 <option value="png">PNG</option>
58 </param>
12 <repeat name="series" title="Series"> 59 <repeat name="series" title="Series">
13 <param name="input" type="data" format="tabular" label="Dataset"/> 60 <param name="input" type="data" format="tabular" label="Dataset"/>
61 <param name="header" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="false" label="Header in first line?"/>
14 <param name="xcol" type="data_column" data_ref="input" label="Column for x axis"/> 62 <param name="xcol" type="data_column" data_ref="input" label="Column for x axis"/>
15 <param name="ycol" type="data_column" data_ref="input" label="Column for y axis"/> 63 <param name="ycol" type="data_column" data_ref="input" multiple="true" label="Column for y axis"/>
16 <conditional name="series_type"> 64 <conditional name="series_type">
17 <param name="type" type="select" label="Series Type"> 65 <param name="type" type="select" label="Series Type">
18 <option value="line" selected="true">Line</option> 66 <option value="line" selected="true">Line</option>
19 <option value="points">Points</option> 67 <option value="points">Points</option>
20 </param> 68 </param>
42 <option value="2">Triangle (hollow)</option> 90 <option value="2">Triangle (hollow)</option>
43 <option value="3">Cross</option> 91 <option value="3">Cross</option>
44 <option value="4">Diamond (hollow)</option> 92 <option value="4">Diamond (hollow)</option>
45 <option value="15">Square (filled)</option> 93 <option value="15">Square (filled)</option>
46 <option value="16">Circle (filled)</option> 94 <option value="16">Circle (filled)</option>
47 <option value="17">Triangle (filled)</option> 95 <option value="17">Triangle (filled)</option>
48 </param> 96 </param>
49 <param name="col" type="select" label="Point Color"> 97 <param name="col" type="select" label="Point Color">
50 <option value="1">Black</option> 98 <option value="1">Black</option>
51 <option value="2">Red</option> 99 <option value="2">Red</option>
52 <option value="3">Green</option> 100 <option value="3">Green</option>
57 <option value="8">Gray</option> 105 <option value="8">Gray</option>
58 </param> 106 </param>
59 <param name="cex" type="float" label="Point Scale" value="1.0"/> 107 <param name="cex" type="float" label="Point Scale" value="1.0"/>
60 </when> 108 </when>
61 </conditional> 109 </conditional>
62 </repeat> 110 </repeat>
63 </inputs> 111 </inputs>
64
65 <configfiles>
66 <configfile name="script_file">
67 ## Setup R error handling to go to stderr
68 options( show.error.messages=F,
69 error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
70 ## Determine range of all series in the plot
71 xrange = c( NULL, NULL )
72 yrange = c( NULL, NULL )
73 #for $i, $s in enumerate( $series )
74 s${i} = read.table( "${s.input.file_name}" )
75 x${i} = s${i}[,${s.xcol}]
76 y${i} = s${i}[,${s.ycol}]
77 xrange = range( x${i}, xrange )
78 yrange = range( y${i}, yrange )
79 #end for
80 ## Open output PDF file
81 pdf( "${out_file1}" )
82 ## Dummy plot for axis / labels
83 plot( NULL, type="n", xlim=xrange, ylim=yrange, main="${main}", xlab="${xlab}", ylab="${ylab}" )
84 ## Plot each series
85 #for $i, $s in enumerate( $series )
86 #if $s.series_type['type'] == "line"
87 lines( x${i}, y${i}, lty=${s.series_type.lty}, lwd=${s.series_type.lwd}, col=${s.series_type.col} )
88 #elif $s.series_type.type == "points"
89 points( x${i}, y${i}, pch=${s.series_type.pch}, cex=${s.series_type.cex}, col=${s.series_type.col} )
90 #end if
91 #end for
92 ## Close the PDF file
93 devname = dev.off()
94 </configfile>
95 </configfiles>
96
97 <outputs> 112 <outputs>
98 <data format="pdf" name="out_file1" /> 113 <data format="pdf" name="out_file_pdf" from_work_dir="outfile.pdf" >
114 <filter>(outftype == 'pdf')</filter>
115 </data>
116 <data format="png" name="out_file_png" from_work_dir="outfile.png">
117 <filter>(outftype == 'png')</filter>
118 </data>
99 </outputs> 119 </outputs>
100
101 <tests> 120 <tests>
102 <test> 121 <test>
103 <param name="main" value="Example XY Plot"/> 122 <param name="main" value="Example XY Plot"/>
104 <param name="xlab" value="Column 1"/> 123 <param name="xlab" value="Column 1"/>
105 <param name="ylab" value="Column 2"/> 124 <param name="ylab" value="Column 2"/>
125 <param name="outftype" value="pdf"/>
106 <param name="input" value="2.tabular" ftype="tabular"/> 126 <param name="input" value="2.tabular" ftype="tabular"/>
107 <param name="xcol" value="1"/> 127 <param name="xcol" value="1"/>
108 <param name="ycol" value="2"/> 128 <param name="ycol" value="2"/>
109 <param name="type" value="line"/> 129 <param name="type" value="line"/>
110 <param name="lty" value="2"/> 130 <param name="lty" value="2"/>
111 <param name="col" value="2"/> 131 <param name="col" value="2"/>
112 <param name="lwd" value="1.0"/> 132 <param name="lwd" value="1.0"/>
113 <output name="out_file1" file="XY_Plot_1_out.pdf"/> 133 <output name="out_file_pdf" file="XY_Plot_1_out.pdf" ftype="pdf" compare="sim_size" />
134 </test>
135 <test><!-- test with file with header line, NA values, multiple ycols and PNG output -->
136 <param name="main" value="Example XY Plot PNG"/>
137 <param name="xlab" value="xlab"/>
138 <param name="ylab" value="ylab"/>
139 <param name="outftype" value="png"/>
140 <param name="series_0|input" value="testinput2.tsv" ftype="tabular"/>
141 <param name="series_0|header" value="TRUE"/>
142 <param name="series_0|xcol" value="1"/>
143 <param name="series_0|ycol" value="2,3"/>
144 <param name="series_0|type" value="points"/>
145 <param name="series_0|pch" value="1"/>
146 <param name="series_0|col" value="2"/>
147 <param name="series_0|cex" value="1.0"/>
148 <output name="out_file_png" ftype="png" file="testoutput.png" compare="sim_size" />
114 </test> 149 </test>
115 </tests> 150 </tests>
116 <help> 151 <help>
117 .. class:: infomark 152 .. class:: infomark
118 153
137 5 58 3.2 172 5 58 3.2
138 6 60 3.1 173 6 60 3.1
139 7 67 3.8 174 7 67 3.8
140 8 68 4.1 175 8 68 4.1
141 9 71 4.3 176 9 71 4.3
142 10 69 3.7 177 10 69 3.7
143 178
144 Create a two series XY plot on the above data: 179 Create a two series XY plot on the above data:
145 180
146 - Series 1: Red Dashed-Line plot between columns 1 and 2 181 - Series 1: Red Dashed-Line plot between columns 1 and 2
147 - Series 2: Blue Circular-Point plot between columns 3 and 2 182 - Series 2: Blue Circular-Point plot between columns 3 and 2
148 183
149 .. image:: xy_example.jpg 184 .. image:: xy_example.jpg
150 </help> 185 </help>
186 <citations/>
151 </tool> 187 </tool>