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