Mercurial > repos > blankenberg > column_regex_substitution
comparison column_regex_substitution.xml @ 0:8d8511030ebf draft default tip
planemo upload for repository https://github.com/blankenberg/tools-blankenberg/tree/master/tools/column_regex_substitution commit 78936dc6be1747303d4cbfd80d09e4cfd1cbf292
| author | blankenberg |
|---|---|
| date | Fri, 07 Sep 2018 10:28:07 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:8d8511030ebf |
|---|---|
| 1 <tool id="column_regex_substitution" name="Column substitution" version="0.0.1"> | |
| 2 <description>by regular expressions</description> | |
| 3 <requirements> | |
| 4 <requirement type="package" version="2.7">python</requirement> | |
| 5 </requirements> | |
| 6 <stdio> | |
| 7 <exit_code range="1:" /> | |
| 8 <exit_code range=":-1" /> | |
| 9 </stdio> | |
| 10 <version_command>python column_regex_substitution.py --version</version_command> | |
| 11 <command><![CDATA[ | |
| 12 #import pipes | |
| 13 python '$__tool_directory__/column_regex_substitution.py' | |
| 14 --input '${input_tabular}' | |
| 15 --pattern ${pipes.quote( str( $pattern ).replace('\\','\\\\').decode( 'string_escape' ) ) or '""'} | |
| 16 --replacement ${ pipes.quote( str( $replacement ).replace('\\','\\\\').decode( 'string_escape' ) ) or '""' } | |
| 17 --columns '${ $columns or "" }' | |
| 18 --output '${outfile}' | |
| 19 #if $input_tabular.metadata.delimiter: | |
| 20 --delimiter ${ pipes.quote( str( $input_tabular.unsanitized.metadata.delimiter ) ) } | |
| 21 #end if | |
| 22 --column_offset '-1' | |
| 23 ]]> | |
| 24 </command> | |
| 25 <inputs> | |
| 26 <param name="input_tabular" type="data" format="txt" label="File to perform substitution on" /> | |
| 27 <param name="pattern" type="text" label="Pattern to Match"> | |
| 28 <sanitizer sanitize="False" /> | |
| 29 </param> | |
| 30 <param name="replacement" type="text" label="Replacement"> | |
| 31 <sanitizer sanitize="False" /> | |
| 32 </param> | |
| 33 <param name="columns" label="Columns for substitution" type="data_column" data_ref="input_tabular" optional="True" multiple="True" help="Selecting no columns will target all columns"/> | |
| 34 </inputs> | |
| 35 <outputs> | |
| 36 <data name="outfile" format_source="input_tabular" /> | |
| 37 </outputs> | |
| 38 <tests> | |
| 39 <test> | |
| 40 <param name="input_tabular" ftype="tabular" value="column_regex_substitution_in.tabular"/> | |
| 41 <param name="pattern" value="^$"/> | |
| 42 <param name="replacement" value="."/> | |
| 43 <param name="columns" value="1"/> | |
| 44 <output name="outfile" ftype="tabular" file="column_regex_substitution_out.tabular" /> | |
| 45 </test> | |
| 46 </tests> | |
| 47 <help><![CDATA[ | |
| 48 **What it does** | |
| 49 | |
| 50 Use regular expressions (regex) to substitute field values. Datasets that do not have a metadata delimiter value will be treated as a single column per row. | |
| 51 | |
| 52 This tool makes use of Python's `re.sub functionality <https://docs.python.org/2/library/re.html#re.sub>`_. | |
| 53 | |
| 54 ]]> | |
| 55 </help> | |
| 56 <citations></citations> | |
| 57 </tool> |
