annotate tools/filters/grep.xml @ 0:9071e359b9a3

Uploaded
author xuebing
date Fri, 09 Mar 2012 19:37:19 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
1 <tool id="Grep1" name="Select" version="1.0.1">
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
2 <description>lines that match an expression</description>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
3 <command interpreter="python">grep.py -i $input -o $out_file1 -pattern '$pattern' -v $invert</command>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
4 <inputs>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
5 <param format="txt" name="input" type="data" label="Select lines from"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
6 <param name="invert" type="select" label="that">
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
7 <option value="false">Matching</option>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
8 <option value="true">NOT Matching</option>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
9 </param>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
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)">
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
11 <sanitizer>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
12 <valid initial="string.printable">
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
13 <remove value="&apos;"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
14 </valid>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
15 <mapping initial="none">
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
16 <add source="&apos;" target="__sq__"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
17 </mapping>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
18 </sanitizer>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
19 </param>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
20 </inputs>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
21 <outputs>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
22 <data format="input" name="out_file1" metadata_source="input"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
23 </outputs>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
24 <tests>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
25 <test>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
26 <param name="input" value="1.bed"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
27 <param name="invert" value="false"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
28 <param name="pattern" value="^chr[0-9]*"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
29 <output name="out_file1" file="fs-grep.dat"/>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
30 </test>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
31 </tests>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
32 <help>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
33
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
34 .. class:: infomark
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
35
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
36 **TIP:** If your data is not TAB delimited, use *Text Manipulation-&gt;Convert*
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
37
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
38 -----
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
39
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
40 **Syntax**
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
41
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
42 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 describing a certain amount of text.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
43
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
44 - **( ) { } [ ] . * ? + \ ^ $** are all special characters. **\\** can be used to "escape" a special character, allowing that special character to be searched for.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
45 - **\\A** matches the beginning of a string(but not an internal line).
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
46 - **\\d** matches a digit, same as [0-9].
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
47 - **\\D** matches a non-digit.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
48 - **\\s** matches a whitespace character.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
49 - **\\S** matches anything BUT a whitespace.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
50 - **\\t** matches a tab.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
51 - **\\w** matches an alphanumeric character.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
52 - **\\W** matches anything but an alphanumeric character.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
53 - **(** .. **)** groups a particular pattern.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
54 - **\\Z** matches the end of a string(but not a internal line).
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
55 - **{** n or n, or n,m **}** specifies an expected number of repetitions of the preceding pattern.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
56
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
57 - **{n}** The preceding item is matched exactly n times.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
58 - **{n,}** The preceding item is matched n or more times.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
59 - **{n,m}** The preceding item is matched at least n times but not more than m times.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
60
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
61 - **[** ... **]** 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**.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
62 - **.** Matches any single character except a newline.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
63 - ***** The preceding item will be matched zero or more times.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
64 - **?** The preceding item is optional and matched at most once.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
65 - **+** The preceding item will be matched one or more times.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
66 - **^** has two meaning:
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
67 - matches the beginning of a line or string.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
68 - indicates negation in a character class. For example, [^...] matches every character except the ones inside brackets.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
69 - **$** matches the end of a line or string.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
70 - **\|** Separates alternate possibilities.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
71
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
72 -----
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
73
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
74 **Example**
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
75
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
76 - **^chr([0-9A-Za-z])+** would match lines that begin with chromosomes, such as lines in a BED format file.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
77 - **(ACGT){1,5}** would match at least 1 "ACGT" and at most 5 "ACGT" consecutively.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
78 - **([^,][0-9]{1,3})(,[0-9]{3})\*** would match a large integer that is properly separated with commas such as 23,078,651.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
79 - **(abc)|(def)** would match either "abc" or "def".
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
80 - **^\\W+#** would match any line that is a comment.
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
81 </help>
9071e359b9a3 Uploaded
xuebing
parents:
diff changeset
82 </tool>