<?xml version="1.0"?>
<macros>
    <token name="@PHYLOSEQ_ALPHA_DIVERSITY_CMD_LINE@">
        
        phyloseq_alpha_diversity.py
            --phyloseq-rdata '$phyloseq_rdata'
            --var-exp '$var_exp'
            --alpha-measures ${" ".join(str($alpha_measures).split(","))}
            --output-alpha-tsv '$alpha_div_tsv'
            --html '$html'
    </token>

    <xml name="phyloseq_alpha_diversity_inputs">
        <!-- Files -->
        <param argument="--phyloseq-rdata" type="data" format="rdata" label="Phyloseq object (.Rdata)" help="Rdata file generated by the FROGS Stat 'Phyloseq Import data' tool."/>
        <!-- Params -->
        <param argument="--var-exp" type="text" value="" label="Grouping variable" help="Experimental variable used to group samples (e.g., Treatment, Host type, etc.).">
            <expand macro="restricted_sanitizer_validator"/>
        </param>
        <param argument="--alpha-measures" type="select" multiple="true" optional="false" label="Alpha diversity indices to compute" help="Select one or more alpha diversity indices to calculate. Multiple selections are allowed.">
             <option value="Observed" selected="True">Observed</option>
             <option value="Chao1" selected="True">Chao1</option>
             <option value="Shannon" selected="True">Shannon</option>
             <option value="InvSimpson" selected="True">InvSimpson</option>
             <option value="Simpson">Simpson</option>
             <option value="ACE">ACE</option>
             <option value="Fisher">Fisher</option>
        </param>
    </xml>

    <!-- Test -->
    <xml name="phyloseq_alpha_diversity_test_input">
        <param name="phyloseq_rdata" value="references/16-phylo_import.Rdata" />
        <param name="var_exp" value="EnvType" />
        <param name="alpha_measures" value="Observed,Chao1,Shannon" />
    </xml>

    <xml name="phyloseq_alpha_diversity_test_output">
        <output name="alpha_div_tsv" file="references/18-phylo_alpha_div.tsv" compare="diff" lines_diff="0" />
        <output name="html" count="1">
            <assert_contents>
                <!-- HTML size or line diff can't be used as many information about path, os, date are present. -->
                <!-- Here we test only title, intermediate results and output of last R command -->
                <has_text text='Stat: Alpha Diversity Visualisation' />
                <has_text text='(phyloseq_alpha_diversity.py' />
				<has_text text='v5.1.0)' />
                <!-- check anova on Observed alpha metrics -->
                <has_text text='EnvType      7  18148    2593   5.383 9.78e-05' />
                <!-- check anova on Chao1 alpha metrics -->
                <has_text text='EnvType      7  13764    1966   2.492   0.0269' />
                <!-- check anova on Shannon alpha metrics -->
                <has_text text='EnvType      7 11.333   1.619   3.553 0.003209' />
                <has_text text='─ Session info ───────────────────────────────────────────────────────────────' />
            </assert_contents>
        </output>
    </xml>

</macros>
