PageRenderTime 61ms CodeModel.GetById 48ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/tools/filters/cutWrapper.xml

https://bitbucket.org/cistrome/cistrome-harvard/
XML | 213 lines | 172 code | 41 blank | 0 comment | 0 complexity | 0616787d9708a434a1eaa5fc1c957082 MD5 | raw file
  1<tool id="Cut1" name="Cut" version="1.0.2">
  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    <test>
145      <param name="columnList" value="c1,c4,c2-c3" />
146      <param name="delimiter" value="T" />
147      <param name="input" value="1.bed" />
148      <output name="out_file1" file="eq-cut.dat" />
149    </test>
150  </tests>
151  <help>
152
153.. class:: warningmark
154
155**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.
156
157.. class:: infomark
158
159The 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:
160
161  Cutting columns 1 and 3 from::
162
163     apple,is,good
164     windows,is,bad
165
166  will give::
167
168    apple   good
169    windows bad
170
171-----
172
173**What it does**
174
175This tool selects (cuts out) specified columns from the dataset.
176
177- Columns are specified as **c1**, **c2**, and so on. Column count begins with **1**
178- Columns can be specified in any order (e.g., **c2,c1,c6**)
179- If you specify more columns than actually present - empty spaces will be filled with dots
180
181-----
182
183**Example**
184
185Input dataset (six columns: c1, c2, c3, c4, c5, and c6)::
186
187   chr1 10   1000  gene1 0 +
188   chr2 100  1500  gene2 0 +
189
190**cut** on columns "**c1,c4,c6**" will return::
191
192   chr1 gene1 +
193   chr2 gene2 +
194
195**cut** on columns "**c6,c5,c4,c1**" will return::
196
197   + 0 gene1 chr1 
198   + 0 gene2 chr2
199
200**cut** on columns "**c1-c3**" will return::
201
202   chr1 10   1000 
203   chr2 100  1500
204
205
206**cut** on columns "**c8,c7,c4**" will return::
207
208   . . gene1 
209   . . gene2
210   
211
212</help>
213</tool>