<tool id="metaquantome_filter" name="metaQuantome: filter" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@">
    <description>for quality, redundancy, and sample coverage</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements" />
    <command detect_errors="exit_code"><![CDATA[
        metaquantome filter
        --samps '$samps'
        --mode '$mode_args.mode'
        #if $mode_args.mode == 'f' or $mode_args.mode == 'ft'
            --ontology='$mode_args.ontology_args.ontology'
        #end if
        --expand_file '$expand_file'
        --min_peptides $min_peptides
        #if $min_pep_nsamp != "":
            --min_pep_nsamp $min_pep_nsamp
        #else
            --min_pep_nsamp all
        #end if
        --min_children_non_leaf $min_children_non_leaf
        #if $min_child_nsamp != "":
            --min_child_nsamp $min_child_nsamp
        #else
            --min_child_nsamp all
        #end if
        --qthreshold $qthreshold
        --outfile='$outfile'
    ]]></command>
    <inputs>
      <conditional name="mode_args">
          <param argument="--mode" type="select" label="Mode">
              <option value="f">Functional analysis</option>
              <option value="t">Taxonomic analysis</option>
              <option value="ft">Functional-taxonomic interaction analysis</option>
          </param>
          <when value="f">
              <expand macro="ONTOLOGY_ARGS"/>
          </when>
          <when value="t">
          </when>
          <when value="ft">
              <expand macro="ONTOLOGY_ARGS"/>
          </when>
      </conditional>
      <expand macro="SAMPS"/>
      <param argument="--expand_file" type="data" format="tabular" label="metaquantome expand file"
                  help=""/>
      <param argument="--min_peptides" type="integer" value="0" min="0" label="min_peptides">
          <help>
              Used for filtering to well-supported annotations. The
              number of peptides providing evidence for a term is
              the number of peptides directly annotated with that
              term plus the number of peptides annotated with any of
              its descendants. Terms with a number of peptides
              greater than or equal to min_peptides are retained.
              The default is 0.
          </help>
      </param>
      <param argument="--min_pep_nsamp" type="integer" value="" min="0" optional="true" label="min_pep_nsamp">
          <help>
              Number of samples per group that must meet or exceed
              min_peptides. Default is 'all'.
          </help>
      </param>
      <param argument="--min_children_non_leaf" type="integer" value="0" min="0" label="min_children_non_leaf">
          <help>
              Used for filtering to informative annotations. A term
              is retained if it has a number of children greater
              than or equal to min_children_non_leaf. The default is 0.
          </help>
      </param>
      <param argument="--min_child_nsamp" type="integer" value="" min="0" optional="true" label="min_child_nsamp">
          <help>
              Number of samples per group that must meet or exceed
              min_children_nsamp. The default is all samples.
          </help>
      </param>
      <param argument="--qthreshold" type="integer" value="3" min="0" label="qthreshold">
          <help>
              Minimum number of intensities in each sample group.
              Any functional/taxonomic term with lower number of
              per-group intensities will be filtered out. The
              default is 3, because this is the minimum number for
              t-tests.
          </help>
      </param>
    </inputs>
    <outputs>
        <data format="tabular" name="outfile" label="${tool.name} on ${on_string} filtered"/>
    </outputs>
    <tests>
      <test>
        <param name="expand_file" value="go_expanded.tab" ftype="tabular"/>
        <param name="mode" value="f" />
        <param name="ontology" value="go" />
        <param name="samps" value="samples_basic.tab" ftype="tabular"/>
        <param name="min_peptides" value="2" />
        <param name="min_pep_nsamp" value="" />
        <param name="min_children_non_leaf" value="2" />
        <param name="min_child_nsamp" value="" />
        <param name="qthreshold" value="0" />
        <output name="outfile" file="go_filtered.tab" ftype="tabular"/>
      </test>
    </tests>
    <help><![CDATA[
metaQuantome filter
===================

The *filter* module is the second step in the metaQuantome analysis workflow. The
purpose of the filter module is to filter expanded terms to those that are
representative and well-supported by the data. Please see the manuscript for further
details about filtering.


Questions, Comments, Problems, Kudos
--------------------------------------

Please file any issues at https://github.com/galaxyproteomics/tools-galaxyp/issues.
      ]]></help>
    <expand macro="citations" />
</tool>
