0
|
1 <tool id="nwdisplay" name="Newick Display" version="1.6">
|
|
2 <description>Display a phylogenetic tree as SVG</description>
|
|
3 <edam_operations>
|
|
4 <edam_operation>operation_0567</edam_operation>
|
|
5 </edam_operations>
|
|
6 <requirements>
|
|
7 <requirement type="package" version="1.6">newick_utils</requirement>
|
|
8 </requirements>
|
|
9 <command>
|
|
10 nw_display
|
|
11 -s
|
|
12 $scalebar
|
|
13 -u "$legend"
|
|
14 -I 'r'
|
|
15 -i
|
|
16 #if $condbranchsupport.branchsupport == "true":
|
|
17 "fill:$condbranchsupport.supcolor;
|
|
18 font-size:$condbranchsupport.supfontsize;
|
|
19 transform:$condbranchsupport.suptransform;"
|
|
20 #else:
|
|
21 "visibility:hidden;"
|
|
22 #end if
|
|
23 -b
|
|
24 #if $condbranchlength.branchlength == "true":
|
|
25 "fill:$condbranchlength.lencolor;
|
|
26 font-size:$condbranchlength.lenfontsize;
|
|
27 transform:$condbranchlength.lentransform;"
|
|
28 #else:
|
|
29 "visibility:hidden;"
|
|
30 #end if
|
|
31
|
|
32 -l "font-family:$leafFont;font-size:$leafSize;"
|
|
33 -d "stroke:grey;fill:none;stroke-width:2;stoke-linecap:round;"
|
|
34 -w $width
|
|
35 $radial
|
|
36
|
|
37 $fileNewick > $output
|
|
38
|
|
39 </command>
|
|
40 <inputs>
|
|
41 <param name="fileNewick" format="txt,nw,nwk,nhx" type="data" label="Newick file" />
|
|
42 <param name="scalebar" type="boolean" truevalue="" falsevalue="-S" checked="True" label="Display scale bar" />
|
|
43 <param name="legend" type="text" value="" label="Unit name scale" />
|
|
44 <param name="leafFont" type="text" value="sans-serif" label="Leaf font" />
|
|
45 <param name="leafSize" type="text" value="10px" label="Leaf font-size" />
|
|
46 <conditional name="condbranchsupport">
|
|
47 <param name="branchsupport" type="select" label="Branch support">
|
|
48 <option value="true">Display branch support</option>
|
|
49 <option value="false" selected="true">Hide branch support</option>
|
|
50 </param>
|
|
51 <when value="true">
|
|
52 <param name="supcolor" type="color" value="red" label="color" />
|
|
53 <param name="supfontsize" type="text" value="10px" label="font-size" />
|
|
54 <param name="suptransform" type="text" value="translateY(1.5em)" label="move" />
|
|
55 </when>
|
|
56 <when value="false" />
|
|
57 </conditional>
|
|
58 <conditional name="condbranchlength">
|
|
59 <param name="branchlength" type="select" label="Branch length">
|
|
60 <option value="true">Display branch length</option>
|
|
61 <option value="false" selected="true">Hide branch length</option>
|
|
62 </param>
|
|
63 <when value="true">
|
|
64 <param name="lencolor" type="color" value="blue" label="color" />
|
|
65 <param name="lenfontsize" type="text" value="10px" label="font-size" />
|
|
66 <param name="lentransform" type="text" value="translate(-1.5em,0em)" label="move" />
|
|
67 </when>
|
|
68 <when value="false" />
|
|
69 </conditional>
|
|
70 <param name="width" type="integer" value="800" label="SVG Tree width (px)" />
|
|
71 <param name="radial" type="boolean" truevalue="-r" falsevalue="" checked="False" label="Draw a radial tree" />
|
|
72 </inputs>
|
|
73 <outputs>
|
|
74 <data name="output" format="svg" label="${fileNewick.name}.svg" />
|
|
75 </outputs>
|
|
76 <tests>
|
|
77 <test>
|
|
78 <param name="fileNewick" value="tree.nwk"/>
|
|
79 <param name="width" value="400"/>
|
|
80 <param name="leafFont" value="courier"/>
|
|
81 <output name="output" file="tree.svg" lines_diff="2"/>
|
|
82 </test>
|
|
83 <test>
|
|
84 <param name="fileNewick" value="tree.nwk"/>
|
|
85 <param name="radial" value="-r"/>
|
|
86 <param name="branchlength" value="true"/>
|
|
87 <output name="output" file="tree2.svg" lines_diff="2"/>
|
|
88 </test>
|
|
89 </tests>
|
|
90 <help>
|
|
91 <![CDATA[
|
|
92 **Displays a tree as a graph, as text or SVG.**
|
|
93
|
|
94
|
|
95 Synopsis
|
|
96 --------
|
|
97
|
|
98 nw_display [options] <tree filename|->
|
|
99
|
|
100 Input
|
|
101 -----
|
|
102
|
|
103 Argument is the name of the file containing one or more trees,
|
|
104 or '-' (in which case the tree is read on stdin).
|
|
105
|
|
106 Output
|
|
107 ------
|
|
108
|
|
109 Outputs a graph representing the tree, either as text (default) or
|
|
110 as SVG (option -s). Underscores in labels are replaced with spaces.
|
|
111 Trees with no branch lengths are taken to be cladograms and are
|
|
112 drawn with leaves aligned. Otherwise, the tree is assumed to be a
|
|
113 phylogram: branch lengths are honored and a scale bar is drawn.
|
|
114
|
|
115 SVG graphics can be converted to other formats with converters
|
|
116 such as Inkscape (e.g. to PDF) or ImageMagick (e.g. to PNG or JPEG).
|
|
117 Inkscape is available from www.inkscape.org and ImageMagick from
|
|
118 www.imagemagick.org.
|
|
119
|
|
120 Options
|
|
121 -------
|
|
122
|
|
123 -a <number>: rotate all labels by this amount (radians, default: 0)
|
|
124 [only SVG radial]
|
|
125 -A <number>: rotate left-side labels by this amount (radians,
|
|
126 default: 0.0349 (=~ 2°)) [only SVG radial]
|
|
127 -b <string>: CSS for branch length labels. [only SVG]
|
|
128 Default: 'font-size:small;font-family:sans'.
|
|
129 setting 'opacity:0' disables printing of branch lengths.
|
|
130 -c <filename>: use specified file as CSS map [only SVG]. A CSS map
|
|
131 is a text file which specifies a style (CSS) for a clade.
|
|
132 Each line has the following structure:
|
|
133 <CSS> <flag> <label>+
|
|
134 <CSS> is a valid CSS style specification (no spaces allowed)
|
|
135 e.g. 'font-size:small;font-family:italics;stroke:green'.
|
|
136 <flag> is either 'Individual' or 'Clade' (case is not important, can
|
|
137 be abbreviated down to 'I' or 'C'). If set to 'Clade', the style is
|
|
138 applied to the clade defined by the labels. If 'Individual', the
|
|
139 style is applied to each node individually.
|
|
140 <label>+ is a nonempty, whitespace-separated list of Newick labels
|
|
141 (spaces are allowed IFF the label is enclosed in ''). If a label
|
|
142 matches more than one node, all matching nodes are used.
|
|
143 Default: no CSS map, whole tree is black (unless specified otherwise
|
|
144 via option -d).
|
|
145 <CSS>, <flag>, and <labels>+ are separated by whitespace.
|
|
146 The following specifies red stroke for a clade defined by A, B and C;
|
|
147 and 2-pixel wide, blue stroke for individual nodes D, E, and F:
|
|
148 stroke:red Clade A B C
|
|
149 stroke:blue;stroke-width:2 I D E F
|
|
150 If no colormap is specified, the default is (but see option -d):
|
|
151 stroke:black;fill:none;stroke-width:1;stroke-linecap:round
|
|
152 -d <string>: CSS for 'plain' tree nodes (i.e., unless overridden by -c)
|
|
153 [only SVG]
|
|
154 Default: stroke:black;fill:none;stroke-width:1;stroke-linecap:round
|
|
155
|
|
156 -h: prints this message and exits
|
|
157
|
|
158 -i <string>: CSS for inner node labels. [only SVG]
|
|
159 Default: 'font-size:small;font-family:sans'.
|
|
160
|
|
161 setting 'visibility:hidden' disables printing of inner node labels.
|
|
162 -I <char> sets the position of the inner node label. Valid options are
|
|
163 'l' (near the leaves), 'm' (middle) or 'r' (near the root). Default
|
|
164 is 'l'.
|
|
165
|
|
166 -l <string>: CSS for leaf node labels. [only SVG]
|
|
167 Default: 'font-size:medium;font-family:sans'.
|
|
168 setting 'visibility:hidden' disables printing of leaf node labels.
|
|
169 Note: if you change this, you will probably need to adjust the
|
|
170 space allocated to leaf labels - see option -W.
|
|
171 -n <number> add this number of pixels to the horizontal position of
|
|
172 node labels. [SVG only]
|
|
173
|
|
174 -o <filename>: use specified file as ornament map. Works like the CSS
|
|
175 map (see option -c), except that it specifies arbitrary SVG snippets
|
|
176 instead of CSS styles. For example, the following
|
|
177 "<circle style='fill:red' r='5'>" Clade A B C
|
|
178 will draw a red circle of radius 5 at the root of the clade defined
|
|
179 by nodes A, B, and C. Keyword 'Individual' is also accepted and
|
|
180 works like for CSS.
|
|
181
|
|
182 -R <integer>: use that many pixels for the root [only SVG]
|
|
183
|
|
184 -r: draw a radial tree (default: orthogonal) [only SVG]
|
|
185
|
|
186 -s: output graph as SVG (default: ASCII graphics). All output is on
|
|
187 stdout, so if there is more than one tree, stdout will be a
|
|
188 concatenation of SVG documents. These can be split into individual
|
|
189 files with the csplit(1) command:
|
|
190
|
|
191 $ nw_display -s many_trees.nw > multiple_svg
|
|
192 $ csplit -zs -f tree\_ -b '%02d.svg' multiple_svg '/<?xml/' {*}
|
|
193
|
|
194 will generate as many SVG files as there are Newick trees in
|
|
195 many_trees.nw. The files will be named tree_01.svg, tree_02.svg, etc.
|
|
196
|
|
197 -S: suppress scale bar (ignored for cladograms)
|
|
198
|
|
199 -t: set the zero of the scale at the maximum depth instead of the root.
|
|
200 This is useful when the branch lengths are in time units: zero marks
|
|
201 the present, and the scale shows the age of the ancestral nodes.
|
|
202 -u <string>: string is used as unit name for scale bar (ignored
|
|
203 if no scale bar is drawn).
|
|
204 -U <URL_filename>: use specified URL map [only SVG]. A URL map
|
|
205 is a text file which specifies a URL for a label.
|
|
206 Each line has the following structure:
|
|
207 <label> <URL>
|
|
208 Clicking on a label will follow the link (if any).
|
|
209 -v <number>: number of pixels between leaves (default: 40) [only SVG
|
|
210 orthogonal]
|
|
211 -w <number>: graph should be no wider than <number>, measured in
|
|
212 characters for text and pixels for SVG. Defaults: 80 (text),
|
|
213 300 (SVG)
|
|
214 -W <number>: use this as an estimate of the width of a leaf label
|
|
215 character (in pixels) [only SVG]. This affects the space left for
|
|
216 the tree nodes. Default: 5.0 You will probably need this if you
|
|
217 change the leaf label font properties (option -l), especially size.
|
|
218 You will probably need trial and error to find the right value.
|
|
219
|
|
220 LibXML
|
|
221 ......
|
|
222
|
|
223 If LibXML is being used, the handling of ornaments (-o) is more elaborate.
|
|
224 See the tutorial, section 2.2 (displaying) for details.
|
|
225 This executable uses LibXML2.
|
|
226
|
|
227 Examples
|
|
228 --------
|
|
229
|
|
230 # display tree as ASCII::
|
|
231
|
|
232 $ nw_display data/catarrhini
|
|
233
|
|
234 # display tree as SVG, using a color map::
|
|
235
|
|
236 $ nw_display -s -c data/color.map data/catarrhini
|
|
237
|
|
238 # ditto, convert to other graphics formats::
|
|
239
|
|
240 $ nw_display -s -c data/color.map data/catarrhini > catarrhini.svg
|
|
241 $ convert catarrhini.svg catarrhini.png # PNG, with ImageMagick
|
|
242 $ convert catarrhini.svg catarrhini.jpeg # JPEG, with ImageMagick
|
|
243 $ inkscape -z -f catarrhini.svg -A catarrhini.pdf # PDF, with Inkscape
|
|
244
|
|
245 # the same; no branch lengths::
|
|
246
|
|
247 $ nw_display -s -b 'visibility:hidden' -c data/color.map data/catarrhini
|
|
248
|
|
249 # radial tree, leaf labels in italics::
|
|
250
|
|
251 $ nw_display -s -r -l 'font-style:italics' data/catarrhini
|
|
252
|
|
253 ]]>
|
|
254 </help>
|
|
255 <citations>
|
|
256 <citation type="doi">10.1186/1748-7188-3-7</citation>
|
|
257 </citations>
|
|
258 </tool>
|