changeset 3:f404ec7f679c

Add Conservation Plot tool
author Jim Johnson <jj@umn.edu>
date Wed, 17 Dec 2014 15:09:37 -0600
parents 45e094f8858f
children e426a7a39562
files conservation.xml repository_dependencies.xml sitepro.xml test-data/hg19_phasdb.zip tool-data/cistrome_conservation.loc.sample tool_data_table_conf.xml.sample
diffstat 6 files changed, 174 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/conservation.xml	Wed Dec 17 15:09:37 2014 -0600
@@ -0,0 +1,140 @@
+<tool name="Conservation Plot" id="ceas_conservation">
+  <description>Calculates the PhastCons scores in several intervals sets</description>
+  <version_command>conservation_plot.py --version</version_command>
+  <macros>
+    <import>ceas_macros.xml</import>
+  </macros>
+  <expand macro="requirements_bx" />
+  <stdio>
+    <exit_code range="1:"  level="fatal"   description="Failed" />
+  </stdio>
+  <command>
+conservation_plot.py 
+#if $phastcons.phastcons_src == 'cached':
+ -d "${phastcons.gv.fields.path}"
+#else:
+ -d "$phastcons.phasdb.extra_files_path"
+#end if
+-w $size 
+#if $inputs.labeling == 'auto':
+  #echo str($inputs.bfiles).replace(',',' ')
+#else
+ #for $m in $inputs.more
+   $m.bfile  -l "$m.blabel"
+ #end for
+#end if
+&amp;&gt;  $log
+  </command>
+  <inputs>
+    <conditional name="inputs">
+      <param name="labeling" type="select" label="input bed files">
+        <option value="auto">automatically labeled inputs</option>
+        <option value="manual">user labeled inputs</option>
+      </param>
+      <when value="auto">
+        <param name="bfiles" type="data" format="interval" label="bed files" multiple="true"/>
+      </when>
+      <when value="auto">
+        <repeat name="more" title="interval file" min="1">
+          <param name="bfile" type="data" format="interval" label="Select another interval file(100,000 lines max)"/>
+          <param name="blabel" type="text" label="BED file label" help="label on the figure" optional="false"/>
+        </repeat>
+      </when>
+    </conditional>
+    <param name="size" type="integer" label="window size around the center" value="3000">
+    	<validator type="in_range" max="10000" min="100" message="window size is out of range, window size has to be between 100 to 10000" />
+    </param>
+    <conditional name="phastcons">
+      <param name="phastcons_src" type="select" label="Source for phasdb phastcons scores">
+        <option value="cached" selected="true">A builtin phasdb</option>
+        <option value="history">A phasdb from your history</option>
+      </param>
+      <when value="cached">
+        <param name="gv" type="select" label="PHASDB - UCSC genome/assembly version">
+          <options from_data_table="cistrome_conservation">
+            <filter type="unique_value" column="0" />
+          </options>
+        </param>
+      </when>
+      <when value="history">
+        <param name="phasdb" type="data" format="cistrome_phasdb" label="PHASDB phastcons scores"/>
+      </when>
+    </conditional>
+  </inputs>
+  <outputs>
+    <data name="output" format="pdf" from_work_dir="tmp.pdf" />
+    <data name="log" format="txt" label="conservation job log"/>
+  </outputs>
+<tests>
+  <test>
+    <param name="labeling" value="auto"/>
+    <param name="bfile" value="peaks.bed" />
+    <param name="blabel" value="conservation_1" />
+    <param name="size" value="1000" />
+    <param name="phastcons_src" value="history"/>
+    <param name="phasdb" value="hg19_phasdb.zip" ftype="cistrome_phasdb" />
+    <output name="log">
+        <assert_contents>
+          <has_text_matching expression="extract phastcons scores" />
+        </assert_contents>
+    </output>
+  </test>
+</tests>
+  <help>
+This tool plots the PhastCons scores prfiles in several BED
+files. It's based on conservation_plot.py script in Tao Liu's
+library. Original code is written by Ying Lei, then modified by
+Jaqueline Wentz.
+
+.. class:: infomark
+
+**Tip:** If you see red Xs, check the BED input file first. Perhaps, the BED file contains some abnormal chromosome names.  
+
+.. class:: infomark
+
+**Tip:** For best performance, please make sure the regions in the BED file are centered at peak summits.
+
+-----
+
+**Parameters**
+
+- **Title** Conservation Plot Tool
+- **Interval file** is a BED file normally centered at peak summit. 
+- **BED file label** is the label marked in the legend of the final figure.
+- **more** You can add more BED files and labels.
+- **Window size** is the regions around peak centers to extract PhastCons scores.
+- **UCSC genome version** must be selected according to your BED files.
+
+-----
+
+**script parameter list for conservation_plot.py**
+
+conservation_plot.py
+
+Draw conservation plot for many bed files.
+
+Options:
+  --version             show program's version number and exit
+  -H HEIGHT, --height=HEIGHT
+                        height of plot
+  -W WIDTH, --width=WIDTH
+                        width of plot
+  -w W                  window width centered at middle of bed
+                        regions,default: 1000
+  -t TITLE, --title=TITLE
+                        title of the figure. Default: 'Average Phastcons
+                        around the Center of Sites'
+  -d PHASDB, --phasdb=PHASDB
+                        The directory to store phastcons scores in the server
+  -l BEDLABEL, --bed-label=BEDLABEL
+                        the BED file labels in the figure. No space is
+                        allowed. This option should be used same times as -w
+                        option, and please input them in the same order as BED
+                        files. default: will use the BED file filename as
+                        labels.
+  -h, --help            Show this help message and exit.
+
+
+  </help>
+
+</tool>
--- a/repository_dependencies.xml	Mon Dec 15 15:31:58 2014 -0600
+++ b/repository_dependencies.xml	Wed Dec 17 15:09:37 2014 -0600
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
 <repositories description="This requires the ceasdb datatype definition.">
   <repository changeset_revision="981be3387e67" name="ceas_datatypes" owner="jjohnson" toolshed="https://testtoolshed.g2.bx.psu.edu" />
