comparison templates/template2.tmpl @ 0:a61ee7b075c0 draft default tip

"planemo upload for repository https://github.com/public-health-bioinformatics/galaxy_tools/blob/master/tools/blast_report_basic commit b9c92df78fd78bf5881ab0cc5f5692d2bc71f5f6"
author public-health-bioinformatics
date Tue, 03 Mar 2020 06:11:45 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:a61ee7b075c0
1 #silent import time
2 #set $display_m = 20
3 #set $header = '<tr class="header"><th>Accession</th><th>Description</th><th>Score</th><th>% Coverage</th><th>% Identity</th></tr>'
4 <html>
5 <head>
6 <style>
7 body {
8 font-size:0.75em;
9 }
10 table, tr {
11 width: 100%;
12 }
13 table {
14 border-collapse: collapse;
15 border: 1px solid black;
16 }
17 tr.header {
18 background-color: lightgrey;
19 }
20 th {
21 border: 1px solid black;
22 }
23 td {
24 border-left: 1px solid black;
25 border-right: 1px solid black;
26 border-bottom: 1px dashed grey;
27 }
28 td.descr {
29 font-size: 80%;
30 }
31 h3 {
32 page-break-before: always;
33 color: blue;
34 }
35 h3.first {
36 page-break-before: avoid;
37 }
38 span.super {
39 color: navy;
40 font-size: 75%;
41 vertical-align: top;
42 }
43 </style>
44 <script>
45 function toggle(id){
46 var element = document.getElementById(id)
47 console.log(id)
48 if (element.style.display == 'none') {
49 //console.log(element.tagName);
50 if (element.tagName == 'TBODY') element.style.display = 'table-row-group';
51 else if (element.tagName == 'TD') element.style.display = 'table-cell';
52 else element.style.display = 'block';
53 } else {
54 element.style.display = 'none';
55 }
56 }
57 </script>
58 </head>
59 <body>
60 #set $q = 0
61 #for $query in $queries
62 #set $bin_symbols = dict([($bin,$i) for $i, $bin in enumerate($query.bins, 1)])
63 #set $m = 0
64 <h3 id="${query.query_id}" #if $q == 0 then'class="first"' else '' #>$query.query_id</h3>
65 <br/>
66 <table id="${query.query_id}_matches">
67 #set $num_of_euzby = -1
68 #if len($query.matches) == 0:
69 <tr class="header"><th colspan="5">No matches to report</th></tr>
70 </table>
71 #else:
72 $header
73 #try
74 #set $priority = $query.bins['Euzby']
75 #set $front = []
76 #for $i in reversed($priority)
77 #silent $front.append($query.matches.pop($i))
78 #end for
79 #set $num_of_euzby = len($front)
80 #silent $front.reverse()
81 #silent $front.extend($query.matches)
82 #set $query.matches = $front
83 #except
84 #pass
85 #end try
86 #for $match in $query.matches:
87 #if $m == $display_m
88 <tbody id="${query.query_id}_extra" style="display:none">
89 #end if
90 ##if $m>0 and set($match.bins)!=set($query.matches[m-1].bins)
91 ##put an empty line to separate Euzby records from other records
92 #if $m==$num_of_euzby and $m>0
93 <tr><td align="center" colspan="6">&nbsp;</td></tr>
94 #end if
95 <tr>
96 <td>$match.subject_acc <span class="super">#echo ', '.join(sorted([str($bin_symbols[$bin]) for $bin in $match.bins]))#</span></td>
97 <td class="descr">$match.subject_descr</td>
98 <td>$match.score</td>
99 <td>$match.p_cov</td>
100 <td>$match.p_ident</td>
101 </tr>
102 #set $m += 1
103 #end for
104 #if $m >= $display_m
105 </tbody>
106 <td id="${query.query_id}_show" align="center" colspan="6" >Displaying ${display_m}/$m matches. <a href="#${query.query_id}_extra" onclick="toggle('${query.query_id}_extra'); toggle('${query.query_id}_show'); toggle('${query.query_id}_hide');">Show the remaining results.</a></td>
107 <td id="${query.query_id}_hide" align="center" colspan="6" style="display:none"><a href="#${query.query_id}" onclick="toggle('${query.query_id}_extra'); toggle('${query.query_id}_show'); toggle('${query.query_id}_hide');">Hide the last #echo $m - $display_m # results.</a></td>
108 <tr>
109 </tr>
110 #end if
111 </table>
112 #if len($bin_symbols) > 0:
113 <p>#echo ', '.join(['<span class="super">%s</span> %s'%($bin_symbols[$bin],$bin) for $bin in $query.bins])#</p>
114 #end if
115 #end if
116 #if $query.pident_filtered > 0:
117 <p>$query.pident_filtered results filtered by % Identity.</p>
118 #end if
119 #if $query.kw_filtered > 0:
120 <p>$query.kw_filtered results filtered by description keywords: #echo ', '.join(list(["%s matches to '%s'" % (str($query.kw_filtered_breakdown[$kw]),$kw) for $kw in $query.kw_filtered_breakdown])) #.</p>
121 #end if
122 <p>Report produced on #echo time.strftime("%d/%m/%Y") #.</p>
123 <hr noshade size="1" color="blue">
124 #set $q += 1
125 #end for
126 </body>
127 </html>