annotate sed.xml @ 13:0a8c6b61f0f4 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 4f79443517baf378fbfe1f81be361d97f2938601
author bgruening
date Wed, 03 Apr 2019 13:56:01 -0400
parents 74a8bef53a00
children 12615d397df7
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: 6
diff changeset
1 <tool id="tp_sed_tool" name="Text transformation" version="@BASE_VERSION@.1">
0
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
2 <description>with sed</description>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
3 <macros>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
4 <import>macros.xml</import>
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: 0
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: 6
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: 0
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[
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
12 sed
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
13 --sandbox
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
14 -r
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
15 #if $adv_opts.adv_opts_selector == 'advanced':
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
16 $adv_opts.silent
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
17 #end if
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
18 -f '$sed_script'
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
19 '$infile'
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
20 > '$output'
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
21 ]]>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
22 </command>
5
20344ce0c811 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b9d202134c3c6d0e5c398c3ae75e410067fcfc52
bgruening
parents: 0
diff changeset
23 <configfiles>
20344ce0c811 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b9d202134c3c6d0e5c398c3ae75e410067fcfc52
bgruening
parents: 0
diff changeset
24 <configfile name="sed_script">
20344ce0c811 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b9d202134c3c6d0e5c398c3ae75e410067fcfc52
bgruening
parents: 0
diff changeset
25 $code
20344ce0c811 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b9d202134c3c6d0e5c398c3ae75e410067fcfc52
bgruening
parents: 0
diff changeset
26 </configfile>
20344ce0c811 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b9d202134c3c6d0e5c398c3ae75e410067fcfc52
bgruening
parents: 0
diff changeset
27 </configfiles>
0
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
28 <inputs>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
29 <param format="txt" name="infile" type="data" label="File to process" />
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
30 <param name="code" type="text" area="true" size="5x35" label="SED Program" help="">
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
31 <sanitizer>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
32 <valid initial="string.printable">
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
33 <remove value="&apos;"/>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
34 </valid>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
35 </sanitizer>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
36 </param>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
37 <conditional name="adv_opts">
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
38 <param name="adv_opts_selector" type="select" label="Advanced Options">
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
39 <option value="basic" selected="True">Hide Advanced Options</option>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
40 <option value="advanced">Show Advanced Options</option>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
41 </param>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
42 <when value="basic" />
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
43 <when value="advanced">
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
44 <param name="silent" type="select" label="Operation mode" help="Same as 'sed -n', leave at 'normal' unless you know what you're doing." >
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
45 <option value="">normal</option>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
46 <option value="-n">silent</option>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
47 </param>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
48 </when>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
49 </conditional>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
50 </inputs>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
51 <outputs>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
52 <data name="output" format_source="infile" metadata_source="infile" />
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
53 </outputs>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
54 <tests>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
55 <test>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
56 <param name="infile" value="sed1.txt" />
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
57 <param name="code" value="1d ; s/foo/bar/" />
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
58 <param name="silent" value="" />
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
59 <output name="output" file="sed_results1.txt" />
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
60 </test>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
61 <test>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
62 <param name="infile" value="sed1.txt" />
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
63 <param name="code" value="/foo/ { s/foo/baz/g ; p }" />
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
64 <param name="adv_opts_selector" value="advanced" />
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
65 <param name="silent" value="-n" />
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
66 <output name="output" file="sed_results2.txt" />
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
67 </test>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
68 </tests>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
69 <help>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
70 <![CDATA[
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
71 **What it does**
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
72
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
73 This tool runs the unix **sed** command on the selected data file.
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
74
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
75 .. class:: infomark
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
76
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
77 **TIP:** This tool uses the **extended regular** expression syntax (same as running 'sed -r').
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
78
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
79
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
80
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
81 **Further reading**
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
82
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
83 - Short sed tutorial (http://www.linuxhowtos.org/System/sed_tutorial.htm)
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
84 - Long sed tutorial (http://www.grymoire.com/Unix/Sed.html)
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
85 - sed faq with good examples (http://sed.sourceforge.net/sedfaq.html)
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
86 - sed cheat-sheet (http://www.catonmat.net/download/sed.stream.editor.cheat.sheet.pdf)
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
87
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
88 -----
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
89
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
90 **Sed commands**
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
91
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
92 The most useful sed command is **s** (substitute).
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
93
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
94 **Examples**
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
95
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
96 - **s/hsa//** will remove the first instance of 'hsa' in every line.
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
97 - **s/hsa//g** will remove all instances (beacuse of the **g**) of 'hsa' in every line.
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
98 - **s/A{4,}/--&--/g** will find sequences of 4 or more consecutive A's, and once found, will surround them with two dashes from each side. The **&** marker is a place holder for 'whatever matched the regular expression'.
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
99 - **s/hsa-mir-([^ ]+)/short name: \\1 full name: &/** will find strings such as 'hsa-mir-43a' (the regular expression is 'hsa-mir-' followed by non-space characters) and will replace it will string such as 'short name: 43a full name: hsa-mir-43a'. The **\\1** marker is a place holder for 'whatever matched the first parenthesis' (similar to perl's **$1**) .
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
100
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
101
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
102 **sed's Regular Expression Syntax**
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
103
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
104 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
105
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
106 - **( ) { } [ ] . * ? + \ ^ $** 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
107 - **^** matches the beginning of a string(but not an internal line).
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
108 - **(** .. **)** groups a particular pattern.
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
109 - **{** 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
110
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
111 - **{n}** The preceding item is matched exactly n times.
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
112 - **{n,}** The preceding item ismatched n or more times.
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
113 - **{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
114
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
115 - **[** ... **]** 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
116 - **.** Matches any single character except a newline.
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
117 - ***** The preceding item will be matched zero or more times.
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
118 - **?** The preceding item is optional and matched at most once.
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
119 - **+** The preceding item will be matched one or more times.
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
120 - **^** has two meaning:
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
121 - matches the beginning of a line or string.
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
122 - 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
123 - **$** matches the end of a line or string.
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
124 - **\|** Separates alternate possibilities.
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
125
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
126
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
127 **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
128
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
129 @REFERENCES@
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
130 ]]>
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
131 </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
132 <expand macro="citations" />
0
5314e5d6f040 Imported from capsule None
bgruening
parents:
diff changeset
133 </tool>