view testandplot.xml @ 21:21c5d505397c draft

Deleted selected files
author fabio
date Wed, 31 May 2017 11:07:50 -0400
parents 565118df598a
children d49031ef33d5
line wrap: on
line source

<tool id="testandplot" name="IWTomics Test" version="@VERSION@.0">
  <description>and Plot</description>
  <macros>
    <import>macros.xml</import>
  </macros>
  <expand macro="requirements" />
  <stdio>
    <exit_code range="-1" source="both" level="fatal" description="Missing IWTomics package. Please be sure to have it installed before using this tool." />
    <exit_code range="10" source="both" level="fatal" description="Wrong region ids." />
    <exit_code range="20" source="both" level="fatal" description="Wrong feature ids." />
    <exit_code range="30" source="both" level="fatal" description="Same test repeated multiple times." />
    <exit_code range="40" source="both" level="fatal" description="Testing error." />
    <regex match="Error" source="both" level="fatal" description="An error has occurred. Please try again." />
  </stdio>

  <command>
<![CDATA[
    Rscript $__tool_directory__/testandplot.R adjustedpvaluematrix="${adjustedpvaluematrix}" iwtomicsrespdf="${iwtomicsrespdf}" iwtomicssumpdf="${iwtomicssumpdf}" iwtomicsrdata="${iwtomicsrdata}" iwtomicstests="${iwtomicstests}" iwtomicsselectedfeatures="${iwtomicsselectedfeatures}"
      regionids="${regionids}"
      featureids="${featureids}"
      rdatafile="${rdata}"

      #set region1 = '","'.join( [ str( $r.region0 ) for $r in $regionssection.regions ] )
      #set region2 = '","'.join( [ str( $r.region1 ) for $r in $regionssection.regions ] )
      region1="c(${region1})"
      region2="c(${region2})"

      features_subset="c(${featureslist})"

      statistics="'${conditionalstatistics.statistics}'"
      #if $conditionalstatistics.statistics == "quantile":
        #set probabilities = '","'.join( [ str( $p.qprob ) for $p in $conditionalstatistics.quantilesection.qprobabilities ] )
        testprobs="c(${probabilities})"
      #end if

      B="${permutations}"

      testalpha="${plotres.alpha}"
      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

      groupby="'${plotsum.conditionalgroupby.groupby}'"
      #if $plotsum.conditionalgroupby.groupby == "test":
        summaryalpha="${plotsum.conditionalgroupby.testalphaplot}"
        only_significant="${plotsum.conditionalgroupby.testonlysig}"
      #elif $plotsum.conditionalgroupby.groupby == "feature":
        summaryalpha="${plotsum.conditionalgroupby.featurealphaplot}"
        only_significant="${plotsum.conditionalgroupby.featureonlysig}"
      #end if

     >& /dev/null
]]>
    <!--
    to print the stack add the following line at the end of the command and enable the corresponding entry in output
    2> "${stackerr}"
    -->
  </command>

  <inputs>
    <!-- RData -->
    <param format="rdata" name="rdata" type="data" label="Select IWTomicsData object" help="File created by 'IWTomics Load Smooth and Plot'." />
    <!-- region IDs -->
    <param format="tabular" name="regionids" type="data" label="Select region dataset IDs" help="File created by 'IWTomics Load Smooth and Plot'." />
    <!-- feature IDs -->
    <param format="tabular" name="featureids" type="data" label="Select feature IDs" help="File created by 'IWTomics Load Smooth and Plot'." />

    <!-- repeat region ids -->
    <section name="regionssection" title="Select regions for Interval-Wise Testing" expanded="True" help="IDs of the region datasets to be tested.">
      <repeat name="regions" title="Two-sample test" min="1">
        <param name="region0" type="data_column" data_ref="regionids" numerical="False" label="Region 1" multiple="False" use_header_names="True" />
        <param name="region1" type="data_column" data_ref="regionids" numerical="False" label="Region 2" multiple="False" use_header_names="True" />
      </repeat>
    </section>

    <!-- feature ids list -->
    <param name="featureslist" type="data_column" data_ref="featureids" numerical="False" label="Select features" multiple="True" use_header_names="True" help="IDs of the features to be tested." />

    <!-- conditional statistics -->
    <conditional name="conditionalstatistics">
      <!-- statistics -->
      <param name="statistics" type="select" label="Test statistics">
        <option value="mean">Mean difference</option>
        <option value="median">Median difference</option>
        <option value="variance">Variance ratio</option>
        <option value="quantile">Quantile difference(s)</option>
      </param>
      <!-- conditional choice: statistics=quantile -->
      <when value="quantile">
        <section name="quantilesection" title="Probabilities" expanded="True" help="Probabilities corresponding to the quantiles in test statistics.">
          <repeat name="qprobabilities" title="Probabilities" min="1">
            <param name="qprob" size="4" type="float" value="0.5" min="0.0" max="1.0" label="Probability" />
          </repeat>
        </section>
      </when>
    </conditional>

    <!-- permutations -->
    <param name="permutations" type="integer" value="1000" min="1" label="Number of permutations" />

    <!-- plot IWTomics results -->
    <section name="plotres" title="Plot IWTomics test results" expanded="True">
      <!-- alpha -->
      <param name="alpha" size="3" type="float" value="0.05" min="0.0" max="1.0" label="Level of the test (alpha)" />
      <!-- average -->
      <param name="average" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Plot the mean curves" />
      <!-- average -->
      <param name="size" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Plot sample size in each position" />
      <!-- conditional plot type -->
      <conditional name="conditionalplottype">
        <!-- plot type -->
        <param name="plottype" type="select" label="Plot type">
          <option value="boxplot">Pointwise quantile curves (boxplot)</option>
          <option value="curves">Curves (aligned)</option>
        </param>
        <!-- conditional choice: plottype=boxplot -->
        <when value="boxplot">
          <section name="probabilitiessection" title="Probabilities" expanded="True" help="Probabilities corresponding to the quantile curves to be drawn.">
            <param name="prob0" size="3" type="float" value="0.25" min="0.0" max="1.0" label="Probability" />
            <param name="prob1" size="3" type="float" value="0.5" min="0.0" max="1.0" label="Probability" />
            <param name="prob2" size="3" type="float" value="0.75" min="0.0" max="1.0" label="Probability" />
            <repeat name="probabilities" title="Probabilities">
              <param name="prob" size="3" type="float" value="0.5" min="0.0" max="1.0" label="Probability" />
            </repeat>
          </section>
        </when>
      </conditional>
    </section>

    <!-- summary plot -->
    <section name="plotsum" title="Summary plot" expanded="True">
      <!-- conditional group by -->
      <conditional name="conditionalgroupby">
        <!-- group by -->
        <param name="groupby" type="select" label="Group by" help="How tests should be grouped.">
          <option value="none">No plot</option>
          <option value="test">Group by test</option>
          <option value="feature">Group by feature</option>
        </param>
        <when value="test">
          <param name="testalphaplot" size="3" type="float" value="0.05" min="0.0" max="1.0" label="Level of the test (alpha)" />
          <param name="testonlysig" type="boolean" truevalue="TRUE" falsevalue="FALSE" label="Plot only significant tests" />
        </when>
        <when value="feature">
          <param name="featurealphaplot" size="3" type="float" value="0.05" min="0.0" max="1.0" label="Level of the test (alpha)" />
          <param name="featureonlysig" type="boolean" truevalue="TRUE" falsevalue="FALSE" label="Plot only significant tests" />
        </when>
      </conditional>
    </section>
  </inputs>

  <outputs>
    <!--<data format="txt" name="stackerr" label="iwtomics.testandplot.stackerr.txt" from_work_dir="iwtomics.testandplot.stackerr.txt" />-->
    <data format="txt" name="adjustedpvaluematrix" label="${tool.name} on ${on_string}: Adjusted p-value Matrix" from_work_dir="iwtomics.testandplot.adjustedpvalue.matrix.txt" />
    <data format="pdf" name="iwtomicsrespdf" label="${tool.name} on ${on_string}: Plotted Test Results" from_work_dir="iwtomics.testandplot.iwtomicstestresults.pdf" />
    <data format="pdf" name="iwtomicssumpdf" label="${tool.name} on ${on_string}: Summary Plot" from_work_dir="iwtomics.testandplot.summaryplot.pdf" />
    <data format="rdata" name="iwtomicsrdata" label="${tool.name} on ${on_string}: IWTomicsData Object with Test Results" from_work_dir="iwtomics.testandplot.RData" />
    <data format="tabular" name="iwtomicstests" label="${tool.name} on ${on_string}: Test IDs" from_work_dir="iwtomics.testandplot.tests.txt" />
    <data format="tabular" name="iwtomicsselectedfeatures" label="${tool.name} on ${on_string}: Feature IDs" from_work_dir="iwtomics.testandplot.selectedfeatures.txt" />
  </outputs>

  <help>
