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