/tools/filters/grep.xml

https://bitbucket.org/ialbert/galaxy-genetrack · XML · 73 lines · 62 code · 11 blank · 0 comment · 0 complexity · 653fa6a5f120f1f6b12427aa1a7dd6bb MD5 · raw file

  1. <tool id="Grep1" name="Select">
  2. <description>lines that match an expression</description>
  3. <command interpreter="python">grep.py -i $input -o $out_file1 -pattern '$pattern' -v $invert</command>
  4. <inputs>
  5. <param format="txt" name="input" type="data" label="Select lines from"/>
  6. <param name="invert" type="select" label="that">
  7. <option value="false">Matching</option>
  8. <option value="true">NOT Matching</option>
  9. </param>
  10. <param name="pattern" size="40" type="text" value="^chr([0-9A-Za-z])+" label="the pattern" help="here you can enter text or regular expression (for syntax check lower part of this frame)"/>
  11. </inputs>
  12. <outputs>
  13. <data format="input" name="out_file1" metadata_source="input"/>
  14. </outputs>
  15. <tests>
  16. <test>
  17. <param name="input" value="1.bed"/>
  18. <param name="invert" value="false"/>
  19. <param name="pattern" value="^chr[0-9]*"/>
  20. <output name="out_file1" file="fs-grep.dat"/>
  21. </test>
  22. </tests>
  23. <help>
  24. .. class:: infomark
  25. **TIP:** If your data is not TAB delimited, use *Text Manipulation-&gt;Convert*
  26. -----
  27. **Syntax**
  28. The select tool searches the data for lines containing or not containing a match to the given pattern. Regular Expression is introduced in this tool. A Regular Expression is a pattern descibing a certain amount of text.
  29. - **( ) { } [ ] . * ? + \ ^ $** are all special characters. **\\** can be used to "escape" a special character, allowing that special character to be searched for.
  30. - **\\A** matches the beginning of a string(but not an internal line).
  31. - **\\d** matches a digit, same as [0-9].
  32. - **\\D** matches a non-digit.
  33. - **\\s** matches a whitespace character.
  34. - **\\S** matches anything BUT a whitespace.
  35. - **\\t** matches a tab.
  36. - **\\w** matches an alphanumeric character.
  37. - **\\W** matches anything but an alphanumeric character.
  38. - **(** .. **)** groups a particular pattern.
  39. - **\\Z** matches the end of a string(but not a internal line).
  40. - **{** n or n, or n,m **}** specifies an expected number of repetitions of the preceding pattern.
  41. - **{n}** The preceding item is matched exactly n times.
  42. - **{n,}** The preceding item ismatched n or more times.
  43. - **{n,m}** The preceding item is matched at least n times but not more than m times.
  44. - **[** ... **]** creates a character class. Within the brackets, single characters can be placed. A dash (-) may be used to indicate a range such as **a-z**.
  45. - **.** Matches any single character except a newline.
  46. - ***** The preceding item will be matched zero or more times.
  47. - **?** The preceding item is optional and matched at most once.
  48. - **+** The preceding item will be matched one or more times.
  49. - **^** has two meaning:
  50. - matches the beginning of a line or string.
  51. - indicates negation in a character class. For example, [^...] matches every character except the ones inside brackets.
  52. - **$** matches the end of a line or string.
  53. - **\|** Separates alternate possibilities.
  54. -----
  55. **Example**
  56. - **^chr([0-9A-Za-z])+** would match lines that begin with chromsomes, such as lines in a BED format file.
  57. - **(ACGT){1,5}** would match at least 1 "ACGT" and at most 5 "ACGT" consecutively.
  58. - **([^,][0-9]{1,3})(,[0-9]{3})\*** would match a large integer that is properly seperated with commas such as 23,078,651.
  59. - **(abc)|(def)** would match either "abc" or "def".
  60. - **^\\W+#** would match any line that is a comment.
  61. </help>
  62. </tool>