view newick_display.xml @ 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
line wrap: on
line source

<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>