Mercurial > repos > bgruening > text_processing
comparison replace_text_in_line.xml @ 17:f2918761eaf3 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:11:35 -0500 |
| parents | 61b3b01662fd |
| children | 1e974b82380d |
comparison
equal
deleted
inserted
replaced
| 16:61b3b01662fd | 17:f2918761eaf3 |
|---|---|
| 1 <?xml version="1.0" encoding="UTF-8"?> | 1 <?xml version="1.0" encoding="ISO-8859-1"?> |
| 2 <tool id="tp_replace_in_line" name="Replace Text" version="@BASE_VERSION@.0"> | 2 <tool id="tp_replace_in_line" name="Replace Text" version="@BASE_VERSION@.0"> |
| 3 <description>in entire line</description> | 3 <description>in entire line</description> |
| 4 <macros> | 4 <macros> |
| 5 <import>macros.xml</import> | 5 <import>macros.xml</import> |
| 6 </macros> | 6 </macros> |
| 7 <requirements> | 7 <requirements> |
| 8 <requirement type="package" version="4.2.3.dev0">sed</requirement> | 8 <requirement type="package" version="4.2.3.dev0">sed</requirement> |
| 9 </requirements> | 9 </requirements> |
| 10 <version_command>sed --version | head -n 1</version_command> | 10 <version_command>sed --version | head -n 1</version_command> |
| 11 <command> | 11 <command> |
| 12 <!-- | |
| 13 This looks quite strange but it is intentional. We have used U+0090 as | |
| 14 the replacement brackets in the sed expression. This meets multiple requirements for use: | |
| 15 | |
| 16 - is legal entity in XML 1.0 (https://en.wikipedia.org/wiki/Valid_characters_in_XML) | |
| 17 - is legal as a sed delimiter character (must be single-byte) | |
| 18 - is not in string.printable | |
| 19 | |
| 20 Thus, this should execute properly. Additionally it allows users to | |
| 21 use characters like '/' and '\' and '|' in their regex without them | |
| 22 being able to prematurely terminate the expression. | |
| 23 --> | |
| 24 <![CDATA[ | 12 <![CDATA[ |
| 25 sed | 13 sed |
| 26 -r | 14 -r |
| 27 --sandbox | 15 --sandbox |
| 28 's$find_pattern$replace_patterng' | 16 's/$find_pattern/$replace_pattern/g' |
| 29 '$infile' | 17 '$infile' |
| 30 > '$outfile' | 18 > '$outfile' |
| 31 ]]> | 19 ]]> |
| 20 | |
| 32 </command> | 21 </command> |
| 33 <inputs> | 22 <inputs> |
| 34 <param format="txt" name="infile" type="data" label="File to process" /> | 23 <param format="txt" name="infile" type="data" label="File to process" /> |
| 35 <param name="find_pattern" type="text" label="Find pattern" help="Use simple text, or a valid regular expression (without backslashes // ) " > | 24 <param name="find_pattern" type="text" size="20" label="Find pattern" help="Use simple text, or a valid regular expression (without backslashes // ) " > |
| 36 <sanitizer> | 25 <sanitizer> |
| 37 <valid initial="string.printable"> | 26 <valid initial="string.printable"> |
| 38 <remove value="'"/> | 27 <remove value="'"/> |
| 28 <remove value="/"/> | |
| 39 </valid> | 29 </valid> |
| 30 <mapping initial="none"> | |
| 31 <add source="'" target="'"'"'" /> | |
| 32 <add source="/" target="\/"/> | |
| 33 </mapping> | |
| 40 </sanitizer> | 34 </sanitizer> |
| 41 </param> | 35 </param> |
| 42 <param name="replace_pattern" type="text" label="Replace with:" help="Use simple text, or & (ampersand) and \\1 \\2 \\3 to refer to matched text. See examples below." > | 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." > |
| 43 <sanitizer> | 37 <sanitizer> |
| 44 <valid initial="string.printable"> | 38 <valid initial="string.printable"> |
| 45 <remove value="'"/> | 39 <remove value="'"/> |
| 40 <remove value="/"/> | |
| 46 </valid> | 41 </valid> |
| 42 <mapping initial="none"> | |
| 43 <add source="'" target="'"'"'" /> | |
| 44 <add source="/" target="\/"/> | |
| 45 </mapping> | |
| 46 | |
| 47 </sanitizer> | 47 </sanitizer> |
| 48 | |
| 48 </param> | 49 </param> |
| 49 </inputs> | 50 </inputs> |
| 50 <outputs> | 51 <outputs> |
| 51 <data name="outfile" format_source="infile" metadata_source="infile"/> | 52 <data name="outfile" format_source="infile" metadata_source="infile"/> |
| 52 </outputs> | 53 </outputs> |
| 53 <tests> | 54 <tests> |
| 54 <test> | 55 <test> |
| 55 <param name="infile" value="replace_text_in_line1.txt" /> | 56 <param name="infile" value="replace_text_in_line1.txt" /> |
| 56 <param name="find_pattern" value="CTC." /> | 57 <param name="find_pattern" value="CTC." /> |
| 57 <param name="replace_pattern" value="FOOBAR" /> | 58 <param name="replace_pattern" value="FOOBAR" /> |
| 58 <output name="outfile" file="replace_text_in_line_results1.txt" /> | 59 <output name="outfile" file="replace_text_in_line_results1.txt" /> |
| 59 </test> | 60 </test> |
| 75 ----- | 76 ----- |
| 76 | 77 |
| 77 **Examples of Find Patterns** | 78 **Examples of Find Patterns** |
| 78 | 79 |
| 79 - **HELLO** The word 'HELLO' (case sensitive). | 80 - **HELLO** The word 'HELLO' (case sensitive). |
| 80 - **AG.T** The letters A,G followed by any single character, followed by the letter T. | 81 - **AG.T** The letters A,G followed by any single character, followed by the letter T. |
| 81 - **A{4,}** Four or more consecutive A's. | 82 - **A{4,}** Four or more consecutive A's. |
| 82 - **chr2[012]\\t** The words 'chr20' or 'chr21' or 'chr22' followed by a tab character. | 83 - **chr2[012]\\t** The words 'chr20' or 'chr21' or 'chr22' followed by a tab character. |
| 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. | 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. |
| 84 | 85 |
| 85 | 86 |
| 86 **Examples of Replace Patterns** | 87 **Examples of Replace Patterns** |
| 87 | 88 |
