/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. <filter type="insert_column" column="0" value="interval"/>
  27. <filter type="insert_column" ref="columnList" /> <!-- startCol -->
  28. <filter type="insert_column" ref="columnList" /> <!-- endCol -->
  29. <filter type="multiple_splitter" column="1" separator=","/>
  30. <filter type="column_strip" column="1"/> <!-- get rid of all external whitespace -->
  31. <filter type="string_function" column="1" name="lower" />
  32. <filter type="param_value" column="1" value="^c\d{1,}$" compare="re_search" keep="True"/>
  33. <filter type="column_strip" column="1" strip="c"/> <!-- get rid of c's -->
  34. <filter type="boolean" column="1" cast="int" />
  35. <filter type="multiple_splitter" column="2" separator=","/>
  36. <filter type="column_strip" column="2"/> <!-- get rid of all external whitespace -->
  37. <filter type="string_function" column="2" name="lower" />
  38. <filter type="param_value" column="2" value="^c\d{1,}$" compare="re_search" keep="True"/>
  39. <filter type="column_strip" column="2" strip="c"/> <!-- get rid of c's -->
  40. <filter type="boolean" column="2" cast="int" />
  41. <filter type="multiple_splitter" column="3" separator=","/>
  42. <filter type="column_strip" column="3"/> <!-- get rid of all external whitespace -->
  43. <filter type="string_function" column="3" name="lower" />
  44. <filter type="param_value" column="3" value="^c\d{1,}$" compare="re_search" keep="True"/>
  45. <filter type="column_strip" column="3" strip="c"/> <!-- get rid of c's -->
  46. <filter type="boolean" column="3" cast="int" />
  47. <filter type="metadata_value" ref="input" name="chromCol" column="1" />
  48. <filter type="metadata_value" ref="input" name="startCol" column="2" />
  49. <filter type="metadata_value" ref="input" name="endCol" column="3" />
  50. </option>
  51. </action>
  52. <conditional name="out_file1">
  53. <when datatype_isinstance="interval">
  54. <action type="metadata" name="chromCol">
  55. <option type="from_param" name="columnList" column="0" offset="0"> <!-- chromCol is 0-->
  56. <filter type="multiple_splitter" column="0" separator=","/>
  57. <filter type="column_strip" column="0"/> <!-- get rid of all external whitespace -->
  58. <filter type="string_function" column="0" name="lower" />
  59. <filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/>
  60. <filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's -->
  61. <filter type="insert_column" value="1" iterate="True" column="0"/>
  62. <filter type="boolean" column="1" cast="int" />
  63. <filter type="metadata_value" ref="input" name="chromCol" column="1" />
  64. </option>
  65. </action>
  66. <action type="metadata" name="startCol">
  67. <option type="from_param" name="columnList" column="0" offset="0"> <!-- startCol is 0-->
  68. <filter type="multiple_splitter" column="0" separator=","/>
  69. <filter type="column_strip" column="0"/> <!-- get rid of all external whitespace -->
  70. <filter type="string_function" column="0" name="lower" />
  71. <filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/>
  72. <filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's -->
  73. <filter type="insert_column" value="1" iterate="True" column="0"/>
  74. <filter type="boolean" column="1" cast="int" />
  75. <filter type="metadata_value" ref="input" name="startCol" column="1" />
  76. </option>
  77. </action>
  78. <action type="metadata" name="endCol">
  79. <option type="from_param" name="columnList" column="0" offset="0"> <!-- endCol is 0-->
  80. <filter type="multiple_splitter" column="0" separator=","/>
  81. <filter type="column_strip" column="0"/> <!-- get rid of all external whitespace -->
  82. <filter type="string_function" column="0" name="lower" />
  83. <filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/>
  84. <filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's -->
  85. <filter type="insert_column" value="1" iterate="True" column="0"/>
  86. <filter type="boolean" column="1" cast="int" />
  87. <filter type="metadata_value" ref="input" name="endCol" column="1" />
  88. </option>
  89. </action>
  90. <action type="metadata" name="nameCol" default="0">
  91. <option type="from_param" name="columnList" column="0" offset="0"> <!-- nameCol is 0-->
  92. <filter type="multiple_splitter" column="0" separator=","/>
  93. <filter type="column_strip" column="0"/> <!-- get rid of all external whitespace -->
  94. <filter type="string_function" column="0" name="lower" />
  95. <filter type="param_value" column="0" value="^c\d{1,}$" compare="re_search" keep="True"/>
  96. <filter type="column_strip" column="0" strip="c"/> <!-- get rid of c's -->
  97. <filter type="insert_column" value="1" iterate="True" column="0"/>
  98. <filter type="boolean" column="1" cast="int" />
  99. <filter type="metadata_value" ref="input" name="nameCol" column="1" />
  100. </option>
  101. </action>
  102. <action type="metadata" name="strandCol" default="0">
  103. <option type="from_param" name="columnList" column="0" offset="0"> <!-- strandCol 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="strandCol" column="1" />
  112. </option>
  113. </action>
  114. </when>
  115. </conditional>
  116. </when>
  117. </conditional>
  118. </when>
  119. </conditional>
  120. </actions>
  121. </data>
  122. </outputs>
  123. <tests>
  124. <test>
  125. <param name="columnList" value="c1,c4,c2,c3"/>
  126. <param name="delimiter" value="T"/>
  127. <param name="input" value="1.bed"/>
  128. <output name="out_file1" file="eq-cut.dat"/>
  129. </test>
  130. <test>
  131. <param name="columnList" value="c1,c4,c2-c3" />
  132. <param name="delimiter" value="T" />
  133. <param name="input" value="1.bed" />
  134. <output name="out_file1" file="eq-cut.dat" />
  135. </test>
  136. </tests>
  137. <help>
  138. .. class:: warningmark
  139. **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.
  140. .. class:: infomark
  141. 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:
  142. Cutting columns 1 and 3 from::
  143. apple,is,good
  144. windows,is,bad
  145. will give::
  146. apple good
  147. windows bad
  148. -----
  149. **What it does**
  150. This tool selects (cuts out) specified columns from the dataset.
  151. - Columns are specified as **c1**, **c2**, and so on. Column count begins with **1**
  152. - Columns can be specified in any order (e.g., **c2,c1,c6**)
  153. - If you specify more columns than actually present - empty spaces will be filled with dots
  154. -----
  155. **Example**
  156. Input dataset (six columns: c1, c2, c3, c4, c5, and c6)::
  157. chr1 10 1000 gene1 0 +
  158. chr2 100 1500 gene2 0 +
  159. **cut** on columns "**c1,c4,c6**" will return::
  160. chr1 gene1 +
  161. chr2 gene2 +
  162. **cut** on columns "**c6,c5,c4,c1**" will return::
  163. + 0 gene1 chr1
  164. + 0 gene2 chr2
  165. **cut** on columns "**c1-c3**" will return::
  166. chr1 10 1000
  167. chr2 100 1500
  168. **cut** on columns "**c8,c7,c4**" will return::
  169. . . gene1
  170. . . gene2
  171. </help>
  172. </tool>