view wiggle_correlation.xml @ 0:3d1097835b2f draft default tip

Imported from capsule None
author jjohnson
date Mon, 22 Sep 2014 11:54:41 -0400
parents
children
line wrap: on
line source

<tool name="Multiple wiggle files correlation" id="correlation_dataset" version="0.1.0">
  <description>Calculate the correlation coefficient on the genome scale using multiple wiggle / bigwig files in fix-sized windows</description>
  <macros>
    <import>corr_macros.xml</import>
  </macros>
  <expand macro="requirements" />
  <command>
#if $maxscore and $minscore and ( $minscore > $maxscore ):
 echo "maxscore has to be greater than minscore!" 
 exit 1;
#end if
#if $wfile1.extension == "wig"
 wig_correlation.py -d $wfile1.metadata.dbkey -m $method
#elif $wfile1.extension == "bigwig"
 bigwig_correlation.py 
#end if
#if $maxscore.value
 --max-score $maxscore
#end if
#if $minscore.value
 --min-score $minscore
#end if
 $heatmap -s $step -z $size -f PDF -r tmp.r 
 $wfile1 -l '$wlabel1' $wfile2 -l '$wlabel2' 
#for $m in $more
 $m.wig -l "$m.label"
#end for
 &amp;> $log &amp;&amp;
 cp tmp.r $rscript &amp;&amp;
#if $imagetype.__str__ == "PNG":
 convert tmp.r.pdf tmp.r.png &amp;&amp; 
 cp tmp.r.png $output
#else
 cp tmp.r.pdf $output
#end if
  </command>
  <inputs>
    <param format="wig,bigwig" name="wfile1" type="data" label="Wiggle / bigwig file 1">
      <validator type="unspecified_build" />
    </param>
    <param name="wlabel1" type="text" label="Wiggle / bigwig label 1" optional="false">
      <validator type="length" message="must be between 1 and 255 characters" min="1" max="255"/>
    </param>
    <param format="wig,bigwig" name="wfile2" type="data" label="Wiggle / bigwig file 2">
      <validator type="unspecified_build" />
    </param>
    <param name="wlabel2" type="text" label="Wiggle / bigwig label 2" optional="false">
      <validator type="length" message="must be between 1 and 255 characters" min="1" max="255"/>
    </param>
    <repeat name="more" title="wiggle / bigwig file">
      <param format="wig,bigwig" name="wig" type="data" label="Select another wiggle / bigwig file"/>
      <param name="label" type="text" label="Wiggle / bigwig label" optional="false">
        <validator type="length" message="must be between 1 and 255 characters" min="1" max="255"/>
      </param>
    </repeat>
    <param name="step" type="integer" label="Step" value="100" help="step in kbps. It must be >= 1. Default: 100">
      <validator type="in_range" max="1000" min="1" message="Step is out of range, Step has to be between 1 to 1000" />
    </param>
    <param name="method" type="select" label="method:" help="method to process the paired two sets of data in the sampling step." >
      <option value="mean" selected="true">mean</option>
      <option value="median">median</option>
      <option value="sample">sample</option>
    </param>
    <param name="maxscore" type="float" label="Max Score" help="Maximum score in the calculation (optional)" value="10000" optional="true"/>
    <param name="minscore" type="float" label="Min Score" help="Minimum score in the calculation (optional)" value="-10000" optional="true"/>
    <param name="heatmap" type="boolean" label="Draw Heatmap instead?" checked="no"
	   truevalue="-H" falsevalue=" " />
    <param name="size" type="integer" label="image Size" value="10" help="Image size in inch. It must be ge 5 and le 20. Default: 10">
      <validator type="in_range" max="20" min="5" message="image Size is out of range, image Size has to be between 5 to 20" />
    </param>
    <param type="select" name="imagetype" display="radio" label="Image Type">
      <option value="PDF">PDF format</option>
      <option value="PNG">PNG format</option>
    </param>
  </inputs>
  <outputs>
    <data format="png" name="output">
      <change_format>
	    <when input="imagetype" value="PDF" format="pdf" />
      </change_format>
    </data>
    <data format="txt" name="log" label="correlation job log" />
    <data format="txt" name="rscript" label="correlation job rscript" />
  </outputs>
  <expand macro="stdio"/>
  <tests>
    <test>
      <param name="wfile1" value="control.wig" />
      <param name="wlabel1" value="control" />
      <param name="wfile2" value="treatment.wig" />
      <param name="wlabel2" value="treatment" />
      <param name="step" value="100" />
      <param name="method" value="mean" />
      <param name="maxscore" value="10000" />
      <param name="minscore" value="-10000" />
      <param name="size" value="10" />
      <param name="imagetype" value="PDF" />
      <output name="log">
        <assert_contents>
            <has_text_matching expression="Please check tmp.r" />
        </assert_contents>
      </output>
    </test>
  </tests>
  <help>
This tool calculates the correlation coefficient values on the genome
scale using many scores datasets (many wiggle files). The tool is
written by Tao Liu. It calls R for plotting.

.. class:: warningmark

**NEED IMPROVEMENT**

-----

**Parameters**

- **Wiggle file 1 and 2** are the first two wiggle files to be
  included. These two are required.
- **Wiggle label 1 and 2** are the first two wiggle labels to be
  plotted in the correlation plot.
- **wiggle files** click *Add new wiggle file* to add more wiggle
  files and labels. 
- **Genome/Assembly** Genome assembly to be used. The tool will
  download the chromosome information from UCSC database.
- **Step** Step in kilo basepairs. The step is a window to extract the
  scores from wiggle files along the whole genome. So that every step
  size window will have a value to represent it by using certain **Method** 
- **Method** When scores are extracted for a step size window, a
  method will be applied to calculate a value to represent this
  window. Options are *median* to use the median value or *mean* to
  use the average value.
- **Max Score** is the maximum score in the calculation. It's
  optional.
- **Min Score** is the minimum score in the calculation. It's
  optional.

-----

**Outputs**

- **PNG file** is the correlation plot
- **LOG file** for job log. If you see errors, please attached this in
  the bug report

  </help>

</tool>