<?xml version="1.0"?>
<tool id="hyphy_annotate" name="Annotate" version="@TOOL_VERSION@+galaxy0">
    <description>a newick tree with HyPhy</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <command detect_errors="exit_code"><![CDATA[
        cp '$input_tree' input.nhx &&
        cp '$compressed_msa' input.$compressed_msa.extension &&
        cp '$__tool_directory__/scripts/annotator.bf' annotator.bf &&
        hyphy annotator.bf
            input.nhx '$root' input.$compressed_msa.extension '$label' labeled_tree_
        @ERRORS@
        ]]></command>
    <inputs>
        <param name="input_tree" type="data" format="nhx" label="Input tree" />
        <param name="compressed_msa" type="data" format="fasta,fasta.gz" label="Multiple alignments" />
        <param name="root" type="text" optional="false" value="REFERENCE" label="Root node" />
        <param name="label" type="text" optional="false" value="Tree" label="Label for tree" />
    </inputs>
    <outputs>
        <data name="labeled_tree_int" format="nhx" from_work_dir="labeled_tree_int.nwk" label="${tool.name} on ${on_string} Labeled tree (int)" />
        <data name="labeled_tree_clade" format="nhx" from_work_dir="labeled_tree_clade.nwk" label="${tool.name} on ${on_string} Labeled tree (clade)" />
        <data name="labeled_tree_full" format="nhx" from_work_dir="labeled_tree_full.nwk" label="${tool.name} on ${on_string} Labeled tree (full)" />
        <data name="labeled_tree_json" format="hyphy_results.json" from_work_dir="labeled_tree_labels.json" label="${tool.name} on ${on_string} Labels" />
    </outputs>
    <tests>
        <test>
            <param name="compressed_msa" ftype="fasta.gz" value="annotate-in1.fa.gz"/>
            <param name="input_tree" ftype="nhx" value="annotate-in1.nhx"/>
            <param name="root" value="REFERENCE" />
            <param name="label" value="Annotated" />
            <output name="labeled_tree_int" file="annotate-out1-int.nhx" />
            <output name="labeled_tree_full" file="annotate-out1-full.nhx" />
            <output name="labeled_tree_clade" file="annotate-out1-clade.nhx" />
            <output name="labeled_tree_json" file="annotate-out1.json" />
        </test>
    </tests>
    <help><![CDATA[
HyPhy Annotate
==============

Given a set of alignments and a newick tree, this tool produces an annotated tree with
the specified root node and label.
]]></help>
    <expand macro="citations">
        <citation type="doi">10.1093/molbev/msv022</citation>
    </expand>
</tool>
