<?xml version="1.0"?>
<tool id="roi_plot_thumbnails" name="ROI Thumbnail Plots">
  <description>Create ROI thumbnail plot grids.</description>
  <!-- First execute HTMl generation (will also create output path), then
       perform PNG creation. -->
  <command interpreter="python">
    roi_plot_thumbnails.py --in-file $input --out-file "$out_file" --out-dir "$out_file.files_path"
    #if $max_rois    # --max-rois $max_rois #end if
    #if $num_rows    # --num-rows $num_rows #end if
    #if $num_cols    # --num-cols $num_cols #end if
    #if $plot_height # --plot-height $plot_height #end if
    #if $plot_width  # --plot-width $plot_width #end if
    #if $link_target # --link-target $link_target #end if
    #if $link_type   # --link-type $link_type #end if
    #if $igv_host    # --igv-host $igv_host #end if
    #if $igv_port    # --igv-port $igv_port #end if
    #if $ucsc_org    # --ucsc-org $ucsc_org #end if
    #if $ucsc_db     # --ucsc-db $ucsc_db #end if
    #if $ucsc_chr_prefix # --ucsc-chr-prefix "$ucsc_chr_prefix" #end if
  </command>
  <inputs>
    <param name="input" format="roi" type="data" label="ROI file to generate statistics for."/>
    <param name="max_rois" type="integer" label="Maximal total number of records to process. 0 for all." value="5000" />
    <param name="max_value" type="integer" label="Maximal value to plot. 0 for no limit." value="0" />
    <param name="num_rows" type="integer" label="Number of rows per grid." value="50" />
    <param name="num_cols" type="integer" label="Number of columns per grid." value="40" />
    <param name="plot_height" type="integer" label="Height of one plot in px." value="30" />
    <param name="plot_width" type="integer" label="Width of one plot in px." value="30" />

    <param name="link_type" type="select" label="Link target.">
      <option value="local_igv" label="Local IGV Instance" />
      <option value="ucsc" label="UCSC Genome Browser" />
    </param>

    <param name="link_target" type="select" label="Open links in.">
      <option value="_blank" selected="true">new window</option>
      <option value="_top">this window</option>
      <option value="">this frame</option>
    </param>

    <param name="igv_host" type="text" label="Host for the IGV link." value="localhost"  />
    <param name="igv_port" type="integer" label="Port for the IGV link." value="60151" />

    <param name="ucsc_org" type="text" label="UCSC Genome Browser org value." value="human" />
    <param name="ucsc_db" type="text" label="UCSC Genome Browser db value." value="hg18" />
    <param name="ucsc_chr_prefix" type="text" label="Prefix to add to contig names." value="" />
  </inputs>
  <outputs>
    <data name="out_file" format="html" label="${input.name} Plot Grid" />
  </outputs>

    <stdio>
        <exit_code range="1:" level="fatal" />
        <exit_code range=":-1" level="fatal" />
    </stdio>

  <help>
    You don't need help!
  </help>

    <!--
      Dependencies
    -->
    <requirements>
        <requirement type="python-module">Cheetah</requirement>
        <requirement type="binary">roi_plot_thumbnails</requirement>
    </requirements>
</tool>
