annotate grep.xml @ 8:fa7f88da29d7 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 369e40078146d00608d52205bb8cee66ae735b76-dirty
author bgruening
date Tue, 30 Jun 2015 16:20:05 -0400
parents d64eace4f9f3
children c78b1767db2b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
1 <tool id="tp_grep_tool" name="Search in textfiles" version="@BASE_VERSION@.0">
0
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
2 <description>(grep)</description>
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
3 <macros>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
4 <import>macros.xml</import>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
5 </macros>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
6 <expand macro="requirements">
0
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
7 <requirement type="package" version="2.14">gnu_grep</requirement>
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
8 </expand>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
9 <version_command>grep --version | head -n 1</version_command>
2
fc862d5bccaf Uploaded
bgruening
parents: 1
diff changeset
10 <command>
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
11 <![CDATA[
2
fc862d5bccaf Uploaded
bgruening
parents: 1
diff changeset
12 #if str($color) == "COLOR":
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
13 GREP_COLOR='1;34'
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
14 grep
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
15 --color=always
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
16 -P
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
17 -A $lines_after
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
18 -B $lines_before
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
19 $invert
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
20 $case_sensitive
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
21 -- "${url_paste}"
8
fa7f88da29d7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 369e40078146d00608d52205bb8cee66ae735b76-dirty
bgruening
parents: 7
diff changeset
22 '${infile}' | $__tool_directory__/ansi2html.sh > "${output}"
0
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
23 #else:
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
24 grep
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
25 -P
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
26 -A $lines_after
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
27 -B $lines_before
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
28 $invert
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
29 $case_sensitive
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
30 -- "${url_paste}"
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
31 '${infile}' | grep -v "^--$" > "${output}"
0
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
32 #end if
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
33
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
34 ##grep_wrapper.sh '$infile' '$output' '$url_paste' $color -A $lines_after -B $lines_before $invert $case_sensitive
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
35 ]]>
0
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
36 </command>
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
37 <inputs>
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
38 <param name="infile" format="txt" type="data" label="Select lines from" />
0
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
39
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
40 <param name="invert" type="select" label="that">
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
41 <option value="">Match</option>
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
42 <option value="-v">Don't Match</option>
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
43 </param>
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
44
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
45 <param name="url_paste" type="text" size="40" label="Regular Expression" help="See below for more details">
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
46 <sanitizer>
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
47 <valid initial="string.printable">
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
48 <remove value="&apos;"/>
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
49 </valid>
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
50 </sanitizer>
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
51 </param>
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
52
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
53 <param name="case_sensitive" type="select" label="Match type" help="(-i)">
0
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
54 <option value="-i">case insensitive</option>
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
55 <option value="">case sensitive</option>
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
56 </param>
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
57 <param name="lines_before" type="integer" value="0"
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
58 label="Show lines preceding the matched line" help="leave it at zero unless you know what you're doing. (-B)" />
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
59 <param name="lines_after" type="integer" value="0"
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
60 label="Show lines trailing the matched line" help="leave it at zero unless you know what you're doing. (-A)" />
0
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
61 <param name="color" type="select" label="Output">
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
62 <option value="NOCOLOR">text file (for further processing)</option>
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
63 <option value="COLOR">Highlighted HTML (for easier viewing)</option>
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
64 </param>
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
65
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
66 </inputs>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
67 <outputs>
6
8928e6d1e7ba Uploaded
bgruening
parents: 4
diff changeset
68 <data name="output" format_source="infile" metadata_source="infile">
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
69 <change_format>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
70 <when input="color" value="COLOR" format="html"/>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
71 </change_format>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
72 </data>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
73 </outputs>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
74 <tests>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
75 <test>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
76 <!-- grep a FASTA file for sequences with specific motif -->
6
8928e6d1e7ba Uploaded
bgruening
parents: 4
diff changeset
77 <param name="infile" value="grep1.txt" />
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
78 <param name="case_sensitive" value="case sensitive" />
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
79 <param name="invert" value="" />
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
80 <param name="url_paste" value="AA.{2}GT" />
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
81 <param name="lines_before" value="1" />
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
82 <param name="lines_after" value="0" />
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
83 <param name="color" value="NOCOLOR" />
6
8928e6d1e7ba Uploaded
bgruening
parents: 4
diff changeset
84 <output name="output" file="grep_results1.txt" />
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
85 </test>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
86 <test>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
87 <!-- grep a FASTA file for sequences with specific motif -
0
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
88 show highlighed output -->
6
8928e6d1e7ba Uploaded
bgruening
parents: 4
diff changeset
89 <param name="infile" value="grep1.txt" />
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
90 <param name="case_sensitive" value="case sensitive" />
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
91 <param name="invert" value="" />
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
92 <param name="url_paste" value="AA.{2}GT" />
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
93 <param name="lines_before" value="0" />
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
94 <param name="lines_after" value="0" />
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
95 <param name="color" value="COLOR" />
6
8928e6d1e7ba Uploaded
bgruening
parents: 4
diff changeset
96 <output name="output" file="grep_results2.html" />
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
97 </test>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
98 </tests>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
99 <help>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
100 <![CDATA[
0
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
101 **What it does**
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
102
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
103 This tool runs the unix **grep** command on the selected data file.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
104
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
105 .. class:: infomark
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
106
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
107 **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).
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
108
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
109
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
110 **Further reading**
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
111
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
112 - Wikipedia's Regular Expression page (http://en.wikipedia.org/wiki/Regular_expression)
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
113 - Regular Expressions cheat-sheet (PDF) (http://www.addedbytes.com/cheat-sheets/download/regular-expressions-cheat-sheet-v2.pdf)
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
114 - Grep Tutorial (http://www.panix.com/~elflord/unix/grep.html)
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
115
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
116 -----
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
117
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
118 **Grep Examples**
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
119
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
120 - **AGC.AAT** would match lines with AGC followed by any character, followed by AAT (e.g. **AGCQAAT**, **AGCPAAT**, **AGCwAAT**)
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
121 - **C{2,5}AGC** would match lines with 2 to 5 consecutive Cs followed by AGC
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
122 - **TTT.{4,10}AAA** would match lines with 3 Ts, followed by 4 to 10 characters (any characeters), followed by 3 As.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
123 - **^chr([0-9A-Za-z])+** would match lines that begin with chromsomes, such as lines in a BED format file.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
124 - **(ACGT){1,5}** would match at least 1 "ACGT" and at most 5 "ACGT" consecutively.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
125 - **hsa|mmu** would match lines containing "hsa" or "mmu" (or both).
7
d64eace4f9f3 Uploaded
bgruening
parents: 6
diff changeset
126
0
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
127 -----
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
128
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
129 **Regular Expression Syntax**
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
130
7
d64eace4f9f3 Uploaded
bgruening
parents: 6
diff changeset
131 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.
0
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
132
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
133 - **( ) { } [ ] . * ? + \ ^ $** are all special characters. **\\** can be used to "escape" a special character, allowing that special character to be searched for.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
134 - **^** matches the beginning of a string(but not an internal line).
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
135 - **\\d** matches a digit, same as [0-9].
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
136 - **\\D** matches a non-digit.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
137 - **\\s** matches a whitespace character.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
138 - **\\S** matches anything BUT a whitespace.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
139 - **\\t** matches a tab.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
140 - **\\w** matches an alphanumeric character ( A to Z, 0 to 9 and underscore )
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
141 - **\\W** matches anything but an alphanumeric character.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
142 - **(** .. **)** groups a particular pattern.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
143 - **\\Z** matches the end of a string(but not a internal line).
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
144 - **{** n or n, or n,m **}** specifies an expected number of repetitions of the preceding pattern.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
145
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
146 - **{n}** The preceding item is matched exactly n times.
7
d64eace4f9f3 Uploaded
bgruening
parents: 6
diff changeset
147 - **{n,}** The preceding item ismatched n or more times.
d64eace4f9f3 Uploaded
bgruening
parents: 6
diff changeset
148 - **{n,m}** The preceding item is matched at least n times but not more than m times.
0
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
149
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
150 - **[** ... **]** 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**.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
151 - **.** Matches any single character except a newline.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
152 - ***** The preceding item will be matched zero or more times.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
153 - **?** The preceding item is optional and matched at most once.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
154 - **+** The preceding item will be matched one or more times.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
155 - **^** has two meaning:
7
d64eace4f9f3 Uploaded
bgruening
parents: 6
diff changeset
156 - matches the beginning of a line or string.
0
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
157 - indicates negation in a character class. For example, [^...] matches every character except the ones inside brackets.
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
158 - **$** matches the end of a line or string.
7
d64eace4f9f3 Uploaded
bgruening
parents: 6
diff changeset
159 - **\|** Separates alternate possibilities.
0
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
160
4
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
161 @REFERENCES@
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
162 ]]>
56e80527c482 Uploaded
bgruening
parents: 3
diff changeset
163 </help>
0
ec66f9d90ef0 initial uploaded
bgruening
parents:
diff changeset
164 </tool>