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