<?xml version="1.0"?>
<tool id="hyphy_fade" name="HyPhy-FADE" version="@VERSION@+galaxy0">
    <description>: FUBAR* Approach to Directional Evolution (*Fast
    Unconstrained Bayesian Approximation)</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <command detect_errors="exit_code"><![CDATA[
        ln -s '$input_file' fade_input.fa &&
        ln -s '$input_nhx' fade_input.nhx &&
        hyphy fade
            --alignment ./fade_input.fa
            --tree ./fade_input.nhx
            --branches '$branches'
            --model '$model'
            --method '$posteriorEstimationMethod.method'
            --grid '$grid_points'
            --concentration_parameter '$concentration'
            @posteriorEstimationMethod_cmd@
            --output '$fade_output'
            > '$fade_log'
    ]]></command>
    <inputs>
        <param name="input_file" type="data" format="fasta" label="Input amino acid FASTA file"/>
        <param name="input_nhx" type="data" format="nhx" label="Input rooted newick file"/>
        <expand macro="branches"/>
        <expand macro="substitution"/>
        <expand macro="branches"/>
        <expand macro="conditional_posteriorEstimationMethod" />
        <param name="grid_points" type="integer" value="20" min="5" max="50" label="Grid points"/>
        <param name="concentration" type="float" value="0.5" min="0.001" max="1" label="Concentration parameter of the Dirichlet prior"/>
    </inputs>
    <outputs>
        <data name="fade_log" format="txt"/>
        <data name="fade_output" format="hyphy_results.json" />
    </outputs>
    <tests>
        <test>
            <param name="input_file" ftype="fasta" value="fade-in1.fa"/>
            <param name="input_nhx" ftype="nhx" value="fade-in1.nhx"/>
            <output name="fade_output" file="fade-out1.json" compare="sim_size"/>
        </test>
    </tests>
    <help><![CDATA[

FADE : FUBAR Approach to Directional Evolution
==============================================

What question does this method answer?
--------------------------------------

Which site(s) in an alignment evolve towards to or away from a particular residue.

Recommended Applications
------------------------

Screen protein sequence alignments where the direction of evolution can be resolved
(via tree rooting, e.g. using an outgroup) to find sites which evolve differently from
a standard protein model (selected by the user), or a gene-average model (GTR) to find
evidence of directional selection.

Brief description
-----------------

FFADE (FUBAR Approach to Directional Evolution) is a fast method to test
whether or not a subset of sites in a protein alignment evolve towards a
particular residue along a subset of branches at accelerated rates
compared to reference model. FADE uses a random effects model and latent
Dirichlet allocation (LDA) - inspired approximation methods to allocate
sites to rate classes.

Input
-----

1. A *FASTA* sequence alignment of protein sequences.
2. A *rooted* phylogenetic tree in the *Newick* format

Note: the names of sequences in the alignment must match the names of the sequences in the tree.


Output
------

A JSON file with analysis results (http://hyphy.org/resources/json-fields.pdf).

A custom visualization module for viewing these results is available (see http://vision.hyphy.org/FADE for an example)

Further reading
---------------

http://hyphy.org/methods/selection-methods/#FADE


Tool options
------------

::


    --model            The baseline substitution model to use
                            [default] use GTR

    --branches          Which branches should be tested for selection?
                            All [default] : test all branches

                            Internal : test only internal branches (suitable for
                            intra-host pathogen evolution for example, where terminal branches
                            may contain polymorphism data)

                            Leaves: test only terminal (leaf) branches

                            Unlabeled: if the Newick string is labeled using the {} notation,
                            test only branches without explicit labels
                            (see http://hyphy.org/tutorials/phylotree/)

    --grid             The number of grid points
                        Smaller : faster
                        Larger : more precise posterior estimation but slower
                        default value: 20

    --method           Inference method to use
                            Variational-Bayes : 0-th order Variational Bayes approximation; fastest [default]
                            Metropolis-Hastings : Full Metropolis-Hastings MCMC algorithm; orignal method [slowest]
                            Collapsed-Gibbs  : Collapsed Gibbs sampler [intermediate speed]


    --chains           How many MCMC chains to run (does not apply to Variational-Bayes)
                            default value: 5

    --chain-length     MCMC chain length (does not apply to Variational-Bayes)
                            default value: 2,000,000

    --burn-in          MCMC chain burn in (does not apply to Variational-Bayes)
                            default value: 1,000,000

    --samples          MCMC samples to draw (does not apply to Variational-Bayes)
                            default value: 1,000

    --concentration_parameter
                        The concentration parameter of the Dirichlet prior
                        default value: 0.5



]]>
</help>
    <expand macro="citations">
    </expand>
</tool>
