view loadandplot.xml @ 89:e089b19da14c draft

Uploaded 20180221
author fabio
date Wed, 21 Feb 2018 11:07:29 -0500
parents 63c13d46bff8
children
line wrap: on
line source

<tool id="iwtomics_loadandplot" name="IWTomics Load" version="@VERSION@.0">
  <description>Smooth and Plot</description>
  <macros>
    <import>macros.xml</import>
  </macros>
  <expand macro="requirements" />

  <command detect_errors="exit_code">
<![CDATA[
    Rscript '$__tool_directory__/loadandplot.R' outrdata='${outrdata}' outregions='${outregions}' outfeatures='${outfeatures}' outpdf='${outpdf}'

      #set region_paths = '|'.join( [ str( $r ) for $r in $regions ] )
      regionspaths='${region_paths}'
      #set region_galaxyids = ','.join( [ str( $r.hid ) for $r in $regions ] )
      regionsgalaxyids='c(${region_galaxyids})'
      #set region_names = '|'.join( [ str( $r.name ) for $r in $regions ] )
      regionsfilenames='${region_names}'
      #if $regionsheader:
        regionsheaderfile='${regionsheader}'
      #end if
      
      #set feature_paths = '|'.join( [ str( $f ) for $f in $features ] )
      featurespaths='${feature_paths}'
      #set feature_galaxyids = ','.join( [ str( $f.hid ) for $f in $features ] )
      featuresgalaxyids='c(${feature_galaxyids})'
      #set feature_names = '|'.join( [ str( $f.name ) for $f in $features ] )
      featuresfilenames='${feature_names}'
      #if $featuresheader:
        featuresheaderfile='${featuresheader}'
      #end if

      smoothing="'${conditionaltype.smoothing}'"
      start.are.0based='${zerobased}'
      #if $conditionaltype.smoothing == 'no':
        alignment="'${conditionaltype.alignment}'"
      #elif $conditionaltype.smoothing == 'locpoly':
        bandwidth='${conditionaltype.locpolybandwidth}'
        degree='${conditionaltype.locpolydegree}'
        alignment="'${conditionaltype.conditionalscale.alignment}'"
      #elif $conditionaltype.smoothing == 'kernel':
        bandwidth='${conditionaltype.kernelbandwidth}'
        alignment="'${conditionaltype.conditionalscale.alignment}'"
      #elif $conditionaltype.smoothing == 'splines':
        degree='${conditionaltype.splinesdegree}'
        dist_knots='${conditionaltype.splinesdistknots}'
        alignment="'${conditionaltype.conditionalscale.alignment}'"
      #end if

      #if $conditionaltype.smoothing != 'no':
        #if $conditionaltype.conditionalscale.alignment == 'scale':
          scale='${conditionaltype.conditionalscale.scalegrid}'
          fill_gaps='TRUE'
        #else
          fill_gaps='${conditionaltype.conditionalscale.fillgaps}'
        #end if
      #end if

      average='${plotres.average}'
      size='${plotres.size}'
      plottype="'${plotres.conditionalplottype.plottype}'"
      #if $plotres.conditionalplottype.plottype == 'boxplot':
        #set probs = ','.join( [ str( $p.prob ) for $p in $plotres.conditionalplottype.probabilitiessection.probabilities ] )
        #if $probs != "":
          probs='c(${plotres.conditionalplottype.probabilitiessection.prob0},${plotres.conditionalplottype.probabilitiessection.prob1},${plotres.conditionalplottype.probabilitiessection.prob2},${probs})'
        #else:
          probs='c(${plotres.conditionalplottype.probabilitiessection.prob0},${plotres.conditionalplottype.probabilitiessection.prob1},${plotres.conditionalplottype.probabilitiessection.prob2})'
        #end if
      #end if      
]]>
  </command>

  <inputs>
    <!-- regions -->
    <param format="tabular" name="regions" type="data" label="Select region files" multiple="true" help="" />
    <param format="tabular" name="regionsheader" type="data" label="Insert header file for regions (optional)" optional="true" help="Tabular file. Column 1: names of the region files; Column 2: unique identifiers of the region datasets (spaces and special characters are not allowed); Column 3: name of the region datasets to be used in the output." />

    <!-- features -->
    <param format="tabular" name="features" type="data" label="Select feature files" multiple="true" help="" />
    <param format="tabular" name="featuresheader" type="data" label="Insert header file for features (optional)" optional="true" help="Tabular file. Column 1: names of the feature files; Column 2: unique identifiers of the features (spaces and special characters are not allowed); Column 3: name of the features to be used in the output." />

    <!-- zero-base one-base -->
    <param name="zerobased" type="select" label="Start positions are:" multiple="false" help="">
      <option value="TRUE">0-based</option>
      <option value="FALSE">1-based</option>
    </param>

    <!-- conditional smoothing -->
    <conditional name="conditionaltype">
      <!-- smoothing -->
      <param name="smoothing" type="select" label="Smoothing" help="Type of smoothing to be applied to the feature curves.">
        <option value="no">No</option>
        <option value="locpoly">Local Polynomials</option>
        <option value="kernel">Gaussian Kernel</option>
        <option value="splines">B-Splines</option>
      </param>
      <!-- conditional choice: smoothing=no -->
      <when value="no">
        <expand macro="alignment" />
      </when>
      <!-- conditional choice: smoothing=locpoly -->
      <when value="locpoly">
        <param name="locpolybandwidth" type="integer" value="5" min="2" label="Bandwidth for smoothing" help="" />
        <param name="locpolydegree" type="integer" value="3" min="0" label="Degree of local polynomial" help="" />
        <!-- conditional region alignment -->
        <expand macro="alignment-s" />
      </when>
      <!-- conditional choice: smoothing=kernel -->
      <when value="kernel">
        <param name="kernelbandwidth" type="integer" value="5" min="2" label="Bandwidth for smoothing" help="" />
        <!-- conditional region alignment -->
        <expand macro="alignment-s" />
      </when>
      <!-- conditional choice: smoothing=splines -->
      <when value="splines">
        <param name="splinesdegree" type="integer" value="3" min="0" label="Degree of B-splines" help="" />
        <param name="splinesdistknots" type="integer" value="10" min="2" label="Distance between nodes (approximate)" help="" />
        <!-- conditional region alignment -->
        <expand macro="alignment-s" />
      </when>
    </conditional>

    <!-- plot IWTomics results -->
    <section name="plotres" title="Plot data" expanded="True">
      <expand macro="plot-params" />
    </section>
  </inputs>

  <outputs>
    <data format="rdata" name="outrdata" label="${tool.name} on ${on_string}: IWTomicsData Object" from_work_dir="iwtomics.loadandplot.RData" />
    <data format="tabular" name="outregions" label="${tool.name} on ${on_string}: Region Dataset IDs" from_work_dir="iwtomics.loadandplot.regions.txt" />
    <data format="tabular" name="outfeatures" label="${tool.name} on ${on_string}: Feature IDs" from_work_dir="iwtomics.loadandplot.features.txt" />
    <data format="pdf" name="outpdf" label="${tool.name} on ${on_string}: Plotted Data" from_work_dir="iwtomics.loadandplot.pdf" />
  </outputs>

  <tests>
    <test>
      <param name="regions" value="input/Controls_regions.bed,input/Elements1_regions.bed,input/Elements2_regions.bed,input/Elements3_regions.bed" ftype="bed" />
      <param name="regionsheader" value="input/regions.header.txt" ftype="tabular" />
      <param name="features" value="input/Feature1.bed,input/Feature2.bed" ftype="bed" />
      <param name="featuresheader" value="input/features.header.bed.txt" ftype="tabular" />
      <param name="zerobased" value="TRUE" />
      <param name="smoothing" value="kernel" />
      <param name="alignment" value="center" />
      <param name="kernelbandwidth" value="5" />
      <param name="fillgaps" value="TRUE" />
      <param name="average" value="TRUE" />
      <param name="size" value="TRUE" />
      <param name="plottype" value="boxplot" />
      <param name="prob0" value="0.25" />
      <param name="prob1" value="0.5" />
      <param name="prob2" value="0.75" />
      <output name="outrdata" file="output_loadandplot/iwtomics.loadandplot.RData" compare="sim_size" />
      <output name="outregions" file="output_loadandplot/iwtomics.loadandplot.regions.txt" />
      <output name="outfeatures" file="output_loadandplot/iwtomics.loadandplot.features.txt" />
      <output name="outpdf" file="output_loadandplot/iwtomics.loadandplot.pdf" compare="sim_size" />
    </test>
  </tests>

  <help><![CDATA[
This tool imports a collection of genomic region datasets, and associates to each region
multiple genomic feature measurements. It allows to align the regions in multiple ways
(center, left, right or scale alignment), to smooth the feature curves (possibly filling gaps in the
measurements) and to create a graphical representation of the feature measurements in each
region datasets (aligned curves or pointwise quantile curves).

-----

**Region datasets**

Each region dataset can be provided as a BED or Tabular file with tab delimited columns chr
start end (extra columns present in the input file are ignored). Regions can be of different
length::

    chr2  49960150  50060150
    chr2  55912445  56012445
    ...

-----

**Feature measurements**

Feature measurements corresponding to all the regions can be provided as a BED or Tabular
file with tab delimited columns chr start end value::

    chr2  49960150  49962150  0.9426
    chr2  49962150  49964150  0.7816
    ...

Each feature must be measured in windows of a fixed size inside all the regions (missing
values must be indicated as NA). Another way to import feature measurements is from a
Tabular file with the first three columns chr start end corresponding to the different genomic
regions, followed on the same row by all the measurements in fixed-size windows::

    chr2  49960150  50060150  0.9426  0.7816  0.8921  ...  ...  1.2063
    chr2  55912445  56012445  0.8719  0.9975  1.1619  ...  ...  0.9601
    ...

-----

**Output**

The tool returns:

1. RData with the IWTomicsData object, that stores the aligned genomic region datasets, and their associated feature measurements;
2. Region dataset identifiers;
3. Feature identifiers;
4. PDF file with the plotted data.

1-3 can be used as input of the tool *IWTomics Test and Plot*

-----

.. class:: infomark

**Notes**

This Galaxy tool has been developed by Fabio Cumbo (Third University of Rome, Italy - fabio.cumbo@iasi.cnr.it) and Marzia A. Cremona (The Pennsylvania State University, USA - mac78@psu.edu).

It implements a simplified version of the methods *smooth* and *plot* for *IWTomicsData* objects.
The complete version can be found in the *R/Bioconductor* package *IWTomics* (see vignette_).

.. _vignette: https://bioconductor.org/packages/release/bioc/vignettes/IWTomics/inst/doc/IWTomics.pdf

Example data can be found at:

1. Simulated_data_
2. ETn_data_

.. _Simulated_data: https://usegalaxy.org/u/fabio-cumbo/h/iwtomics-example
.. _ETn_data: https://usegalaxy.org/u/fabio-cumbo/h/iwtomics-etn-example
  ]]></help>

  <expand macro="citations" />

</tool>