<?xml version="1.0"?>
<tool id="roi_filter" name="ROI Filter">
    <description>Filter ROI files</description>

    <command interpreter="bash">
        roi_filter.sh $numeric -c $column -o $operator -v $value &lt;$input &gt;$output
    </command>
        
    <!--
      Input Files and Parameters
    -->
    <inputs>
        <param name="input" format="roi" type="data" label="ROI file to filter." />

        <param name="column" type="integer" label="column (starts with 1)" value="5" />
        
        <param name="operator" type="select" label="operator">
            <option value="gt" selected="true">&gt;</option>
            <option value="lt">&lt;</option>
            <option value="geq">&gt;=</option>
            <option value="leq">&lt;=</option>
            <option value="eq">==</option>
            <option value="neq">!=</option>
        </param>

        <param name="value" type="text" label="value" value="100" />

        <param name="numeric" type="boolean" label="compare as number" checked="true" truevalue="-n" falsevalue="" />
    </inputs>

    <!--
        Output Files
    -->
    <outputs>
        <data name="output" format="roi" label="${input.name}_filtered_col_${column}" />
    </outputs>

    <!--
      Recognize errors by return code and not output to stderr.
    -->
    <stdio>
        <exit_code range="1:" level="fatal" />
        <exit_code range=":-1" level="fatal" />
    </stdio>

    <!--
      Tool Help
    -->
    <help>No help yet.</help>
</tool>
