changeset 0:fe4235285ee8 draft

planemo upload for repository https://github.com/tjunier/newick_utils commit e21a4f5dd923d549651f1a15c755e2de89cbd46d
author iuc
date Mon, 01 Oct 2018 09:46:08 -0400
parents
children b4163d2f64ab
files newick_display.xml static/images/example.png test-data/tree.nwk test-data/tree.png test-data/tree.svg test-data/tree.txt test-data/tree2.svg
diffstat 7 files changed, 174 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/newick_display.xml	Mon Oct 01 09:46:08 2018 -0400
@@ -0,0 +1,137 @@
+<tool id="newick_display" name="Newick Display" version="1.6">
+    <description>visualize a phylogenetic tree</description>
+    <edam_operations>
+        <edam_operation>operation_0567</edam_operation>
+    </edam_operations>
+    <requirements>
+        <requirement type="package" version="1.6">newick_utils</requirement>
+    </requirements>
+    <command detect_errors="aggressive"><![CDATA[
+nw_display
+    #if $outformat != 'txt':
+        -s
+    #end if
+    $scalebar
+    -u '$legend'
+    -I 'r'
+    -i
+    #if $condbranchsupport.branchsupport == "true":
+        'fill:$condbranchsupport.supcolor;
+        font-size:$condbranchsupport.supfontsize;
+        transform:$condbranchsupport.suptransform;'
+    #else:
+        "visibility:hidden;"
+    #end if
+    -b
+    #if $condbranchlength.branchlength == "true":
+        'fill:$condbranchlength.lencolor;
+        font-size:$condbranchlength.lenfontsize;
+        transform:$condbranchlength.lentransform;'
+    #else:
+        "visibility:hidden;"
+    #end if
+
+    -l 'font-family:$leafFont;font-size:$leafSize;'
+    -d "stroke:grey;fill:none;stroke-width:2;stoke-linecap:round;"
+    -w  $width
+    $radial
+
+    '$fileNewick' > output.svg
+
+#if $outformat == 'png':
+    && convert output.svg output.png
+    && mv output.png '$output'
+#else:
+    && mv output.svg '$output'
+#end if
+
+    ]]></command>
+    <inputs>
+        <param name="fileNewick" format="txt,newick,nw,nwk,nhx,mothur.tre" type="data" label="Newick file"/>
+        <param name="scalebar" type="boolean" truevalue="" falsevalue="-S" checked="True" label="Display scale bar" />
+        <param name="legend" type="text" value="" label="Unit name for the scale bar" />
+        <param name="leafFont" type="text" value="sans-serif" label="Leaf font" />
+        <param name="leafSize" type="text" value="10px" label="Leaf font-size" />
+        <conditional name="condbranchsupport">
+            <param name="branchsupport" type="select" label="Branch support">
+                <option value="true">Display branch support</option>
+                <option value="false" selected="true">Hide branch support</option>
+            </param>
+            <when value="true">
+                <param name="supcolor" type="color" value="red" label="color" />
+                <param name="supfontsize" type="text" value="10px" label="font-size" />
+                <param name="suptransform" type="text" value="translateY(1.5em)" label="move" />
+            </when>
+            <when value="false" />
+        </conditional>
+        <conditional name="condbranchlength">
+            <param name="branchlength" type="select" label="Branch length">
+                <option value="true">Display branch length</option>
+                <option value="false" selected="true">Hide branch length</option>
+            </param>
+            <when value="true">
+                <param name="lencolor" type="color" value="blue" label="color" />
+                <param name="lenfontsize" type="text" value="10px" label="font-size" />
+                <param name="lentransform" type="text" value="translate(-1.5em,0em)" label="move" />
+            </when>
+            <when value="false" />
+        </conditional>
+        <param name="width" type="integer" value="800" label="Image width" help="in pixels for image output or in characters for text output" />
+        <param name="radial" type="boolean" truevalue="-r" falsevalue="" checked="False" label="Draw a radial tree" />
+        <param name="outformat" type="select" label="Choose an output format">
+            <option value="svg" selected="true">SVG</option>
+            <option value="png">PNG</option>
+            <option value="txt">Text</option>
+        </param>
+    </inputs>
+    <outputs>
+        <data name="output" format="svg" label="${tool.name} on ${on_string}: Tree Graph" >
+            <change_format>
+                <when input="outformat" value="png" format="png"/>
+                <when input="outformat" value="txt" format="txt"/>
+            </change_format>
+        </data>
+    </outputs>
+    <tests>
+        <test>
+            <param name="fileNewick" value="tree.nwk"/>
+            <param name="width" value="400"/>
+            <param name="leafFont" value="courier"/>
+            <output name="output" file="tree.svg" ftype="svg" lines_diff="2"/>
+        </test>
+        <test><!-- test radial tree -->
+            <param name="fileNewick" value="tree.nwk"/>
+            <param name="radial" value="-r"/>
+            <param name="branchlength" value="true"/>
+            <output name="output" file="tree2.svg" ftype="svg" lines_diff="2"/>
+        </test>
+        <test><!-- test with png output format -->
+            <param name="fileNewick" value="tree.nwk"/>
+            <param name="radial" value="-r"/>
+            <param name="branchlength" value="true"/>
+            <param name="outformat" value="png"/>
+            <output name="output" file="tree.png" ftype="png" compare="sim_size" delta="15000"/>
+        </test>
+         <test><!-- test with txt output format -->
+            <param name="fileNewick" value="tree.nwk"/>
+            <param name="outformat" value="txt"/>
+            <output name="output" file="tree.txt" ftype="txt"/>
+        </test>
+    </tests>
+    <help><![CDATA[
+**What it does**
+
+This tool outputs a graph representing the tree, either as text or
+as a SVG or PNG image. Underscores in labels are replaced with spaces.
+Trees with no branch lengths are taken to be cladograms and are
+drawn with leaves aligned. Otherwise, the tree is assumed to be a
+phylogram: branch lengths are honored and a scale bar is drawn.
+
+.. image:: $PATH_TO_IMAGES/example.png
+   :alt: example newick tree graph
+
+   ]]></help>
+    <citations>
+        <citation type="doi">10.1186/1748-7188-3-7</citation>
+    </citations>
+</tool>
Binary file static/images/example.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/tree.nwk	Mon Oct 01 09:46:08 2018 -0400
@@ -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
Binary file test-data/tree.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/tree.svg	Mon Oct 01 09:46:08 2018 -0400
@@ -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>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/tree.txt	Mon Oct 01 09:46:08 2018 -0400
@@ -0,0 +1,20 @@
+      /----------------------------------------------------------------------------------------------------------------------+ raccoon                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
+ /----+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
+ |    \-----------------------------------------+ bear                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
+ |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
+ |                                                                      /-------------------------------------------------------------------------+ sea lion                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
+ |                       /----------------------------------------------+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
+ |                       |                                              \-------------------------------------------------------------------------+ seal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
+ |                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
+=+-----------------------+                                                                                                                                           /------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ monkey  
+ |                       |            /------------------------------------------------------------------------------------------------------------------------------+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
+ |                       \------------+                                                                                                                              \---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ cat                                                                                                                                                                                                                                                                                                                                                  
+ |                                    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
+ |                                    \--------------------------------------------------------------------------------------------------------------------+ weasel                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
+ |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
+ \-------------------------------------------------------------------------------------------------------------------------------------------------------------+ dog                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
+ |----------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|---------------         
+ 0                                                                                                                                                         25                                                                                                                                                         50                                                                                                                                                        75                                                                                                                                                        100                                                                                                                                                        125                        
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/tree2.svg	Mon Oct 01 09:46:08 2018 -0400
@@ -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>