+  <repository changeset_revision="b23d89433ee4" name="cistrome_phasdb_datatypes" owner="jjohnson" toolshed="https://testtoolshed.g2.bx.psu.edu" />
 </repositories>
--- a/sitepro.xml	Mon Dec 15 15:31:58 2014 -0600
+++ b/sitepro.xml	Wed Dec 17 15:09:37 2014 -0600
@@ -1,9 +1,13 @@
 <tool id="ceas_sitepro" name="SitePro: Score profile near Intervals" version="0.1.0">
   <description>Draw the score profile near a given interval</description>
+  <version_command>sitepro --version</version_command>
   <macros>
     <import>ceas_macros.xml</import>
   </macros>
   <expand macro="requirements" />
+  <stdio>
+    <exit_code range="1:"  level="fatal"   description="Failed" />
+  </stdio>
   <command>
 sitepro 
 #if $mode.mode_select == "single"
@@ -20,7 +24,7 @@
   -b "$m.bfile" -l "$m.label"
  #end for
 #end if
---span=$span --pf-res=$pfres --name=$name --dump &amp;> $log  
+--span=$span --pf-res=$pfres --name=$name --dump &amp;> $log   &amp;&amp;
 cat *_dump.txt > $dump
   </command>
   <inputs>
Binary file test-data/hg19_phasdb.zip has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool-data/cistrome_conservation.loc.sample	Wed Dec 17 15:09:37 2014 -0600
@@ -0,0 +1,17 @@
+##  Conservation score files
+# Instructions from: https://bitbucket.org/cistrome/cistrome-harvard/wiki/Tutorial_for_Cistrome_AP_installation
+# Get the cistrome static data: 
+#   http://cistrome.org/aspera/user/?B=%2FCISTROME_STATIC_LIBRARIES 
+#   (send email to cistrome-bugs@jimmy.harvard.edu for a password to download.)
+#
+#unique_build_id	dbkey	name	path
+#ce4	ce4	ce4	/depot/cistrome_static_lib/conservation/ce4
+#ce6	ce6	ce6	/depot/cistrome_static_lib/conservation/ce6
+#dm3	dm3	dm3	/depot/cistrome_static_lib/conservation/dm3
+#hg18/placentalMammals	hg18	hg18/placentalMammals	/depot/cistrome_static_lib/conservation/hg18/placentalMammals
+#hg18/vertebrate	hg18	hg18/vertebrate	/depot/cistrome_static_lib/conservation/hg18/vertebrate
+#hg19/placentalMammals	hg19/placentalMammals	hg19/placentalMammals	/depot/cistrome_static_lib/conservation/hg19/placentalMammals
+#hg19/vertebrate	hg19	hg19/vertebrate	/depot/cistrome_static_lib/conservation/hg19/vertebrate
+#mm8/vertebrate	mm8	mm8/vertebrate	/depot/cistrome_static_lib/conservation/mm8/vertebrate
+#mm9/placental	mm9	mm9/placental	/depot/cistrome_static_lib/conservation/mm9/placental
+#mm9/vertebrate	mm9	mm9/vertebrate	/depot/cistrome_static_lib/conservation/mm9/vertebrate
--- a/tool_data_table_conf.xml.sample	Mon Dec 15 15:31:58 2014 -0600
+++ b/tool_data_table_conf.xml.sample	Wed Dec 17 15:09:37 2014 -0600
@@ -4,5 +4,16 @@
         <columns>value, dbkey, name, path</columns>
         <file path="tool-data/ceasdb.loc" />
     </table>
+    <!-- Locations of cistrome conservation reference files under genome directory -->
+    <!-- 
+      To get all the static data: http://cistrome.org/aspera/user/?B=%2FCISTROME_STATIC_LIBRARIES 
+      ( send email to cistrome-bugs@jimmy.harvard.edu for a password to download. )
+      From documentation on: https://bitbucket.org/cistrome/cistrome-harvard/wiki/Tutorial_for_Cistrome_AP_installation
+    -->
+    <table name="cistrome_conservation" comment_char="#">
+        <columns>value, dbkey, name, path</columns>
+        <file path="tool-data/cistrome_conservation.loc" />
+    </table>
+
 </tables>