comparison tabular2HTML.xml @ 0:a5814dd5a11a default tip

Uploaded
author ondovb
date Fri, 23 Sep 2011 17:06:15 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:a5814dd5a11a
1 <tool id="tabular2HTML" name="Tabular-to-HTML" version="1.0.0">
2 <description>for easier table viewing</description>
3 <command interpreter="perl">
4 tabular2HTML.pl
5 $tableHeader
6 $input
7 $output
8 #if $headerSource.source == 'explicit':
9 #for $header in $headerSource.headers
10 #if len($header.subheaders) > 0
11 ${len($header.subheaders)}
12 #else
13 1
14 #end if
15 #end for
16 #end if
17 </command>
18 <inputs>
19 <param name="input" type="data" format="tabular" label="Tabular data"/>
20 <conditional name="headerSource">
21 <param name="source" type="select" label="Header">
22 <option value="numbers">Column numbers</option>
23 <option value="names">Column names (if available)</option>
24 <option value="explicit">Specify headers and subheaders</option>
25 <option value="none">None</option>
26 </param>
27 <when value="numbers">
28 </when>
29 <when value="names">
30 </when>
31 <when value="explicit">
32 <repeat name="headers" title="Header">
33 <param name="name" type="text" label="Name">
34 <sanitizer>
35 <valid initial="string.printable">
36 <remove value="&lt;"/>
37 <remove value="&gt;"/>
38 </valid>
39 <mapping initial="none">
40 <add source="&lt;" target="&amp;lt;"/>
41 <add source="&gt;" target="&amp;gt;"/>
42 </mapping>
43 </sanitizer>
44 </param>
45 <repeat name="subheaders" title="Subheader">
46 <param name="name" type="text" label="Name"/>
47 </repeat>
48 </repeat>
49 </when>
50 <when value="none">
51 </when>
52 </conditional>
53 </inputs>
54 <outputs>
55 <data format="html" name="output"/>
56 </outputs>
57 <configfiles>
58 <configfile name="tableHeader">
59 &lt;html&gt;&lt;head&gt;&lt;style type="text/css"&gt;
60 table,td,th
61 {
62 border: 1px solid #dddddd;
63 border-collapse: collapse;
64 padding: 4px;
65 font-size: 10pt;
66 }
67 th{border-width:2px; background-color: #888888; color: #ffffff}
68 tr.odd {background-color: #f2fff2}
69 tr.even {background-color: #f2f2ff}
70 td.darkRight {border-right: 2px solid #888888}
71 &lt;/style&gt;&lt;/head&gt;&lt;body&gt;
72 &lt;table style="border-collapse:collapse"&gt;
73 #if $headerSource.source == 'numbers':
74 &lt;tr&gt;
75 #for $i in range(int($input.metadata.columns)):
76 &lt;th&gt;${i + 1}&lt;/th&gt;
77 #end for
78 &lt;/tr&gt;
79 #elif $headerSource.source == 'names' and hasattr($input.datatype, 'column_names'):
80 &lt;tr&gt;
81 #for $columnName in $input.datatype.column_names:
82 &lt;th&gt;$columnName&lt;/th&gt;
83 #end for
84 &lt;/tr&gt;
85 #elif $headerSource.source == 'explicit':
86 &lt;tr&gt;
87 #for $header in $headerSource.headers:
88 &lt;th
89 #if len($header.subheaders) > 0:
90 colspan="${len($header.subheaders)}"
91 #else
92 rowspan="2"
93 #end if
94 &gt;
95 $header.name
96 &lt;/th&gt;
97 #end for
98 &lt;tr&gt;
99 #for $header in $headerSource.headers:
100 #for $subheader in $header.subheaders:
101 &lt;th&gt;
102 ${subheader.name}
103 &lt;/th&gt;
104 #end for
105 #end for
106 &lt;/tr&gt;
107 #end if
108 </configfile>
109 </configfiles>
110 <help>
111 **===What it does===**
112
113 Wraps tabular data in an HTML table for easier viewing.
114
115 ------
116
117 **===Headers===**
118
119 **Column numbers** - The header will show the order of the columns.
120
121 **Column names** - The header will show column names if the data file is a
122 specific type of tabular file that has column names in
123 Galaxy (such as *sam* or *taxonomy*). Otherwise, no header will be shown.
124
125 **Specify headers and subheaders** - This allows custom headers, which can span
126 multiple columns if subheaders are included. For example, the tabular file::
127
128 1 2 3 4
129 read1 100 12345 50
130 read2 150 56789 60
131
132 ...with the headers and subheaders::
133
134 Query
135 ID
136 length
137 Hit
138 gi
139 score
140
141 ...would create an html table with the format:
142
143 +----------------+---------------+
144 | Query | Hit |
145 +-------+--------+-------+-------+
146 | ID | length | gi | score |
147 +=======+========+=======+=======+
148 | read1 | 100 | 12345 | 50 |
149 +-------+--------+-------+-------+
150 | read2 | 150 | 56789 | 60 |
151 +-------+--------+-------+-------+
152
153 </help>
154 </tool>