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