<tool id="gaiac_box_plot" name="GAIAC Box Plot" version="0.1.0" python_template_version="3.10" >
  <description>Generates box plots for numerical data columns in a dataset</description>
  <requirements>
    <requirement type="package" version="2.2.3">pandas</requirement>
    <requirement type="package" version="3.10.0">matplotlib</requirement>
    <requirement type="package" version="0.13.2">seaborn</requirement>
  </requirements>

  <stdio>
    <exit_code range="1" level="fatal" />
  </stdio>
    <command detect_errors="exit_code"><![CDATA[
        python '$__tool_directory__/gaiac_boxplot.py' --infile '$infile' -C '$clm_list_y' -H  '$fig_height' -W '$fig_width' -T '$plottitile' -O 'out.png' --ylab '$clm_lab_y' --xlab '$clm_lab_x'

            #if $Sel_x_tick_labels.Plot == 'advance'
                --custom_xtick_name  '$Sel_x_tick_labels.label'
            #end if          
    ]]></command>

  <inputs> 
    <param name="infile" type="data" format="tabular" label="Input file" />
    <param name="plottitile" type="text" value="Box Plot" label="Plot title" />
    <param name="fig_height" type="text" value="3" label="Figure Height" />
    <param name="fig_width" type="text" value="5" label="Figure Width" />
    <param name="clm_lab_y" type="text" value="" size="30" label="Label for y axis"/>
    <param name="clm_lab_x" type="text" value="" size="30" label="Label for x axis"/>
    <param name="clm_list_y" label="Select columns for y axis" type="data_column" data_ref="infile" numerical="True" multiple="true" use_header_names="true">
        <validator type="no_options" message="Please select atleast one column."/>
    </param>
   
    <conditional name='Sel_x_tick_labels' >
      <param name="Plot" type="select" label="label for legend" argument="" help="Data plotting method">
        <option value="advance" > Advance option for custom labels for X tick labels</option>
        <option value="default" selected="true"> Default labels</option>
      </param>

      <when value="advance">
          <param name="label" type="text" value="" label="label for X tick as text" help="A list that gives custom labels for legends as comma seperated text"/>
      </when>

      <when value="default">
      </when>
    </conditional>
  </inputs>

  <outputs>
    <data name='output1' format='png' label="${tool.name} on $on_string (png)" from_work_dir="out.png" ></data>
  </outputs>
  
  <tests>
   <test>
    <!-- Input file and plot parameters -->
    <param name="infile" value="test.tsv"/>
    <param name="plottitile" value="Box Plot"/>
    <param name="fig_height" value="5"/>
    <param name="fig_width" value="7"/>
    <param name="clm_lab_y" value="Values"/>
    <param name="clm_lab_x" value="Categories"/>
    <!-- Select the column for the Y axis -->
    <param name="clm_list_y" value="1"/>
    <!-- Use default for custom X tick labels -->
    <param name="Sel_x_tick_labels|Plot" value="default"/>
    <!-- Output file -->
    <output name="output1" file="out.png" />
   </test>
  </tests>

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

**What it does**

This tool generates boxplot for the selected columns (parameters) from the dataset 

-----

**Inputs**
    Boxplot    
       * **--infile** Input files
       * **--column_list_y** List of columns 
       * **--custom_xtick_name**  xtick label
       * **--output** Output file
       * **--title**  Figure title 
       * **--height**  Figure height
       * **--width** Figure width
       * **--ylab** Y labels
       * **--xlab** X labels 
       
-----


**Outputs**
    * Returns png file with the boxplot]]></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>