Repository 'newick_display'
hg clone https://toolshed.g2.bx.psu.edu/repos/dfornika/newick_display

Changeset 0:2073ce44237f (2018-01-10)
Commit message:
planemo upload
added:
nwdisplay.xml
test-data/tree.nwk
test-data/tree.svg
test-data/tree2.svg
b
diff -r 000000000000 -r 2073ce44237f nwdisplay.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nwdisplay.xml Wed Jan 10 18:11:18 2018 -0500
[
b'@@ -0,0 +1,258 @@\n+<tool id="nwdisplay" name="Newick Display" version="1.6">\n+    <description>Display a phylogenetic tree as SVG</description>\n+    <edam_operations>\n+        <edam_operation>operation_0567</edam_operation>\n+    </edam_operations>\n+    <requirements>\n+        <requirement type="package" version="1.6">newick_utils</requirement>\n+    </requirements>\n+    <command>\n+\t\t\tnw_display\n+\t\t\t-s \n+\t\t\t$scalebar\n+\t\t\t-u "$legend"\n+\t\t\t-I \'r\'\n+\t\t\t-i\n+\t\t\t#if $condbranchsupport.branchsupport == "true":\n+\t\t\t   "fill:$condbranchsupport.supcolor;\n+\t\t\t    font-size:$condbranchsupport.supfontsize;\n+\t\t\t    transform:$condbranchsupport.suptransform;"\n+\t\t\t#else:\n+\t\t\t     "visibility:hidden;"\n+\t\t\t#end if\n+\t\t\t-b\n+\t\t\t#if $condbranchlength.branchlength == "true":\n+               "fill:$condbranchlength.lencolor;\n+                font-size:$condbranchlength.lenfontsize;\n+                transform:$condbranchlength.lentransform;"\n+            #else:\n+                 "visibility:hidden;"\n+            #end if\t\t\t\n+\t\t\t\n+\t\t\t-l "font-family:$leafFont;font-size:$leafSize;"\n+\t\t\t-d "stroke:grey;fill:none;stroke-width:2;stoke-linecap:round;"\n+\t\t\t-w  $width\n+\t\t\t$radial\n+\t\t\t\n+\t\t    $fileNewick > $output\n+\t\t\n+    </command>\n+\t<inputs>\n+\t\t<param name="fileNewick" format="txt,nw,nwk,nhx" type="data" label="Newick file" />\n+\t\t<param name="scalebar" type="boolean" truevalue="" falsevalue="-S"\tchecked="True" label="Display scale bar" />\n+\t\t<param name="legend" type="text" value="" label="Unit name scale" />\n+\t\t<param name="leafFont" type="text" value="sans-serif" label="Leaf font" />\n+\t\t<param name="leafSize" type="text" value="10px" label="Leaf font-size" />\n+\t\t<conditional name="condbranchsupport">\n+\t\t\t<param name="branchsupport" type="select" label="Branch support">\n+\t\t\t    <option value="true">Display branch support</option>\n+                <option value="false" selected="true">Hide branch support</option>\n+            </param>\n+\t\t\t<when value="true">\n+\t\t\t\t<param name="supcolor" type="color" value="red" label="color" />\n+\t\t\t\t<param name="supfontsize" type="text" value="10px" label="font-size" />\n+\t\t\t\t<param name="suptransform" type="text" value="translateY(1.5em)" label="move" />\n+\t\t\t</when>\n+\t\t\t<when value="false" />\n+\t\t</conditional>\n+\t\t<conditional name="condbranchlength">\n+\t\t\t<param name="branchlength" type="select" label="Branch length">\n+\t\t\t\t<option value="true">Display branch length</option>\n+\t\t\t\t<option value="false" selected="true">Hide branch length</option>\n+\t\t\t</param>\n+\t\t\t<when value="true">\n+\t\t\t\t<param name="lencolor" type="color" value="blue" label="color" />\n+\t\t\t\t<param name="lenfontsize" type="text" value="10px" label="font-size" />\n+\t\t\t\t<param name="lentransform" type="text" value="translate(-1.5em,0em)" label="move" />\n+\t\t\t</when>\n+\t\t\t<when value="false" />\n+\t\t</conditional>\n+\t\t<param name="width" type="integer" value="800"\tlabel="SVG Tree width (px)" />\n+\t\t<param name="radial" type="boolean" truevalue="-r" falsevalue="" checked="False" label="Draw a radial tree" />\n+\t</inputs>\n+\t<outputs>\n+\t\t<data name="output" format="svg" label="${fileNewick.name}.svg" />\n+\t</outputs>\n+\t<tests>\n+\t\t<test>\n+\t\t    <param name="fileNewick" value="tree.nwk"/>\n+\t\t    <param name="width" value="400"/>\n+\t\t    <param name="leafFont" value="courier"/>\n+            <output name="output" file="tree.svg" lines_diff="2"/>\n+\t\t</test>\n+\t\t<test>\n+            <param name="fileNewick" value="tree.nwk"/>\n+            <param name="radial" value="-r"/>\n+            <param name="branchlength" value="true"/>\n+            <output name="output" file="tree2.svg" lines_diff="2"/>\n+        </test>\n+\t</tests>\n+    <help>\n+<![CDATA[\n+**Displays a tree as a graph, as text or SVG.**\n+\n+\n+Synopsis\n+--------\n+\n+nw_display [options] <tree filename|->\n+\n+Input\n+-----\n+\n+Argument is the name of the file containing one or more trees,\n+or \'-\' (in which case the tree is read on stdin).\n+\n+Output\n+------\n+\n+Outputs a graph representing the tree, either as text (default) or\n+as SVG (option '..b' of inner node labels.\n+    -I <char> sets the position of the inner node label. Valid options are\n+       \'l\' (near the leaves), \'m\' (middle) or \'r\' (near the root). Default\n+       is \'l\'.\n+\n+    -l <string>: CSS for leaf node labels. [only SVG]\n+       Default: \'font-size:medium;font-family:sans\'.\n+       setting \'visibility:hidden\' disables printing of leaf node labels.\n+       Note: if you change this, you will probably need to adjust the\n+       space allocated to leaf labels - see option -W.\n+    -n <number> add this number of pixels to the horizontal position of\n+       node labels. [SVG only]\n+\n+    -o <filename>: use specified file as ornament map. Works like the CSS\n+       map (see option -c), except that it specifies arbitrary SVG snippets\n+       instead of CSS styles. For example, the following\n+       "<circle style=\'fill:red\' r=\'5\'>" Clade A B C\n+       will draw a red circle of radius 5 at the root of the clade defined\n+       by nodes A, B, and C. Keyword \'Individual\' is also accepted and\n+       works like for CSS.\n+\n+    -R <integer>: use that many pixels for the root [only SVG]\n+\n+    -r: draw a radial tree (default: orthogonal) [only SVG]\n+\n+    -s: output graph as SVG (default: ASCII graphics). All output is on\n+       stdout, so if there is more than one tree, stdout will be a\n+       concatenation of SVG documents. These can be split into individual\n+       files with the csplit(1) command:\n+\n+       $ nw_display -s many_trees.nw > multiple_svg\n+       $ csplit -zs -f tree\\_ -b \'%02d.svg\' multiple_svg \'/<?xml/\' {*}\n+\n+       will generate as many SVG files as there are Newick trees in\n+       many_trees.nw. The files will be named tree_01.svg, tree_02.svg, etc.\n+\n+    -S: suppress scale bar (ignored for cladograms)\n+\n+    -t: set the zero of the scale at the maximum depth instead of the root.\n+       This is useful when the branch lengths are in time units: zero marks\n+       the present, and the scale shows the age of the ancestral nodes.\n+    -u <string>: string is used as unit name for scale bar (ignored\n+       if no scale bar is drawn).\n+    -U <URL_filename>: use specified URL map [only SVG]. A URL map\n+       is a text file which specifies a URL for a label.\n+       Each line has the following structure:\n+       <label> <URL>\n+       Clicking on a label will follow the link (if any).\n+    -v <number>: number of pixels between leaves (default: 40) [only SVG\n+       orthogonal]\n+    -w <number>: graph should be no wider than <number>, measured in\n+       characters for text and pixels for SVG. Defaults: 80 (text),\n+       300 (SVG)\n+    -W <number>: use this as an estimate of the width of a leaf label\n+       character (in pixels) [only SVG]. This affects the space left for\n+       the tree nodes. Default: 5.0 You will probably need this if you\n+       change the leaf label font properties (option -l), especially size.\n+       You will probably need trial and error to find the right value.\n+\n+LibXML\n+......\n+\n+If LibXML is being used, the handling of ornaments (-o) is more elaborate.\n+See the tutorial, section 2.2 (displaying) for details.\n+This executable uses LibXML2.\n+\n+Examples\n+--------\n+\n+# display tree as ASCII::\n+\n+$ nw_display data/catarrhini\n+\n+# display tree as SVG, using a color map::\n+\n+$ nw_display -s -c data/color.map data/catarrhini\n+\n+# ditto, convert to other graphics formats::\n+\n+$ nw_display -s -c data/color.map data/catarrhini > catarrhini.svg\n+$ convert catarrhini.svg catarrhini.png # PNG, with ImageMagick\n+$ convert catarrhini.svg catarrhini.jpeg    # JPEG, with ImageMagick\n+$ inkscape -z -f catarrhini.svg -A catarrhini.pdf # PDF, with Inkscape\n+\n+# the same; no branch lengths::\n+\n+$ nw_display -s -b \'visibility:hidden\' -c data/color.map data/catarrhini\n+\n+# radial tree, leaf labels in italics::\n+\n+$ nw_display -s -r -l \'font-style:italics\' data/catarrhini\n+\n+]]>\n+</help>\n+ <citations>\n+        <citation type="doi">10.1186/1748-7188-3-7</citation> \n+ </citations>\n+</tool>\n'
b
diff -r 000000000000 -r 2073ce44237f test-data/tree.nwk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/tree.nwk Wed Jan 10 18:11:18 2018 -0500
b
@@ -0,0 +1,1 @@
+((raccoon:19.19959,bear:6.80041):0.84600,((sea_lion:11.99700, seal:12.00300):7.52973,((monkey:100.85930,cat:47.14069):20.59201, weasel:18.87953):2.09460):3.87382,dog:25.46154);
\ No newline at end of file
b
diff -r 000000000000 -r 2073ce44237f test-data/tree.svg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/tree.svg Wed Jan 10 18:11:18 2018 -0500
[
@@ -0,0 +1,8 @@
+<?xml version='1.0' standalone='no'?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg width='400' height='350' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' ><defs><style type='text/css'><![CDATA[
+ .clade_0 {stroke:grey;fill:none;stroke-width:2;stoke-linecap:round;}
+ .leaf-label {font-family:courier;font-size:10px;}
+ .inner-label {visibility:hidden;}
+ .edge-label {visibility:hidden;}
+]]></style></defs>
+<!-- arguments: -s -u  -I r -i visibility:hidden; -b visibility:hidden; -l font-family:courier;font-size:10px; -d stroke:grey;fill:none;stroke-width:2;stoke-linecap:round; -w 400 /home/correia/galaxy/database/files/001/dataset_1871.dat  -->
+<g transform='translate(0,20)'><g  style='stroke:black;fill:none;stroke-width:1;stroke-linecap:round'><line class='clade_0' x1='12.0981' y1='0.0000' x2='59.7129' y2='0.0000'/><line class='clade_0' x1='12.0981' y1='40.0000' x2='28.9630' y2='40.0000'/><line class='clade_0' x1='12.0981' y1='0.0000' x2='12.0981' y2='40.0000'/><line class='clade_0' x1='10.0000' y1='20.0000' x2='12.0981' y2='20.0000'/><line class='clade_0' x1='38.2807' y1='80.0000' x2='68.0332' y2='80.0000'/><line class='clade_0' x1='38.2807' y1='120.0000' x2='68.0481' y2='120.0000'/><line class='clade_0' x1='38.2807' y1='80.0000' x2='38.2807' y2='120.0000'/><line class='clade_0' x1='19.6070' y1='100.0000' x2='38.2807' y2='100.0000'/><line class='clade_0' x1='75.8697' y1='160.0000' x2='326.0000' y2='160.0000'/><line class='clade_0' x1='75.8697' y1='200.0000' x2='192.7782' y2='200.0000'/><line class='clade_0' x1='75.8697' y1='160.0000' x2='75.8697' y2='200.0000'/><line class='clade_0' x1='24.8016' y1='180.0000' x2='75.8697' y2='180.0000'/><line class='clade_0' x1='24.8016' y1='240.0000' x2='71.6227' y2='240.0000'/><line class='clade_0' x1='24.8016' y1='180.0000' x2='24.8016' y2='240.0000'/><line class='clade_0' x1='19.6070' y1='210.0000' x2='24.8016' y2='210.0000'/><line class='clade_0' x1='19.6070' y1='100.0000' x2='19.6070' y2='210.0000'/><line class='clade_0' x1='10.0000' y1='155.0000' x2='19.6070' y2='155.0000'/><line class='clade_0' x1='10.0000' y1='280.0000' x2='73.1444' y2='280.0000'/><line class='clade_0' x1='10.0000' y1='20.0000' x2='10.0000' y2='280.0000'/><line x1='0' y1='150.0000' x2='10.0000' y2='150.0000'/></g><g style='stroke:none'><text class='leaf-label' x='69.7129' y='4.0000'>raccoon</text><text class='edge-label' x='35.905495' y='-4.000000'>19.19959</text><text class='leaf-label' x='38.9630' y='44.0000'>bear</text><text class='edge-label' x='20.530557' y='36.000000'>6.80041</text><text class='edge-label' x='11.049037' y='16.000000'>0.84600</text><text class='leaf-label' x='78.0332' y='84.0000'>sea lion</text><text class='edge-label' x='53.156957' y='76.000000'>11.99700</text><text class='leaf-label' x='78.0481' y='124.0000'>seal</text><text class='edge-label' x='53.164397' y='116.000000'>12.00300</text><text class='edge-label' x='28.943883' y='96.000000'>7.52973</text><text class='leaf-label' x='336.0000' y='164.0000'>monkey</text><text class='edge-label' x='200.934836' y='156.000000'>100.85930</text><text class='leaf-label' x='202.7782' y='204.0000'>cat</text><text class='edge-label' x='134.323956' y='196.000000'>47.14069</text><text class='edge-label' x='50.335655' y='176.000000'>20.59201</text><text class='leaf-label' x='81.6227' y='244.0000'>weasel</text><text class='edge-label' x='48.212186' y='236.000000'>18.87953</text><text class='edge-label' x='22.204342' y='206.000000'>2.09460</text><text class='edge-label' x='14.803523' y='151.000000'>3.87382</text><text class='leaf-label' x='83.1444' y='284.0000'>dog</text><text class='edge-label' x='41.572217' y='276.000000'>25.46154</text></g><g transform='translate(10,330)' style='stroke:black;stroke-width:1' ><path d='M 0 0 h 316'/><path d='M 0 0 v -7'/><text style='stroke:none;text-anchor:end' x='2' y='-9'>0</text><path d='M 61.9998 0 v -7'/><text style='stroke:none;text-anchor:end' x='63.9998' y='-9'>25</text><path d='M 124 0 v -7'/><text style='stroke:none;text-anchor:end' x='126' y='-9'>50</text><path d='M 185.999 0 v -7'/><text style='stroke:none;text-anchor:end' x='187.999' y='-9'>75</text><path d='M 247.999 0 v -7'/><text style='stroke:none;text-anchor:end' x='249.999' y='-9'>100</text><path d='M 309.999 0 v -7'/><text style='stroke:none;text-anchor:end' x='311.999' y='-9'>125</text><text style='font-size:small;stroke:none' x='0' y='-20'></text></g></g></svg>
b
diff -r 000000000000 -r 2073ce44237f test-data/tree2.svg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/tree2.svg Wed Jan 10 18:11:18 2018 -0500
[
@@ -0,0 +1,8 @@
+<?xml version='1.0' standalone='no'?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg width='800' height='800' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' ><defs><style type='text/css'><![CDATA[
+ .clade_0 {stroke:grey;fill:none;stroke-width:2;stoke-linecap:round;}
+ .leaf-label {font-family:sans-serif;font-size:10px;}
+ .inner-label {visibility:hidden;}
+ .edge-label {fill:blue; font-size:10px; transform:translate(-1.5em,0em);}
+]]></style></defs>
+<!-- arguments: -s -u  -I r -i visibility:hidden; -b fill:blue; font-size:10px; transform:translate(-1.5em,0em); -l font-family:sans-serif;font-size:10px; -d stroke:grey;fill:none;stroke-width:2;stoke-linecap:round; -w 800 -r /home/correia/galaxy/database/files/001/dataset_1871.dat  -->
+<g transform='translate(400,400)'><g style='stroke:black;fill:none;stroke-width:1;stroke-linecap:round'><line class='clade_0' x1='59.7129' y1='0.0000' x2='12.0981' y2='0.0000'/><line class='clade_0' x1='21.2682' y1='19.6601' x2='8.8839' y2='8.2122'/><path class='clade_0' d='M12.0981,0.0000 A12.098074,12.098074 0 0 1 8.8839 8.2122'/><line class='clade_0' x1='11.2659' y1='4.4094' x2='9.3121' y2='3.6447'/><line class='clade_0' x1='5.3378' y1='67.8235' x2='3.0035' y2='38.1627'/><line class='clade_0' x1='-42.1282' y1='53.4393' x2='-23.6994' y2='30.0625'/><path class='clade_0' d='M3.0035,38.1627 A38.280721,38.280721 0 0 1 -23.6994 30.0625'/><line class='clade_0' x1='-11.1123' y1='36.6324' x2='-5.6916' y2='18.7628'/><line class='clade_0' x1='-321.9864' y1='50.9976' x2='-74.9356' y2='11.8686'/><line class='clade_0' x1='-160.2892' y1='-107.1019' x2='-63.0833' y2='-42.1509'/><path class='clade_0' d='M-74.9356,11.8686 A75.869672,75.869672 0 0 1 -63.0833 -42.1509'/><line class='clade_0' x1='-74.1069' y1='-16.2596' x2='-24.2254' y2='-5.3152'/><line class='clade_0' x1='-16.7200' y1='-69.6438' x2='-5.7898' y2='-24.1164'/><path class='clade_0' d='M-24.2254,-5.3152 A24.801638,24.801638 0 0 1 -5.7898 -24.1164'/><line class='clade_0' x1='-17.7087' y1='-17.3644' x2='-13.9997' y2='-13.7275'/><path class='clade_0' d='M-5.6916,18.7628 A19.607045,19.607045 0 0 1 -13.9997 -13.7275'/><line class='clade_0' x1='-18.9958' y1='4.8574' x2='-9.6883' y2='2.4774'/><line class='clade_0' x1='35.7399' y1='-63.8182' x2='4.8862' y2='-8.7250'/><path class='clade_0' d='M9.3121,3.6447 A10.000000,10.000000 0 1 1 4.8862 -8.7250'/><line x1='0' y1='0' x2='-9.4154' y2='3.3689'/></g><g style='stroke:none'><text class='leaf-label' transform='rotate(0,69.7129,0)' x='69.7129' y='0.0000'>raccoon</text><text class='edge-label' transform='rotate(0,35.9055,-3)' x='35.9055' y='-3.0000'>19.19959</text><text class='leaf-label' transform='rotate(42.75,28.6114,26.4481)' x='28.6114' y='26.4481'>bear</text><text class='edge-label' transform='rotate(42.75,17.1125,11.7332)' x='17.1125' y='11.7332'>6.80041</text><text class='edge-label' transform='rotate(21.375,11.3824,1.2334)' x='11.3824' y='1.2334'>0.84600</text><text class='leaf-label' transform='rotate(85.5,6.12241,77.7926)' x='6.1224' y='77.7926'>sea lion</text><text class='edge-label' transform='rotate(85.5,7.1614,52.7577)' x='7.1614' y='52.7577'>11.99700</text><text class='leaf-label' style='text-anchor:end;' transform='rotate(128.250000,-48.3191,61.2925) rotate(180,-48.3191,61.2925)' x='-48.3191' y='61.2925'>seal</text><text class='edge-label' style='text-anchor:end;' transform='rotate(128.250000,-35.2697,39.8936) rotate(180,-35.2697,39.8936)' x='-35.2697' y='39.8936'>12.00300</text><text class='edge-label' style='text-anchor:end;' transform='rotate(106.875000,-11.2728,26.8267) rotate(180,-11.2728,26.8267)' x='-11.2728' y='26.8267'>7.52973</text><text class='leaf-label' style='text-anchor:end;' transform='rotate(171.000000,-331.863,52.562) rotate(180,-331.863,52.562)' x='-331.8633' y='52.5620'>monkey</text><text class='edge-label' style='text-anchor:end;' transform='rotate(171.000000,-198.93,28.4701) rotate(180,-198.93,28.4701)' x='-198.9303' y='28.4701'>100.85930</text><text class='leaf-label' style='text-anchor:end;' transform='rotate(213.750000,-168.604,-112.658) rotate(180,-168.604,-112.658)' x='-168.6039' y='-112.6576'>cat</text><text class='edge-label' style='text-anchor:end;' transform='rotate(213.750000,-110.02,-77.1208) rotate(180,-110.02,-77.1208)' x='-110.0196' y='-77.1208'>47.14069</text><text class='edge-label' style='text-anchor:end;' transform='rotate(192.375000,-48.5232,-13.7177) rotate(180,-48.5232,-13.7177)' x='-48.5232' y='-13.7177'>20.59201</text><text class='leaf-label' style='text-anchor:end;' transform='rotate(256.500000,-19.0544,-79.3675) rotate(180,-19.0544,-79.3675)' x='-19.0544' y='-79.3675'>weasel</text><text class='edge-label' style='text-anchor:end;' transform='rotate(256.500000,-8.3378,-47.5804) rotate(180,-8.3378,-47.5804)' x='-8.3378' y='-47.5804'>18.87953</text><text class='edge-label' style='text-anchor:end;' transform='rotate(224.437500,-13.7538,-17.688) rotate(180,-13.7538,-17.688)' x='-13.7538' y='-17.6880'>2.09460</text><text class='edge-label' style='text-anchor:end;' transform='rotate(165.656250,-15.0853,0.760927) rotate(180,-15.0853,0.760927)' x='-15.0853' y='0.7609'>3.87382</text><text class='leaf-label' transform='rotate(299.25,40.6261,-72.5432)' x='40.6261' y='-72.5432'>dog</text><text class='edge-label' transform='rotate(299.25,17.6956,-37.7375)' x='17.6956' y='-37.7375'>25.46154</text></g></g><g transform='translate(10,800)' style='stroke:black;stroke-width:1' ><path d='M 0 0 h 316'/><path d='M 0 0 v -7'/><text style='stroke:none;text-anchor:end' x='2' y='-9'>0</text><path d='M 61.9998 0 v -7'/><text style='stroke:none;text-anchor:end' x='63.9998' y='-9'>25</text><path d='M 124 0 v -7'/><text style='stroke:none;text-anchor:end' x='126' y='-9'>50</text><path d='M 185.999 0 v -7'/><text style='stroke:none;text-anchor:end' x='187.999' y='-9'>75</text><path d='M 247.999 0 v -7'/><text style='stroke:none;text-anchor:end' x='249.999' y='-9'>100</text><path d='M 309.999 0 v -7'/><text style='stroke:none;text-anchor:end' x='311.999' y='-9'>125</text><text style='font-size:small;stroke:none' x='0' y='-20'></text></g></svg>