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