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