<tool id="humann_associate" name="Perform metadata association" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>on HUMAnN generated table</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="edam_ontology"/>
    <expand macro="requirements"/>
    <expand macro="version"/>
    <command detect_errors="exit_code"><![CDATA[
humann_associate
    --input '$input'
    --focal-metadatum '$focal_metadatum'
    --last-metadatum '$last_metadatum'
    --focal-type '$focal_type'
    --fdr $fdr
    --output '$output'
    ]]></command>
    <inputs>
        <param argument="--input" type="data" format="tsv,tabular" label="Gene family or pathway table with metadata rows at the top"/>
        <param argument="--focal-metadatum" type="text" value="" label="Metadatum to test vs. community feature totals">
            <sanitizer invalid_char="">
                <valid initial="string.ascii_letters,string.digits">
                    <add value="_" />
                </valid>
            </sanitizer>
            <validator type="empty_field" />
        </param>
        <param argument="--last-metadatum" type="text" value="" label="End of metadata rows">
            <sanitizer invalid_char="">
                <valid initial="string.ascii_letters,string.digits">
                    <add value="_" />
                </valid>
            </sanitizer>
            <validator type="empty_field" />
        </param>
        <param name="focal_type" argument="--focal-type" type="select" label="Metadatum type">
            <option value="continuous">Continuous</option>
            <option value="categorical">Categorical</option>
        </param>
        <param argument="--fdr" type="float" value="0.2" label="FDR threshold"/>
    </inputs>
    <outputs>
        <data format="tabular" name="output"/>
    </outputs>
    <tests>
        <test expect_num_outputs="1">
            <param name="input" value="hmp_pathabund.txt"/>
            <param name="focal_metadatum" value="STSite"/>
            <param name="last_metadatum" value="STSite"/>
            <param name="focal_type" value="categorical"/>
            <param name="fdr" value="0.2"/>
            <output name="output" ftype="tabular">
                <assert_contents>
                    <has_text text="Feature"/>
                    <has_text text="BRANCHED-CHAIN-AA-SYN-PWY: superpathway of branched amino acid biosynthesis"/>
                    <has_text text="Level means (|ed)"/>
                    <has_text text="P-value"/>
                    <has_text text="Q-value"/>
                    <has_n_columns n="4"/>
                </assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[
@HELP_HEADER@

When associating metadata with HUMAnN features, it is often beneficial to associate with community totals and avoid testing each 
individual feature stratification (to improve statistical power).

This is the approach used by this tool, which can compare feature totals across samples with 
1) a single continuous metadatum (via the Spearman Correlation) or 
2) a single categorical metadatum (via the Kruskal-Wallis H-test).

Notably, this is a naive approach to association, but it is useful for tutorial purposes.
    ]]></help>
    <expand macro="citations"/>
</tool>
