/tools/liftover/bed_chrom.xml

https://bitbucket.org/cistrome/cistrome-harvard/ · XML · 67 lines · 55 code · 12 blank · 0 comment · 0 complexity · ad0c502f0a3348563a149087006b2074 MD5 · raw file

  1. <tool name="Extract data from Bed" id="bed_for_chrom">
  2. <description>Extract data for certain chromosome from a BED file</description>
  3. <command interpreter="command">/bin/bash $shscript</command>
  4. <inputs>
  5. <param ftype="bed" format="bed" name="bfile" type="data" label="BED file"/>
  6. <param name="chrom" type="text" label="Chromosome" optional="false" />
  7. </inputs>
  8. <outputs>
  9. <data format="bed" name="output" />
  10. </outputs>
  11. <configfiles>
  12. <configfile name="shscript">
  13. #!/bin/bash
  14. #set $dollar = chr(36)
  15. #set $gt = chr(62)
  16. #set $lt = chr(60)
  17. #set $ad = chr(38)
  18. #set $up = chr(94)
  19. chromlength=`echo $chrom |awk '{print length(${dollar}0)}'`
  20. if [[ ${dollar}chromlength -gt 255 ]];then
  21. echo "Chromosome exceed the limit of 255 characters!" ${gt}${ad}2;
  22. exit;
  23. fi
  24. if [[ ${dollar}chromlength -eq 0 ]];then
  25. echo "Chromosome is required!" ${gt}${ad}2;
  26. exit;
  27. fi
  28. grep -w ${up}${chrom} $bfile ${ad}${gt} $output
  29. </configfile>
  30. </configfiles>
  31. <tests>
  32. <test maxseconds="3600" name="BedExtract_1">
  33. <param name="bfile" value="bedfile.bed" />
  34. <param name="chrom" value="chrX" />
  35. <output name="output" file="bedextract_1/bedextract_1.bed" />
  36. </test>
  37. <test maxseconds="3600" name="BedExtract_2">
  38. <param name="bfile" value="bedfile.bed" />
  39. <param name="chrom" value="chr1" />
  40. <output name="output" file="bedextract_2/bedextract_2.bed" />
  41. </test>
  42. </tests>
  43. <help>
  44. This tool can extract the scores for a certain chromosome with a big
  45. BED file.
  46. -----
  47. **Parameters**
  48. - **BED file** is selected from history.
  49. - **Chromosome** on which the regions will be extracted from the BED
  50. file.
  51. -----
  52. **Output**
  53. - **BED file** only contains the scores for a certain chromosome.
  54. </help>
  55. </tool>