Mercurial > repos > bgruening > text_processing
comparison replace_text_in_line.xml @ 19:bed2226b90f7 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
| author | bgruening |
|---|---|
| date | Tue, 01 Jan 2019 06:01:13 -0500 |
| parents | 1e974b82380d |
| children | f22a309187a3 |
comparison
equal
deleted
inserted
replaced
| 18:1e974b82380d | 19:bed2226b90f7 |
|---|---|
| 1 <tool id="tp_replace_in_line" name="Replace Text" version="@BASE_VERSION@.1"> | 1 <tool id="tp_replace_in_line" name="Replace Text" version="@BASE_VERSION@.2"> |
| 2 <description>in entire line</description> | 2 <description>in entire line</description> |
| 3 <macros> | 3 <macros> |
| 4 <import>macros.xml</import> | 4 <import>macros.xml</import> |
| 5 </macros> | 5 </macros> |
| 6 <requirements> | 6 <requirements> |
| 7 <requirement type="package" version="4.4">sed</requirement> | 7 <requirement type="package" version="4.4">sed</requirement> |
| 8 </requirements> | 8 </requirements> |
| 9 <version_command>sed --version | head -n 1</version_command> | 9 <version_command>sed --version | head -n 1</version_command> |
| 10 <command> | 10 <command> |
| 11 <![CDATA[ | 11 <![CDATA[ |
| 12 sed | 12 sed |
| 13 -r | 13 -r |
| 14 --sandbox | 14 --sandbox |
| 15 's/$find_pattern/$replace_pattern/g' | 15 #for $replacement in $replacements: |
| 16 -e | |
| 17 's/$replacement.find_pattern/$replacement.replace_pattern/g' | |
| 18 #end for | |
| 16 '$infile' | 19 '$infile' |
| 17 > '$outfile' | 20 > '$outfile' |
| 18 ]]> | 21 ]]> |
| 19 | 22 |
| 20 </command> | 23 </command> |
| 21 <inputs> | 24 <inputs> |
| 22 <param format="txt" name="infile" type="data" label="File to process" /> | 25 <param format="txt" name="infile" type="data" label="File to process" /> |
| 26 <repeat name="replacements" title="Replacement" min="1"> | |
| 23 <param name="find_pattern" type="text" size="20" label="Find pattern" help="Use simple text, or a valid regular expression (without backslashes // ) " > | 27 <param name="find_pattern" type="text" size="20" label="Find pattern" help="Use simple text, or a valid regular expression (without backslashes // ) " > |
| 24 <sanitizer> | 28 <sanitizer> |
| 25 <valid initial="string.printable"> | 29 <valid initial="string.printable"> |
| 26 <remove value="'"/> | 30 <remove value="'"/> |
| 27 <remove value="/"/> | 31 <remove value="/"/> |
| 29 <mapping initial="none"> | 33 <mapping initial="none"> |
| 30 <add source="'" target="'"'"'" /> | 34 <add source="'" target="'"'"'" /> |
| 31 <add source="/" target="\/"/> | 35 <add source="/" target="\/"/> |
| 32 </mapping> | 36 </mapping> |
| 33 </sanitizer> | 37 </sanitizer> |
| 34 </param> | 38 </param> |
| 35 <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." > | 39 <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." > |
| 36 <sanitizer> | 40 <sanitizer> |
| 37 <valid initial="string.printable"> | 41 <valid initial="string.printable"> |
| 38 <remove value="'"/> | 42 <remove value="'"/> |
| 39 <remove value="/"/> | 43 <remove value="/"/> |
| 44 </mapping> | 48 </mapping> |
| 45 | 49 |
| 46 </sanitizer> | 50 </sanitizer> |
| 47 | 51 |
| 48 </param> | 52 </param> |
| 53 </repeat> | |
| 49 </inputs> | 54 </inputs> |
| 50 <outputs> | 55 <outputs> |
| 51 <data name="outfile" format_source="infile" metadata_source="infile"/> | 56 <data name="outfile" format_source="infile" metadata_source="infile"/> |
| 52 </outputs> | 57 </outputs> |
| 53 <tests> | 58 <tests> |
| 54 <test> | 59 <test> |
| 55 <param name="infile" value="replace_text_in_line1.txt" /> | 60 <param name="infile" value="replace_text_in_line1.txt" /> |
| 56 <param name="find_pattern" value="CTC." /> | 61 <param name="find_pattern" value="CTC." /> |
| 57 <param name="replace_pattern" value="FOOBAR" /> | 62 <param name="replace_pattern" value="FOOBAR" /> |
| 58 <output name="outfile" file="replace_text_in_line_results1.txt" /> | 63 <output name="outfile" file="replace_text_in_line_results1.txt" /> |
| 64 </test> | |
| 65 <test> | |
| 66 <param name="infile" value="replace_text_in_line1.txt" /> | |
| 67 <repeat name="replacements"> | |
| 68 <param name="find_pattern" value="CTC." /> | |
| 69 <param name="replace_pattern" value="FOOBAR" /> | |
| 70 </repeat> | |
| 71 <repeat name="replacements"> | |
| 72 <param name="find_pattern" value="chr" /> | |
| 73 <param name="replace_pattern" value="domain" /> | |
| 74 </repeat> | |
| 75 <output name="outfile" file="replace_text_in_line_results2.txt" /> | |
| 59 </test> | 76 </test> |
| 60 </tests> | 77 </tests> |
| 61 <help> | 78 <help> |
| 62 <![CDATA[ | 79 <![CDATA[ |
| 63 **What it does** | 80 **What it does** |
| 75 ----- | 92 ----- |
| 76 | 93 |
| 77 **Examples of Find Patterns** | 94 **Examples of Find Patterns** |
| 78 | 95 |
| 79 - **HELLO** The word 'HELLO' (case sensitive). | 96 - **HELLO** The word 'HELLO' (case sensitive). |
| 80 - **AG.T** The letters A,G followed by any single character, followed by the letter T. | 97 - **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. | 98 - **A{4,}** Four or more consecutive A's. |
| 82 - **chr2[012]\\t** The words 'chr20' or 'chr21' or 'chr22' followed by a tab character. | 99 - **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. | 100 - **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 | 101 |
| 85 | 102 |
| 86 **Examples of Replace Patterns** | 103 **Examples of Replace Patterns** |
| 87 | 104 |
| 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. | 127 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. |
| 111 | 128 |
| 112 | 129 |
| 113 ----- | 130 ----- |
| 114 | 131 |
| 115 **Extened Regular Expression Syntax** | 132 **Extended Regular Expression Syntax** |
| 116 | 133 |
| 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. | 134 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. |
| 118 | 135 |
| 119 - **( ) { } [ ] . * ? + \ ^ $** are all special characters. **\\** can be used to "escape" a special character, allowing that special character to be searched for. | 136 - **( ) { } [ ] . * ? + \ ^ $** are all special characters. **\\** can be used to "escape" a special character, allowing that special character to be searched for. |
| 120 - **^** matches the beginning of a string(but not an internal line). | 137 - **^** matches the beginning of a string(but not an internal line). |
