Mercurial > repos > bgruening > text_processing
annotate find_and_replace.xml @ 25:cd83b5644eab draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
author | bgruening |
---|---|
date | Sat, 08 Oct 2022 20:59:15 +0000 |
parents | 0e3b611245f7 |
children | f22a309187a3 |
rev | line source |
---|---|
25
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
1 <tool id="tp_find_and_replace" name="Replace" version="@BASE_VERSION@.4"> |
2 | 2 <description>parts of text</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:
10
diff
changeset
|
6 <requirements> |
15
74aae7d6cb09
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 3103ebed1a420c7d3415b67ef532ea579edf9faa
bgruening
parents:
14
diff
changeset
|
7 <requirement type="package" version="5.22.0.1">perl</requirement> |
13
3c685c4106b3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b9d202134c3c6d0e5c398c3ae75e410067fcfc52
bgruening
parents:
10
diff
changeset
|
8 </requirements> |
3c685c4106b3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b9d202134c3c6d0e5c398c3ae75e410067fcfc52
bgruening
parents:
10
diff
changeset
|
9 <command> |
4 | 10 <![CDATA[ |
25
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
11 #for $i, $el in enumerate($find_and_replace) |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
12 #if $i == (len($find_and_replace) - 1) |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
13 #set $join = "" |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
14 #else |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
15 #set $join = "|" |
0 | 16 #end if |
25
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
17 perl '$__tool_directory__/find_and_replace' |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
18 #if $el.searchwhere.searchwhere_select == "column": |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
19 -c $el.searchwhere.column |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
20 #end if |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
21 #if $i == (len($find_and_replace) - 1) |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
22 -o '$outfile' |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
23 #end if |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
24 $el.global |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
25 $el.caseinsensitive |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
26 $el.wholewords |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
27 $el.skip_first_line |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
28 $el.is_regex |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
29 '$el.find_pattern' |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
30 '$el.replace_pattern' |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
31 #if $i == 0 |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
32 '$infile' |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
33 #end if |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
34 $join |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
35 #end for |
4 | 36 ]]> |
0 | 37 </command> |
38 <inputs> | |
4 | 39 <param name="infile" format="txt" type="data" label="File to process" /> |
25
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
40 <repeat name="find_and_replace" title="Find and Replace" min="1"> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
41 <param name="find_pattern" type="text" label="Find pattern" help="Use simple text, or a valid regular expression (without backslashes // ) " > |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
42 <sanitizer> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
43 <valid initial="string.printable"> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
44 <remove value="'"/> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
45 </valid> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
46 </sanitizer> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
47 </param> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
48 <param name="replace_pattern" type="text" label="Replace with" |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
49 help="Use simple text, or $& (dollar-ampersand) and $1 $2 $3 to refer to matched text. See examples below." > |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
50 <sanitizer> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
51 <valid initial="string.printable"> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
52 <remove value="'"/> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
53 </valid> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
54 </sanitizer> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
55 </param> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
56 <param name="is_regex" type="boolean" checked="false" truevalue="-r" falsevalue="" |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
57 label="Find-Pattern is a regular expression" help="see help section for details." /> |
0 | 58 |
25
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
59 <param name="global" type="boolean" checked="false" truevalue="-g" falsevalue="" |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
60 label="Replace all occurences of the pattern" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
61 |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
62 <param name="caseinsensitive" type="boolean" checked="false" truevalue="-i" falsevalue="" |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
63 label="Case-Insensitive search" help="" /> |
20
1aa30b2c73c9
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 4f79443517baf378fbfe1f81be361d97f2938601
bgruening
parents:
15
diff
changeset
|
64 |
25
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
65 <param name="wholewords" type="boolean" checked="false" truevalue="-w" falsevalue="" |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
66 label="Find whole-words" help="ignore partial matches (e.g. 'apple' will not match 'snapple')" /> |
0 | 67 |
25
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
68 <param name="skip_first_line" type="boolean" checked="false" truevalue="-s" falsevalue="" |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
69 label="Ignore first line" help="Select this option if the first line contains column headers. Text in the line will not be replaced. " /> |
0 | 70 |
25
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
71 <conditional name="searchwhere"> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
72 <param name="searchwhere_select" type="select" label="Find and Replace text in"> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
73 <option value="line" selected="true">entire line</option> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
74 <option value="column">specific column</option> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
75 </param> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
76 <when value="line" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
77 <when value="column"> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
78 <param name="column" label="in column" type="data_column" data_ref="infile" accept_default="true" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
79 </when> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
80 </conditional> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
81 </repeat> |
0 | 82 </inputs> |
83 <outputs> | |
6 | 84 <data format_source="infile" name="outfile" metadata_source="infile" /> |
0 | 85 </outputs> |
4 | 86 <tests> |
25
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
87 <test expect_num_outputs="1"> |
4 | 88 <param name="infile" value="find_and_replace1.txt" /> |
25
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
89 <repeat name="find_and_replace"> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
90 <param name="find_pattern" value="day" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
91 <param name="replace_pattern" value="great day" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
92 <param name="is_regex" value="False" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
93 <param name="global" value="true" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
94 <param name="caseinsensitive" value="False" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
95 <param name="wholewords" value="True" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
96 </repeat> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
97 <output name="outfile" file="find_and_replace_results1.txt" /> |
4 | 98 </test> |
21
0e3b611245f7
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 9c4d4fe09cbbd818532d793d01d1cb16edbd496b-dirty"
bgruening
parents:
20
diff
changeset
|
99 <!-- test that columns are split by tab not space. input has no tab loads of spaces |
0e3b611245f7
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 9c4d4fe09cbbd818532d793d01d1cb16edbd496b-dirty"
bgruening
parents:
20
diff
changeset
|
100 .. therefore the ftype needs to be set. |
0e3b611245f7
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 9c4d4fe09cbbd818532d793d01d1cb16edbd496b-dirty"
bgruening
parents:
20
diff
changeset
|
101 result should be the same as in test 1 which works on whole line --> |
25
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
102 <test expect_num_outputs="1"> |
21
0e3b611245f7
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 9c4d4fe09cbbd818532d793d01d1cb16edbd496b-dirty"
bgruening
parents:
20
diff
changeset
|
103 <param name="infile" value="find_and_replace1.txt" ftype="tabular" /> |
25
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
104 <repeat name="find_and_replace"> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
105 <param name="find_pattern" value="day" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
106 <param name="replace_pattern" value="great day" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
107 <param name="is_regex" value="False" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
108 <param name="global" value="true" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
109 <param name="caseinsensitive" value="False" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
110 <param name="wholewords" value="True" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
111 <conditional name="searchwhere"> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
112 <param name="searchwhere_select" value="column"/> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
113 <param name="column" value="1" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
114 </conditional> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
115 </repeat> |
21
0e3b611245f7
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 9c4d4fe09cbbd818532d793d01d1cb16edbd496b-dirty"
bgruening
parents:
20
diff
changeset
|
116 <output name="outfile" file="find_and_replace_results1.txt" /> |
0e3b611245f7
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 9c4d4fe09cbbd818532d793d01d1cb16edbd496b-dirty"
bgruening
parents:
20
diff
changeset
|
117 </test> |
25
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
118 <test expect_num_outputs="1"> |
4 | 119 <param name="infile" value="find_and_replace2.txt" /> |
25
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
120 <repeat name="find_and_replace"> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
121 <param name="find_pattern" value="^chr" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
122 <param name="replace_pattern" value="" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
123 <param name="is_regex" value="True" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
124 <param name="caseinsensitive" value="False" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
125 <param name="wholewords" value="False" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
126 <conditional name="searchwhere"> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
127 <param name="searchwhere_select" value="column" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
128 <param name="column" value="3" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
129 </conditional> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
130 </repeat> |
4 | 131 <output name="outfile" file="find_and_replace_results2.txt" /> |
132 </test> | |
25
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
133 <test expect_num_outputs="1"> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
134 <param name="infile" value="find_and_replace1.txt" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
135 <repeat name="find_and_replace"> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
136 <param name="find_pattern" value="day" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
137 <param name="replace_pattern" value="great day" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
138 <param name="is_regex" value="False" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
139 <param name="global" value="true" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
140 <param name="caseinsensitive" value="False" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
141 <param name="wholewords" value="True" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
142 </repeat> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
143 <param name="infile" value="find_and_replace1.txt" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
144 <repeat name="find_and_replace"> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
145 <param name="find_pattern" value="great" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
146 <param name="replace_pattern" value="best" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
147 <param name="is_regex" value="False" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
148 <param name="global" value="False" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
149 <param name="caseinsensitive" value="False" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
150 <param name="wholewords" value="True" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
151 </repeat> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
152 <output name="outfile" file="find_and_replace_results3.txt" /> |
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
153 </test> |
4 | 154 </tests> |
155 <help> | |
156 <![CDATA[ | |
0 | 157 **What it does** |
158 | |
4 | 159 This tool finds $ replaces text in an input dataset. |
0 | 160 |
161 .. class:: infomark | |
162 | |
163 The **pattern to find** can be a simple text string, or a perl **regular expression** string (depending on *pattern is a regex* check-box). | |
164 | |
165 .. class:: infomark | |
166 | |
167 When using regular expressions, the **replace pattern** can contain back-references ( e.g. \\1 ) | |
168 | |
169 .. class:: infomark | |
170 | |
25
cd83b5644eab
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
bgruening
parents:
21
diff
changeset
|
171 This tool uses `Perl regular expression <https://perldoc.perl.org/perlre>`_ syntax. |
0 | 172 |
173 ----- | |
174 | |
175 **Examples of *regular-expression* Find Patterns** | |
176 | |
177 - **HELLO** The word 'HELLO' (case sensitive). | |
178 - **AG.T** The letters A,G followed by any single character, followed by the letter T. | |
179 - **A{4,}** Four or more consecutive A's. | |
180 - **chr2[012]\\t** The words 'chr20' or 'chr21' or 'chr22' followed by a tab character. | |
181 - **hsa-mir-([^ ]+)** The text 'hsa-mir-' followed by one-or-more non-space characters. When using parenthesis, the matched content of the parenthesis can be accessed with **\1** in the **replace** pattern. | |
182 | |
183 | |
184 **Examples of Replace Patterns** | |
185 | |
186 - **WORLD** The word 'WORLD' will be placed whereever the find pattern was found. | |
6 | 187 - **FOO-$&-BAR** Each time the find pattern is found, it will be surrounded with 'FOO-' at the begining and '-BAR' at the end. **$&** (dollar-ampersand) represents the matched find pattern. |
0 | 188 - **$1** The text which matched the first parenthesis in the Find Pattern. |
189 | |
190 | |
191 ----- | |
192 | |
193 **Example 1** | |
194 | |
195 **Find Pattern:** HELLO | |
196 **Replace Pattern:** WORLD | |
197 **Regular Expression:** no | |
198 **Replace what:** entire line | |
199 | |
4 | 200 Every time the word HELLO is found, it will be replaced with the word WORLD. |
0 | 201 |
202 ----- | |
203 | |
204 **Example 2** | |
205 | |
7 | 206 **Find Pattern:** ^chr |
0 | 207 **Replace Pattern:** (empty) |
208 **Regular Expression:** yes | |
209 **Replace what:** column 11 | |
210 | |
211 If column 11 (of every line) begins with ther letters 'chr', they will be removed. Effectively, it'll turn "chr4" into "4" and "chrXHet" into "XHet" | |
212 | |
213 | |
214 ----- | |
215 | |
216 **Perl's Regular Expression Syntax** | |
217 | |
7 | 218 The Find & Replace 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 | 219 |
220 - **( ) { } [ ] . * ? + \\ ^ $** are all special characters. **\\** can be used to "escape" a special character, allowing that special character to be searched for. | |
221 - **^** matches the beginning of a string(but not an internal line). | |
222 - **(** .. **)** groups a particular pattern. | |
223 - **{** n or n, or n,m **}** specifies an expected number of repetitions of the preceding pattern. | |
224 | |
225 - **{n}** The preceding item is matched exactly n times. | |
7 | 226 - **{n,}** The preceding item ismatched n or more times. |
227 - **{n,m}** The preceding item is matched at least n times but not more than m times. | |
0 | 228 |
229 - **[** ... **]** 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**. | |
230 - **.** Matches any single character except a newline. | |
231 - ***** The preceding item will be matched zero or more times. | |
232 - **?** The preceding item is optional and matched at most once. | |
233 - **+** The preceding item will be matched one or more times. | |
234 - **^** has two meaning: | |
7 | 235 - matches the beginning of a line or string. |
0 | 236 - indicates negation in a character class. For example, [^...] matches every character except the ones inside brackets. |
237 - **$** matches the end of a line or string. | |
7 | 238 - **\\|** Separates alternate possibilities. |
0 | 239 - **\\d** matches a single digit |
240 - **\\w** matches a single letter or digit or an underscore. | |
241 - **\\s** matches a single white-space (space or tabs). | |
242 | |
4 | 243 @REFERENCES@ |
244 ]]> | |
245 </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:
13
diff
changeset
|
246 <expand macro="citations" /> |
0 | 247 </tool> |