Mercurial > repos > bgruening > text_processing
annotate cut.xml @ 18:1e974b82380d 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:10:53 -0500 |
| parents | 7725ab6dab67 |
| children | 28b4fd1b0e9a |
| rev | line source |
|---|---|
| 4 | 1 <tool id="tp_cut_tool" name="Cut" version="@BASE_VERSION@.0"> |
|
10
c78b1767db2b
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 10052765d6b712cf7d38356af4251fcc38a339b6-dirty
bgruening
parents:
7
diff
changeset
|
2 <description>columns from a table (cut)</description> |
| 4 | 3 <macros> |
| 4 <import>macros.xml</import> | |
| 5 </macros> | |
| 6 <expand macro="requirements" /> | |
| 7 <version_command>cut --version | head -n 1</version_command> | |
| 0 | 8 <command> |
| 4 | 9 <![CDATA[ |
| 10 cut | |
| 11 #if str($delimiter) != '': | |
| 12 -d"${delimiter}" | |
| 13 #end if | |
| 14 ${complement} | |
| 15 ${cut_type_options.cut_element} | |
| 16 '${cut_type_options.list}' | |
| 17 '${input}' | |
| 18 > '${output}' | |
| 19 ]]> | |
| 0 | 20 </command> |
| 21 <inputs> | |
| 4 | 22 <param name="input" format="txt" type="data" label="File to cut" /> |
| 0 | 23 <param name="complement" type="select" label="Operation"> |
| 24 <option value="">Keep</option> | |
| 25 <option value="--complement">Discard</option> | |
| 26 </param> | |
| 1 | 27 <param name="delimiter" type="select" label="Delimited by"> |
| 4 | 28 <option value="">Tab</option> |
| 29 <option value=" ">Whitespace</option> | |
| 30 <option value=".">Dot</option> | |
| 31 <option value=",">Comma</option> | |
| 32 <option value="-">Dash</option> | |
| 33 <option value="_">Underscore</option> | |
| 34 <option value="|">Pipe</option> | |
| 1 | 35 </param> |
| 4 | 36 <conditional name="cut_type_options"> |
| 37 <param name="cut_element" type="select" label="Cut by"> | |
| 38 <option value="-f">fields</option> | |
| 39 <option value="-c">characters</option> | |
| 40 <option value="-b">bytes</option> | |
| 41 </param> | |
| 42 <when value="-f"> | |
| 43 <param name="list" type="data_column" data_ref="input" multiple="true" label="List of Fields" help="(-f)" /> | |
| 44 </when> | |
| 45 <when value="-c"> | |
|
10
c78b1767db2b
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 10052765d6b712cf7d38356af4251fcc38a339b6-dirty
bgruening
parents:
7
diff
changeset
|
46 <param name="list" type="text" value="" label="List of characters" help="These will be kept/discarded (depending on 'operation'). <BR /> Examples: 1,3,4 or 2-5"> |
| 4 | 47 <sanitizer> |
| 48 <valid initial="string.printable"> | |
| 49 <remove value="'"/> | |
| 50 </valid> | |
| 51 </sanitizer> | |
| 52 </param> | |
| 53 </when> | |
| 54 <when value="-b"> | |
|
10
c78b1767db2b
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 10052765d6b712cf7d38356af4251fcc38a339b6-dirty
bgruening
parents:
7
diff
changeset
|
55 <param name="list" type="text" value="" label="List of Bytes" help="These will be kept/discarded (depending on 'operation'). <BR /> Examples: 1,3,4 or 2-5"> |
| 4 | 56 <sanitizer> |
| 57 <valid initial="string.printable"> | |
| 58 <remove value="'"/> | |
| 59 </valid> | |
| 60 </sanitizer> | |
| 61 </param> | |
| 62 </when> | |
| 63 </conditional> | |
| 0 | 64 </inputs> |
| 1 | 65 <outputs> |
| 66 <!--<data format="tabular" name="output" />--> | |
| 67 <!-- WIP, not sure that will work with the complement option --> | |
| 68 <data format="tabular" name="output"> | |
| 4 | 69 <actions> |
| 70 <conditional name="cut_type_options.cut_element"> | |
| 71 <!-- fields --> | |
| 72 <when value="-f"> | |
| 73 <conditional name="delimiter"> | |
| 74 <when value="T"> | |
| 75 <conditional name="input"> | |
| 76 <when datatype_isinstance="interval"> | |
| 77 <action type="format" default="tabular"> | |
| 78 <option type="from_param" name="list" column="0" offset="0"> <!-- chromCol is 1--> | |
| 79 <filter type="insert_column" column="0" value="interval"/> | |
| 80 <filter type="insert_column" ref="list" /> <!-- startCol --> | |
| 81 <filter type="insert_column" ref="list" /> <!-- endCol --> | |
| 1 | 82 |
| 4 | 83 <filter type="multiple_splitter" column="1" separator=","/> |
| 84 <filter type="column_strip" column="1"/> <!-- get rid of all external whitespace --> | |
| 85 <filter type="string_function" column="1" name="lower" /> | |
| 86 <filter type="param_value" column="1" value="^c\d{1,}$" compare="re_search" keep="True"/> | |
| 87 <filter type="column_strip" column="1" strip="c"/> <!-- get rid of c's --> | |
| 88 <filter type="boolean" column="1" cast="int" /> | |
| 1 | 89 |
| 4 | 90 <filter type="multiple_splitter" column="2" separator=","/> |
| 91 <filter type="column_strip" column="2"/> <!-- get rid of all external whitespace --> | |
| 92 <filter type="string_function" column="2" name="lower" /> | |
| 93 <filter type="param_value" column="2" value="^c\d{1,}$" compare="re_search" keep="True"/> | |
| 94 <filter type="column_strip" column="2" strip="c"/> <!-- get rid of c's --> | |
| 95 <filter type="boolean" column="2" cast="int" /> | |
| 1 | 96 |
| 4 | 97 <filter type="multiple_splitter" column="3" separator=","/> |
| 98 <filter type="column_strip" column="3"/> <!-- get rid of all external whitespace --> | |
| 99 <filter type="string_function" column="3" name="lower" /> | |
| 100 <filter type="param_value" column="3" value="^c\d{1,}$" compare="re_search" keep="True"/> | |
| 101 <filter type="column_strip" column="3" strip="c"/> <!-- get rid of c's --> | |
| 102 <filter type="boolean" column="3" cast="int" /> | |
| 1 | 103 |
| 4 | 104 <filter type="metadata_value" ref="input" name="chromCol" column="1" /> |
| 105 <filter type="metadata_value" ref="input" name="startCol" column="2" /> | |
| 106 <filter type="metadata_value" ref="input" name="endCol" column="3" /> | |
| 107 </option> | |
| 108 </action> | |
|
14
7725ab6dab67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
10
diff
changeset
|
109 </when> |
|
7725ab6dab67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
10
diff
changeset
|
110 </conditional> |
|
7725ab6dab67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
10
diff
changeset
|
111 </when> |
|
7725ab6dab67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
10
diff
changeset
|
112 </conditional> |
| 1 | 113 <conditional name="output"> |
| 4 | 114 <when datatype_isinstance="interval"> |
| 115 <action type="metadata" name="chromCol"> | |
| 116 <option type="from_param" name="list" column="0" offset="0"> <!-- chromCol is 0--> | |
| 117 <filter type="multiple_splitter" column="0" separator=","/> | |
| 118 <filter type="column_strip" column="0"/> <!-- get rid of all external whitespace --> | |
| 119 <filter type="string_function" column="0" name="lower" /> | |
| 120 <filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/> | |
| 121 <filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's --> | |
| 122 <filter type="insert_column" value="1" iterate="True" column="0"/> | |
| 7 | 123 <filter type="boolean" column="1" cast="int" /> |
| 4 | 124 <filter type="metadata_value" ref="input" name="chromCol" column="1" /> |
| 125 </option> | |
| 126 </action> | |
| 7 | 127 |
| 4 | 128 <action type="metadata" name="startCol"> |
| 129 <option type="from_param" name="list" column="0" offset="0"> <!-- startCol is 0--> | |
| 130 <filter type="multiple_splitter" column="0" separator=","/> | |
| 131 <filter type="column_strip" column="0"/> <!-- get rid of all external whitespace --> | |
| 132 <filter type="string_function" column="0" name="lower" /> | |
| 133 <filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/> | |
| 134 <filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's --> | |
| 135 <filter type="insert_column" value="1" iterate="True" column="0"/> | |
| 136 <filter type="boolean" column="1" cast="int" /> | |
| 137 <filter type="metadata_value" ref="input" name="startCol" column="1" /> | |
| 138 </option> | |
| 139 </action> | |
| 7 | 140 |
| 4 | 141 <action type="metadata" name="endCol"> |
| 142 <option type="from_param" name="list" column="0" offset="0"> <!-- endCol is 0--> | |
| 143 <filter type="multiple_splitter" column="0" separator=","/> | |
| 144 <filter type="column_strip" column="0"/> <!-- get rid of all external whitespace --> | |
| 145 <filter type="string_function" column="0" name="lower" /> | |
| 146 <filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/> | |
| 147 <filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's --> | |
| 148 <filter type="insert_column" value="1" iterate="True" column="0"/> | |
| 149 <filter type="boolean" column="1" cast="int" /> | |
| 150 <filter type="metadata_value" ref="input" name="endCol" column="1" /> | |
| 151 </option> | |
| 152 </action> | |
| 7 | 153 |
| 4 | 154 <action type="metadata" name="nameCol" default="0"> |
| 155 <option type="from_param" name="list" column="0" offset="0"> <!-- nameCol is 0--> | |
| 156 <filter type="multiple_splitter" column="0" separator=","/> | |
| 157 <filter type="column_strip" column="0"/> <!-- get rid of all external whitespace --> | |
| 158 <filter type="string_function" column="0" name="lower" /> | |
| 159 <filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/> | |
| 160 <filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's --> | |
| 161 <filter type="insert_column" value="1" iterate="True" column="0"/> | |
| 162 <filter type="boolean" column="1" cast="int" /> | |
| 163 <filter type="metadata_value" ref="input" name="nameCol" column="1" /> | |
| 164 </option> | |
| 165 </action> | |
| 7 | 166 |
| 4 | 167 <action type="metadata" name="strandCol" default="0"> |
| 168 <option type="from_param" name="list" column="0" offset="0"> <!-- strandCol is 0--> | |
| 169 <filter type="multiple_splitter" column="0" separator=","/> | |
| 170 <filter type="column_strip" column="0"/> <!-- get rid of all external whitespace --> | |
| 171 <filter type="string_function" column="0" name="lower" /> | |
| 172 <filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/> | |
| 173 <filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's --> | |
| 174 <filter type="insert_column" value="1" iterate="True" column="0"/> | |
| 175 <filter type="boolean" column="1" cast="int" /> | |
| 176 <filter type="metadata_value" ref="input" name="strandCol" column="1" /> | |
| 177 </option> | |
| 178 </action> | |
|
14
7725ab6dab67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
10
diff
changeset
|
179 </when> |
| 1 | 180 </conditional> |
|
14
7725ab6dab67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
10
diff
changeset
|
181 </when> |
| 1 | 182 </conditional> |
|
14
7725ab6dab67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
10
diff
changeset
|
183 </actions> |
| 1 | 184 </data> |
| 185 </outputs> | |
| 0 | 186 <tests> |
| 187 <test> | |
| 6 | 188 <param name="input" value="cut1.txt"/> |
| 189 <param name="list" value="1,3,4"/> | |
| 190 <param name="delimiter" value=""/> | |
| 191 <output name="output" file="cut_results1.txt"/> | |
| 0 | 192 </test> |
| 193 <test> | |
| 6 | 194 <param name="input" value="cut1.txt"/> |
| 195 <param name="list" value="2" /> | |
| 196 <param name="delimiter" value="" /> | |
| 197 <param name="complement" value="--complement" /> | |
| 198 <output name="output" file="cut_results2.txt"/> | |
| 199 </test> | |
| 200 <test> | |
| 201 <param name="input" value="cut1.txt"/> | |
| 202 <param name="list" value="-3" /> | |
| 203 <param name="delimiter" value="" /> | |
| 204 <param name="cut_element" value="-c" /> | |
| 205 <output name="output" file="cut_results3.txt"/> | |
| 0 | 206 </test> |
| 207 </tests> | |
| 208 <help> | |
| 4 | 209 <![CDATA[ |
| 0 | 210 **What it does** |
| 211 | |
| 212 This tool runs the **cut** unix command, which extract or delete columns from a file. | |
| 213 | |
| 214 ----- | |
| 215 | |
| 216 Field List Example: | |
| 217 | |
| 218 **1,3,7** - Cut specific fields/characters. | |
| 219 | |
| 220 **3-** - Cut from the third field/character to the end of the line. | |
| 221 | |
| 222 **2-5** - Cut from the second to the fifth field/character. | |
| 223 | |
| 224 **-8** - Cut from the first to the eight field/characters. | |
| 225 | |
| 226 | |
| 227 Input Example:: | |
| 228 | |
| 229 fruit color price weight | |
| 230 apple red 1.4 0.5 | |
| 231 orange orange 1.5 0.3 | |
| 232 banana yellow 0.9 0.3 | |
| 233 | |
| 234 | |
| 235 Output Example ( **Keeping fields 1,3,4** ):: | |
| 236 | |
| 237 fruit price weight | |
| 238 apple 1.4 0.5 | |
| 239 orange 1.5 0.3 | |
| 240 banana 0.9 0.3 | |
| 241 | |
| 242 Output Example ( **Discarding field 2** ):: | |
| 243 | |
| 244 fruit price weight | |
| 245 apple 1.4 0.5 | |
| 246 orange 1.5 0.3 | |
| 247 banana 0.9 0.3 | |
| 248 | |
| 249 Output Example ( **Keeping 3 characters** ):: | |
| 250 | |
| 251 fru | |
| 252 app | |
| 253 ora | |
| 254 ban | |
| 255 | |
| 4 | 256 @REFERENCES@ |
| 257 ]]> | |
| 0 | 258 </help> |
|
14
7725ab6dab67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
10
diff
changeset
|
259 <expand macro="citations" /> |
| 0 | 260 </tool> |
