|
0
|
1 <tool id="cshl_grep_tool" name="grep" version="0.1.1">
|
|
|
2 <description></description>
|
|
|
3 <command interpreter="sh">grep_wrapper.sh '$input1' '$output' '$url_paste' $color -A $lines_after -B $lines_before $invert $case_sensitive</command>
|
|
|
4 <inputs>
|
|
|
5 <param format="txt" name="input1" type="data" label="Select lines from" />
|
|
|
6
|
|
|
7 <param name="invert" type="select" label="that">
|
|
|
8 <option value="">Match</option>
|
|
|
9 <option value="-v">Don't Match</option>
|
|
|
10 </param>
|
|
|
11
|
|
|
12 <param name="url_paste" type="text" size="40" label="Regular Expression" help="See below for more details">
|
|
|
13 <sanitizer>
|
|
|
14 <valid initial="string.printable">
|
|
|
15 <remove value="'"/>
|
|
|
16 </valid>
|
|
|
17 </sanitizer>
|
|
|
18 </param>
|
|
|
19
|
|
|
20 <param name="case_sensitive" type="select" label="Match type">
|
|
|
21 <option value="-i">case insensitive</option>
|
|
|
22 <option value="">case sensitive</option>
|
|
|
23 </param>
|
|
|
24
|
|
|
25 <param name="lines_before" type="integer" label="Show lines preceding the matched line (-B)" help="leave it at zero unless you know what you're doing" value="0" />
|
|
|
26 <param name="lines_after" type="integer" label="Show lines trailing the matched line (-A)" help="leave it at zero unless you know what you're doing" value="0" />
|
|
|
27
|
|
|
28 <param name="color" type="select" label="Output">
|
|
|
29 <option value="NOCOLOR">text file (for further processing)</option>
|
|
|
30 <option value="COLOR">Highlighted HTML (for easier viewing)</option>
|
|
|
31 </param>
|
|
|
32
|
|
|
33 </inputs>
|
|
|
34 <outputs>
|
|
|
35 <data format="input" name="output" metadata_source="input1"
|
|
|
36 >
|
|
|
37 <change_format>
|
|
|
38 <when input="color" value="COLOR" format="html"
|
|
|
39 />
|
|
|
40 </change_format>
|
|
|
41 </data>
|
|
|
42 </outputs>
|
|
|
43 <help>
|
|
|
44
|
|
|
45 **What it does**
|
|
|
46
|
|
|
47 This tool runs the unix **grep** command on the selected data file.
|
|
|
48
|
|
|
49 .. class:: infomark
|
|
|
50
|
|
|
51 **TIP:** This tool uses the **perl** regular expression syntax (same as running 'grep -P'). This is **NOT** the POSIX or POSIX-extended syntax (unlike the awk/sed tools).
|
|
|
52
|
|
|
53
|
|
|
54 **Further reading**
|
|
|
55
|
|
|
56 - Wikipedia's Regular Expression page (http://en.wikipedia.org/wiki/Regular_expression)
|
|
|
57 - Regular Expressions cheat-sheet (PDF) (http://www.addedbytes.com/cheat-sheets/download/regular-expressions-cheat-sheet-v2.pdf)
|
|
|
58 - Grep Tutorial (http://www.panix.com/~elflord/unix/grep.html)
|
|
|
59
|
|
|
60 -----
|
|
|
61
|
|
|
62 **Grep Examples**
|
|
|
63
|
|
|
64 - **AGC.AAT** would match lines with AGC followed by any character, followed by AAT (e.g. **AGCQAAT**, **AGCPAAT**, **AGCwAAT**)
|
|
|
65 - **C{2,5}AGC** would match lines with 2 to 5 consecutive Cs followed by AGC
|
|
|
66 - **TTT.{4,10}AAA** would match lines with 3 Ts, followed by 4 to 10 characters (any characeters), followed by 3 As.
|
|
|
67 - **^chr([0-9A-Za-z])+** would match lines that begin with chromsomes, such as lines in a BED format file.
|
|
|
68 - **(ACGT){1,5}** would match at least 1 "ACGT" and at most 5 "ACGT" consecutively.
|
|
|
69 - **hsa|mmu** would match lines containing "hsa" or "mmu" (or both).
|
|
|
70
|
|
|
71 -----
|
|
|
72
|
|
|
73 **Regular Expression Syntax**
|
|
|
74
|
|
|
75 The select tool searches the data for lines containing or not containing a match to the given pattern. A Regular Expression is a pattern descibing a certain amount of text.
|
|
|
76
|
|
|
77 - **( ) { } [ ] . * ? + \ ^ $** are all special characters. **\\** can be used to "escape" a special character, allowing that special character to be searched for.
|
|
|
78 - **^** matches the beginning of a string(but not an internal line).
|
|
|
79 - **\\d** matches a digit, same as [0-9].
|
|
|
80 - **\\D** matches a non-digit.
|
|
|
81 - **\\s** matches a whitespace character.
|
|
|
82 - **\\S** matches anything BUT a whitespace.
|
|
|
83 - **\\t** matches a tab.
|
|
|
84 - **\\w** matches an alphanumeric character ( A to Z, 0 to 9 and underscore )
|
|
|
85 - **\\W** matches anything but an alphanumeric character.
|
|
|
86 - **(** .. **)** groups a particular pattern.
|
|
|
87 - **\\Z** matches the end of a string(but not a internal line).
|
|
|
88 - **{** n or n, or n,m **}** specifies an expected number of repetitions of the preceding pattern.
|
|
|
89
|
|
|
90 - **{n}** The preceding item is matched exactly n times.
|
|
|
91 - **{n,}** The preceding item ismatched n or more times.
|
|
|
92 - **{n,m}** The preceding item is matched at least n times but not more than m times.
|
|
|
93
|
|
|
94 - **[** ... **]** 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**.
|
|
|
95 - **.** Matches any single character except a newline.
|
|
|
96 - ***** The preceding item will be matched zero or more times.
|
|
|
97 - **?** The preceding item is optional and matched at most once.
|
|
|
98 - **+** The preceding item will be matched one or more times.
|
|
|
99 - **^** has two meaning:
|
|
|
100 - matches the beginning of a line or string.
|
|
|
101 - indicates negation in a character class. For example, [^...] matches every character except the ones inside brackets.
|
|
|
102 - **$** matches the end of a line or string.
|
|
|
103 - **\|** Separates alternate possibilities.
|
|
|
104
|
|
|
105
|
|
|
106 </help>
|
|
|
107 </tool>
|