Mercurial > repos > bgruening > text_processing
annotate replace_text_in_line.xml @ 10:e39fceb6ab85 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
author | bgruening |
---|---|
date | Tue, 20 Feb 2018 09:24:19 -0500 |
parents | 6378f8384f30 |
children | 74a8bef53a00 |
rev | line source |
---|---|
10
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
1 <?xml version="1.0" encoding="ISO-8859-1"?> |
0 | 2 <tool id="tp_replace_in_line" name="Replace Text" version="@BASE_VERSION@.0"> |
3 <description>in entire line</description> | |
4 <macros> | |
10
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
5 <import>macros.xml</import> |
0 | 6 </macros> |
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> |
20344ce0c811
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b9d202134c3c6d0e5c398c3ae75e410067fcfc52
bgruening
parents:
3
diff
changeset
|
8 <requirement type="package" version="4.2.3.dev0">sed</requirement> |
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> |
0 | 10 <version_command>sed --version | head -n 1</version_command> |
11 <command> | |
12 <![CDATA[ | |
10
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
13 sed |
0 | 14 -r |
15 --sandbox | |
10
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
16 's/$find_pattern/$replace_pattern/g' |
9
6378f8384f30
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 5d3a6a822897569f22f288589543562f54482418
bgruening
parents:
6
diff
changeset
|
17 '$infile' |
6378f8384f30
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 5d3a6a822897569f22f288589543562f54482418
bgruening
parents:
6
diff
changeset
|
18 > '$outfile' |
0 | 19 ]]> |
10
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
20 |
0 | 21 </command> |
22 <inputs> | |
10
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
23 <param format="txt" name="infile" type="data" label="File to process" /> |
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
24 <param name="find_pattern" type="text" size="20" label="Find pattern" help="Use simple text, or a valid regular expression (without backslashes // ) " > |
0 | 25 <sanitizer> |
26 <valid initial="string.printable"> | |
10
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
27 <remove value="'"/> |
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
28 <remove value="/"/> |
0 | 29 </valid> |
10
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
30 <mapping initial="none"> |
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
31 <add source="'" target="'"'"'" /> |
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
32 <add source="/" target="\/"/> |
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
33 </mapping> |
0 | 34 </sanitizer> |
35 </param> | |
10
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
36 <param name="replace_pattern" type="text" size="20" label="Replace with:" help="Use simple text, or & (ampersand) and \\1 \\2 \\3 to refer to matched text. See examples below." > |
0 | 37 <sanitizer> |
38 <valid initial="string.printable"> | |
10
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
39 <remove value="'"/> |
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
40 <remove value="/"/> |
0 | 41 </valid> |
10
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
42 <mapping initial="none"> |
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
43 <add source="'" target="'"'"'" /> |
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
44 <add source="/" target="\/"/> |
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
45 </mapping> |
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
46 |
0 | 47 </sanitizer> |
10
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
48 |
0 | 49 </param> |
50 </inputs> | |
51 <outputs> | |
10
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
52 <data name="outfile" format_source="infile" metadata_source="infile"/> |
0 | 53 </outputs> |
54 <tests> | |
10
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
55 <test> |
0 | 56 <param name="infile" value="replace_text_in_line1.txt" /> |
57 <param name="find_pattern" value="CTC." /> | |
58 <param name="replace_pattern" value="FOOBAR" /> | |
59 <output name="outfile" file="replace_text_in_line_results1.txt" /> | |
60 </test> | |
61 </tests> | |
62 <help> | |
63 <![CDATA[ | |
64 **What it does** | |
65 | |
66 This tool performs find & replace operation on a specified file. | |
67 | |
68 .. class:: infomark | |
69 | |
70 The **pattern to find** uses the **extended regular** expression syntax (same as running 'sed -r'). | |
71 | |
72 .. class:: infomark | |
73 | |
74 **TIP:** If you need more complex patterns, use the *sed* tool. | |
75 | |
76 ----- | |
77 | |
78 **Examples of Find Patterns** | |
79 | |
80 - **HELLO** The word 'HELLO' (case sensitive). | |
10
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
81 - **AG.T** The letters A,G followed by any single character, followed by the letter T. |
0 | 82 - **A{4,}** Four or more consecutive A's. |
10
e39fceb6ab85
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
9
diff
changeset
|
83 - **chr2[012]\\t** The words 'chr20' or 'chr21' or 'chr22' followed by a tab character. |
0 | 84 - **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. |
85 | |
86 | |
87 **Examples of Replace Patterns** | |
88 | |
89 - **WORLD** The word 'WORLD' will be placed whereever the find pattern was found. | |
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
|
90 - **FOO-&-BAR** Each time the find pattern is found, it will be surrounded with 'FOO-' at the beginning and '-BAR' at the end. **&** (ampersand) represents the matched find pattern. |
0 | 91 - **\\1** The text which matched the first parenthesis in the Find Pattern. |
92 | |
93 | |
94 ----- | |
95 | |
96 **Example 1** | |
97 | |
98 **Find Pattern:** HELLO | |
99 **Replace Pattern:** WORLD | |
100 | |
101 Every time the word HELLO is found, it will be replaced with the word WORLD. | |
102 | |
103 | |
104 ----- | |
105 | |
106 **Example 2** | |
107 | |
108 **Find Pattern:** ^(.{4}) | |
109 **Replace Pattern:** &\\t | |
110 | |
111 Find the first four characters in each line, and replace them with the same text, followed by a tab character. In practice - this will split the first line into two columns. | |
112 | |
113 | |
114 ----- | |
115 | |
116 **Extened Regular Expression Syntax** | |
117 | |
118 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. | |
119 | |
120 - **( ) { } [ ] . * ? + \ ^ $** are all special characters. **\\** can be used to "escape" a special character, allowing that special character to be searched for. | |
121 - **^** matches the beginning of a string(but not an internal line). | |
122 - **(** .. **)** groups a particular pattern. | |
123 - **{** n or n, or n,m **}** specifies an expected number of repetitions of the preceding pattern. | |
124 | |
125 - **{n}** The preceding item is matched exactly n times. | |
126 - **{n,}** The preceding item ismatched n or more times. | |
127 - **{n,m}** The preceding item is matched at least n times but not more than m times. | |
128 | |
129 - **[** ... **]** 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**. | |
130 - **.** Matches any single character except a newline. | |
131 - ***** The preceding item will be matched zero or more times. | |
132 - **?** The preceding item is optional and matched at most once. | |
133 - **+** The preceding item will be matched one or more times. | |
134 - **^** has two meaning: | |
135 - matches the beginning of a line or string. | |
136 - indicates negation in a character class. For example, [^...] matches every character except the ones inside brackets. | |
137 - **$** matches the end of a line or string. | |
138 - **\|** Separates alternate possibilities. | |
139 | |
140 | |
141 **Note**: SED uses extended regular expression syntax, not Perl syntax. **\\d**, **\\w**, **\\s** etc. are **not** supported. | |
142 | |
143 @REFERENCES@ | |
144 ]]> | |
145 </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
|
146 <expand macro="citations" /> |
0 | 147 </tool> |