Mercurial > repos > devteam > cut_columns
comparison cutWrapper.xml @ 0:34c29e183ef7 draft
Uploaded cut_columns tarball.
| author | devteam |
|---|---|
| date | Tue, 04 Dec 2012 10:59:02 -0500 |
| parents | |
| children | 1378064e5d24 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:34c29e183ef7 |
|---|---|
| 1 <tool id="Cut1" name="Cut" version="1.0.1"> | |
| 2 <description>columns from a table</description> | |
| 3 <command interpreter="perl">cutWrapper.pl $input "$columnList" $delimiter $out_file1</command> | |
| 4 <inputs> | |
| 5 <param name="columnList" size="10" type="text" value="c1,c2" label="Cut columns"/> | |
| 6 <param name="delimiter" type="select" label="Delimited by"> | |
| 7 <option value="T">Tab</option> | |
| 8 <option value="Sp">Whitespace</option> | |
| 9 <option value="Dt">Dot</option> | |
| 10 <option value="C">Comma</option> | |
| 11 <option value="D">Dash</option> | |
| 12 <option value="U">Underscore</option> | |
| 13 <option value="P">Pipe</option> | |
| 14 </param> | |
| 15 <param format="txt" name="input" type="data" label="From"/> | |
| 16 </inputs> | |
| 17 <outputs> | |
| 18 <data format="tabular" name="out_file1" > | |
| 19 <actions> | |
| 20 <conditional name="delimiter"> | |
| 21 <when value="T"> | |
| 22 <conditional name="input"> | |
| 23 <when datatype_isinstance="interval"> | |
| 24 <action type="format" default="tabular"> | |
| 25 <option type="from_param" name="columnList" column="0" offset="0"> <!-- chromCol is 1--> | |
| 26 | |
| 27 <filter type="insert_column" column="0" value="interval"/> | |
| 28 | |
| 29 <filter type="insert_column" ref="columnList" /> <!-- startCol --> | |
| 30 | |
| 31 <filter type="insert_column" ref="columnList" /> <!-- endCol --> | |
| 32 | |
| 33 <filter type="multiple_splitter" column="1" separator=","/> | |
| 34 <filter type="column_strip" column="1"/> <!-- get rid of all external whitespace --> | |
| 35 <filter type="string_function" column="1" name="lower" /> | |
| 36 <filter type="param_value" column="1" value="^c\d{1,}$" compare="re_search" keep="True"/> | |
| 37 <filter type="column_strip" column="1" strip="c"/> <!-- get rid of c's --> | |
| 38 <filter type="boolean" column="1" cast="int" /> | |
| 39 | |
| 40 <filter type="multiple_splitter" column="2" separator=","/> | |
| 41 <filter type="column_strip" column="2"/> <!-- get rid of all external whitespace --> | |
| 42 <filter type="string_function" column="2" name="lower" /> | |
| 43 <filter type="param_value" column="2" value="^c\d{1,}$" compare="re_search" keep="True"/> | |
| 44 <filter type="column_strip" column="2" strip="c"/> <!-- get rid of c's --> | |
| 45 <filter type="boolean" column="2" cast="int" /> | |
| 46 | |
| 47 <filter type="multiple_splitter" column="3" separator=","/> | |
| 48 <filter type="column_strip" column="3"/> <!-- get rid of all external whitespace --> | |
| 49 <filter type="string_function" column="3" name="lower" /> | |
| 50 <filter type="param_value" column="3" value="^c\d{1,}$" compare="re_search" keep="True"/> | |
| 51 <filter type="column_strip" column="3" strip="c"/> <!-- get rid of c's --> | |
| 52 <filter type="boolean" column="3" cast="int" /> | |
| 53 | |
| 54 <filter type="metadata_value" ref="input" name="chromCol" column="1" /> | |
| 55 <filter type="metadata_value" ref="input" name="startCol" column="2" /> | |
| 56 <filter type="metadata_value" ref="input" name="endCol" column="3" /> | |
| 57 | |
| 58 </option> | |
| 59 </action> | |
| 60 | |
| 61 <conditional name="out_file1"> | |
| 62 <when datatype_isinstance="interval"> | |
| 63 <action type="metadata" name="chromCol"> | |
| 64 <option type="from_param" name="columnList" column="0" offset="0"> <!-- chromCol is 0--> | |
| 65 <filter type="multiple_splitter" column="0" separator=","/> | |
| 66 <filter type="column_strip" column="0"/> <!-- get rid of all external whitespace --> | |
| 67 <filter type="string_function" column="0" name="lower" /> | |
| 68 <filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/> | |
| 69 <filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's --> | |
| 70 <filter type="insert_column" value="1" iterate="True" column="0"/> | |
| 71 <filter type="boolean" column="1" cast="int" /> | |
| 72 <filter type="metadata_value" ref="input" name="chromCol" column="1" /> | |
| 73 </option> | |
| 74 </action> | |
| 75 | |
| 76 <action type="metadata" name="startCol"> | |
| 77 <option type="from_param" name="columnList" column="0" offset="0"> <!-- startCol is 0--> | |
| 78 <filter type="multiple_splitter" column="0" separator=","/> | |
| 79 <filter type="column_strip" column="0"/> <!-- get rid of all external whitespace --> | |
| 80 <filter type="string_function" column="0" name="lower" /> | |
| 81 <filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/> | |
| 82 <filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's --> | |
| 83 <filter type="insert_column" value="1" iterate="True" column="0"/> | |
| 84 <filter type="boolean" column="1" cast="int" /> | |
| 85 <filter type="metadata_value" ref="input" name="startCol" column="1" /> | |
| 86 </option> | |
| 87 </action> | |
| 88 | |
| 89 <action type="metadata" name="endCol"> | |
| 90 <option type="from_param" name="columnList" column="0" offset="0"> <!-- endCol is 0--> | |
| 91 <filter type="multiple_splitter" column="0" separator=","/> | |
| 92 <filter type="column_strip" column="0"/> <!-- get rid of all external whitespace --> | |
| 93 <filter type="string_function" column="0" name="lower" /> | |
| 94 <filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/> | |
| 95 <filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's --> | |
| 96 <filter type="insert_column" value="1" iterate="True" column="0"/> | |
| 97 <filter type="boolean" column="1" cast="int" /> | |
| 98 <filter type="metadata_value" ref="input" name="endCol" column="1" /> | |
| 99 </option> | |
| 100 </action> | |
| 101 | |
| 102 <action type="metadata" name="nameCol" default="0"> | |
| 103 <option type="from_param" name="columnList" column="0" offset="0"> <!-- nameCol is 0--> | |
| 104 <filter type="multiple_splitter" column="0" separator=","/> | |
| 105 <filter type="column_strip" column="0"/> <!-- get rid of all external whitespace --> | |
| 106 <filter type="string_function" column="0" name="lower" /> | |
| 107 <filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/> | |
| 108 <filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's --> | |
| 109 <filter type="insert_column" value="1" iterate="True" column="0"/> | |
| 110 <filter type="boolean" column="1" cast="int" /> | |
| 111 <filter type="metadata_value" ref="input" name="nameCol" column="1" /> | |
| 112 </option> | |
| 113 </action> | |
| 114 | |
| 115 <action type="metadata" name="strandCol" default="0"> | |
| 116 <option type="from_param" name="columnList" column="0" offset="0"> <!-- strandCol 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"/> | |
| 123 <filter type="boolean" column="1" cast="int" /> | |
| 124 <filter type="metadata_value" ref="input" name="strandCol" column="1" /> | |
| 125 </option> | |
| 126 </action> | |
| 127 </when> | |
| 128 </conditional> | |
| 129 | |
| 130 </when> | |
| 131 </conditional> | |
| 132 </when> | |
| 133 </conditional> | |
| 134 </actions> | |
| 135 </data> | |
| 136 </outputs> | |
| 137 <tests> | |
| 138 <test> | |
| 139 <param name="columnList" value="c1,c4,c2,c3"/> | |
| 140 <param name="delimiter" value="T"/> | |
| 141 <param name="input" value="1.bed"/> | |
| 142 <output name="out_file1" file="eq-cut.dat"/> | |
| 143 </test> | |
| 144 </tests> | |
| 145 <help> | |
| 146 | |
| 147 .. class:: warningmark | |
| 148 | |
| 149 **WARNING: This tool breaks column assignments.** To re-establish column assignments run the tools and click on the pencil icon in the latest history item. | |
| 150 | |
| 151 .. class:: infomark | |
| 152 | |
| 153 The output of this tool is always in tabular format (e.g., if your original delimiters are commas, they will be replaced with tabs). For example: | |
| 154 | |
| 155 Cutting columns 1 and 3 from:: | |
| 156 | |
| 157 apple,is,good | |
| 158 windows,is,bad | |
| 159 | |
| 160 will give:: | |
| 161 | |
| 162 apple good | |
| 163 windows bad | |
| 164 | |
| 165 ----- | |
| 166 | |
| 167 **What it does** | |
| 168 | |
| 169 This tool selects (cuts out) specified columns from the dataset. | |
| 170 | |
| 171 - Columns are specified as **c1**, **c2**, and so on. Column count begins with **1** | |
| 172 - Columns can be specified in any order (e.g., **c2,c1,c6**) | |
| 173 - If you specify more columns than actually present - empty spaces will be filled with dots | |
| 174 | |
| 175 ----- | |
| 176 | |
| 177 **Example** | |
| 178 | |
| 179 Input dataset (six columns: c1, c2, c3, c4, c5, and c6):: | |
| 180 | |
| 181 chr1 10 1000 gene1 0 + | |
| 182 chr2 100 1500 gene2 0 + | |
| 183 | |
| 184 **cut** on columns "**c1,c4,c6**" will return:: | |
| 185 | |
| 186 chr1 gene1 + | |
| 187 chr2 gene2 + | |
| 188 | |
| 189 **cut** on columns "**c6,c5,c4,c1**" will return:: | |
| 190 | |
| 191 + 0 gene1 chr1 | |
| 192 + 0 gene2 chr2 | |
| 193 | |
| 194 | |
| 195 **cut** on columns "**c8,c7,c4**" will return:: | |
| 196 | |
| 197 . . gene1 | |
| 198 . . gene2 | |
| 199 | |
| 200 | |
| 201 </help> | |
| 202 </tool> |
