<tool id="gaiac_sensor_performance_evaluation" name="GAIAC sensor performance evaluation" version="0.1.0" python_template_version="3.12">
	<description>to evaluate the sensor performance against standard instruments as per US EPA criteria</description>

    <requirements>
        <requirement type="package" version="3.12">python</requirement>
        <requirement type="package" version="2.2.3">pandas</requirement>
        <requirement type="package" version="3.8.*">matplotlib-base</requirement>
        <requirement type="package" version="1.5.2">scikit-learn</requirement>
        <requirement type="package" version="0.13.1">seaborn</requirement>
    </requirements>

    <command detect_errors="exit_code"><![CDATA[

        python '$__tool_directory__/gaiac_sensor_performance_evaluation.py' -I '$infile' --column_1 '$clm2' --column_2 '$clm1' --html_out_dir '$html_output.extra_files_path'  --html_file_name '$html_output'  --tsv_file_name '$tabular_output' 
    
    ]]></command>

    <inputs>
      <!--<param name='input' type="data" format="csv"  argument= "input"/>-->
      <param name="infile" type="data" format="tabular" label="Dataset"/>

      <param name="clm1" label="Select columns containing data from the standard or reference instrument" type="data_column" data_ref="infile" numerical="True" multiple="False" use_header_names="true">
        <validator type="no_options" message="Please select any one column."/>
      </param>

      <param name="clm2" label="Select columns containing data from instrument under test (sensors)" type="data_column" data_ref="infile" numerical="True" multiple="True" use_header_names="true">
        <validator type="no_options" message="Please select any one column."/>
      </param>
    </inputs>

    <outputs>   
        <data name='html_output' format='html' label="${tool.name} on $on_string (html)" />
        <data name='tabular_output' format='tabular' label="${tool.name} on $on_string (tabular)" from_work_dir="out.tsv" />
    </outputs>
 
    <tests>
        <test>
            <!-- input data file -->
            <param name="infile" value="test.tsv"/>
            <!-- assume clm1 is the 'Reference' column, clm2 is 'SensorA' and 'SensorB' -->
            <param name="clm1" value="1"/>
            <param name="clm2" value="1,2"/>
            <!-- expected output html file -->
            <output name="html_output" file="testout.html" compare="contains"/>
        </test>
    </tests>


     <help><![CDATA[
.. class:: infomark

**What it does**

This tool generates a table of the parameters of linear regression (slope, intercept, r, Rsquare, RMSE, NRMSE) and bias calculations as per US EPA recommendation for the low cost sensors against the reference instrument.

  
-----

**Inputs**
    Table of parameters    
        * **--infile** : Input data frame as a tabular (.tsv or .csv) file.
        * **--column_1** : Select the column containing data from the reference (standard) instrument.
        * **--column_2** : Select the column containing data from the instrument under test (sensor).

-----

**Outputs**
    * Returns an html file containing the table of parameters that are required to evaluate sensors against a reference instrument]]></help>

    <citations>
 <citation type="bibtex">

    @article{dubey2022,
   title={AirPiuG-Galaxy software platform based open-source GUI tools for data collection and analysis from low cost air pollution sensors},
   author={Dubey, R and Joshi, J and Patra, A and Blankenberg, D},
   journal={GitHub repository},
   url = {https://github.com/ravishdubey/OPCN3API},
   year={2022},
   publisher={GitHub}
   }
}</citation>
    </citations>
</tool>






