PageRenderTime 41ms CodeModel.GetById 28ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/tools/ceas/conservation.xml

https://bitbucket.org/cistrome/cistrome-harvard/
XML | 170 lines | 144 code | 26 blank | 0 comment | 0 complexity | 045e3c32f2c0a6384ffcfe3b2cf33a62 MD5 | raw file
  1<tool name="Conservation Plot" id="ceas_conservation">
  2  <description>Calculates the PhastCons scores in several intervals sets</description>
  3  <command interpreter="command">/bin/bash $shscript</command>
  4  <inputs>
  5
  6    <repeat name="more" title="interval file">
  7      <param ftype="interval" format="bed,interval" name="bfile" type="data" label="Select another interval file(100,000 lines max)"/>
  8      <param name="blabel" type="text" label="BED file label"
  9      help="label on the figure" optional="false"/>
 10    </repeat>
 11
 12    <param name="size" type="integer" label="window size around the center" value="3000">
 13    	<validator type="in_range" max="10000" min="100" message="window size is out of range, window size has to be between 100 to 10000" />
 14    </param>
 15    <param name="gv" type="select" label="UCSC genome/assembly version">
 16      <option value="hg38">hg38</option>
 17      <option value="hg19/placentalMammals">hg19 (placental mammals)</option>
 18      <option value="hg19/vertebrate">hg19 (vertebrate)</option>
 19      <option value="hg18/placentalMammals">hg18 (placental mammals)</option>
 20      <option value="hg18/vertebrate">hg18 (vertebrate)</option>
 21      <option value="mm10/placental">mm10 (placental)</option>
 22      <option value="mm9/placental">mm9 (placental)</option>
 23      <option value="mm9/vertebrate">mm9 (vertebrate)</option>
 24      <option value="mm8/vertebrate">mm8 (vertebrate)</option>
 25      <option value="dm3">dm3</option>
 26      <option value="danRer7">danRer7 (vertebrate)</option>
 27      <option value="ce10">ce10</option>
 28      <option value="ce6">ce6</option>
 29      <option value="ce4">ce4</option>
 30    </param>
 31    <param type="select" name="imagetype" display="radio" label="Image Type">
 32      <option value="PDF">PDF format</option>
 33      <option value="PNG">PNG format</option>
 34    </param>
 35  </inputs>
 36  <outputs>
 37    <data format="png" name="output">
 38      <change_format>
 39	<when input="imagetype" value="PDF" format="pdf" />
 40      </change_format>
 41    </data>
 42    <data format="txt" name="outputr" label="conservation R script" />
 43    <data format="txt" name="log" label="conservation job log"/>
 44  </outputs>
 45  <configfiles>
 46    <configfile name="shscript">
 47#!/bin/bash
 48#import os
 49
 50#set $dollar = chr(36)
 51#set $gt = chr(62)
 52#set $lt = chr(60)
 53#set $ad = chr(38)
 54#set $tmp = ""
 55#set $bedcount = 0
 56
 57#set $path = $os.path.abspath($__app__.config.tool_path)
 58
 59#for $m in $more
 60#set $bedcount = $bedcount + 1 
 61   lines=`wc -l $m.bfile | tail -1 | awk '{print ${dollar}1}'`
 62   format=`$path/validation/fcfunc.py $m.bfile`
 63   if [[ ${dollar}lines -gt 100000 ]];then
 64      echo "BED file is too big! 100K lines are the maximum!" ${gt}${ad}2
 65      exit;
 66   fi
 67   if [[ ${dollar}format != "passed" ]]; then
 68      echo "Bed file ${bedcount}: "${dollar}format ${gt}${ad}2
 69      exit;
 70   fi
 71   
 72   bedlabel=`echo $m.blabel |awk '{print length(${dollar}0)}'`
 73   if [[ ${dollar}bedlabel -gt 255 ]];then
 74       echo "Bed Label exceed the limit of 255 characters!" ${gt}${ad}2;
 75       exit;
 76   fi
 77   if [[ ${dollar}bedlabel -eq 0 ]];then
 78       echo "Bed Label is required!" ${gt}${ad}2;
 79       exit;
 80   fi
 81#set $tmp = $tmp + str($m.bfile) + " -l '" + str($m.blabel) + "' "
 82#end for
 83
 84if [[ $bedcount -eq 0 ]];then
 85    echo "Need at least one bed file" ${gt}${ad}2
 86    exit;
 87fi
 88
 89#set $datapath = os.path.join( os.path.abspath($__app__.config.cistrome_static_library_path), "conservation", $gv.value )
 90
 91conservation_plot.py -d $datapath -w $size $tmp ${ad}${gt} $log
 92
 93if [ $imagetype.value == "PNG" ]; then
 94convert tmp.pdf tmp.png
 95mv tmp.png $output
 96else
 97mv tmp.pdf $output
 98fi
 99mv tmp.R $outputr
100
101    </configfile>
102  </configfiles>
103<tests>
104  <test maxseconds="3600" name="Conservation_1">
105    <param name="bfile" value="bedfile.bed" />
106    <param name="blabel" value="conservation_1" />
107    <param name="size" value="1000" />
108    <param name="gv" value="ce6" />
109    <output name="output" file="conservation_1/conservation_1.bmp" />
110    <output name="output" file="conservation_1/conservation_1.log" lines_diff = "200" />
111  </test>
112</tests>
113  <help>
114This tool plots the PhastCons scores prfiles in several BED
115files. It's based on conservation_plot.py script in Tao Liu's
116library. Original code is written by Ying Lei, then modified by
117Jaqueline Wentz.
118
119.. class:: infomark
120
121**Tip:** If you see red Xs, check the BED input file first. Perhaps, the BED file contains some abnormal chromosome names.  
122
123.. class:: infomark
124
125**Tip:** For best performance, please make sure the regions in the BED file are centered at peak summits.
126
127-----
128
129**Parameters**
130
131- **Title** Conservation Plot Tool
132- **Interval file** is a BED file normally centered at peak summit. 
133- **BED file label** is the label marked in the legend of the final figure.
134- **more** You can add more BED files and labels.
135- **Window size** is the regions around peak centers to extract PhastCons scores.
136- **UCSC genome version** must be selected according to your BED files.
137
138-----
139
140**script parameter list for conservation_plot.py**
141
142conservation_plot.py
143
144Draw conservation plot for many bed files.
145
146Options:
147  --version             show program's version number and exit
148  -H HEIGHT, --height=HEIGHT
149                        height of plot
150  -W WIDTH, --width=WIDTH
151                        width of plot
152  -w W                  window width centered at middle of bed
153                        regions,default: 1000
154  -t TITLE, --title=TITLE
155                        title of the figure. Default: 'Average Phastcons
156                        around the Center of Sites'
157  -d PHASDB, --phasdb=PHASDB
158                        The directory to store phastcons scores in the server
159  -l BEDLABEL, --bed-label=BEDLABEL
160                        the BED file labels in the figure. No space is
161                        allowed. This option should be used same times as -w
162                        option, and please input them in the same order as BED
163                        files. default: will use the BED file filename as
164                        labels.
165  -h, --help            Show this help message and exit.
166
167
168  </help>
169
170</tool>