annotate replace_text_in_line.xml @ 11:74a8bef53a00 draft

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