This tool statistically evaluates differences in genomic features between groups of regions along the genome.
In particular, it implements the Interval-Wise Testing for omics data, an extended version of the Interval-Wise
Testing for functional data presented in Pini and Vantini (2017). It allows to perform multiple two sample permutation
tests between pairs of region datasets, on several features. It returns the adjusted p-value curves for every test
and all possible scales. Moreover, it creates a graphical representation of the Interval-Wise Testing results
and a summary plot (optional) with p-values at the maximum scale. The tool *IWTomics Plot with Threshold on Test Scale*
permits to select the scale to be used in the plots.

-----

**Input files**

RData file with the IWTomicsData object, tabular files with region dataset IDs and feature IDs.
These files are created by the tool *IWTomics Load Smooth and Plot*.

-----

**Output**

The tool returns:

1. TXT file with an adjusted p-value matrix for every test performed. Each matrix contains a p-value curve (row) for every scale considered in the test;
2. PDF file with the plotted test results;
3. PDF file with the summary plot;
4. RData with the IWTomicsData object with the test results;
5. Test identifiers;
6. Feature identifiers.

4-6 can be used as input of the tool *IWTomics Plot with Threshold on Test Scale*

-----

.. class:: infomark

**Notes**

This Galaxy tool has been developed by Fabio Cumbo (Third University of Rome, Italy) and Marzia A. Cremona (The Pennsylvania State University, USA).

It implements a simplified version of the function *IWTomicsTest*, *plotTest* and *plotSummary* 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
  </help>

  <citations>
    <citation type="bibtex">
      @ARTICLE{
               iwt-functional-data,
               author = {A Pini and S. Vantini},
               title = {Interval-Wise Testing for functional data},
               journal = {Journal of Nonparametric Statistics},
               year = {2017},
               volume = {29},
               number = {2},
               pages = {407-424}
      }
    </citation>
    <citation type="bibtex">
      @MANUAL{
               iwtomics,
               author = {Cremona, Marzia A and Pini, Alessia and Chiaromonte, Francesca and Vantini, Simone},
               title = {IWTomics: Interval-Wise Testing for Omics Data},
               note = {R package version 0.99.12},
               year = {2017}
      }
    </citation>
  </citations>

</tool>