annotate utils.py @ 10:b0d893d04d4c draft default tip

planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
author goeckslab
date Mon, 08 Sep 2025 22:38:35 +0000
parents 9e912fce264c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
1 import base64
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
2 import json
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
3
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
4
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
5 def get_html_template():
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
6 """
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
7 Returns the opening HTML, <head> (with CSS/JS), and opens <body> + .container.
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
8 Includes:
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
9 - Base styling for layout and tables
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
10 - Sortable table headers with 3-state arrows (none ⇅, asc ↑, desc ↓)
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
11 - A scroll helper class (.scroll-rows-30) that approximates ~30 visible rows
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
12 - A guarded script so initializing runs only once even if injected twice
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
13 """
0
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
14 return """
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
15 <!DOCTYPE html>
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
16 <html>
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
17 <head>
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
18 <meta charset="UTF-8">
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
19 <title>Galaxy-Ludwig Report</title>
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
20 <style>
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
21 body {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
22 font-family: Arial, sans-serif;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
23 margin: 0;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
24 padding: 20px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
25 background-color: #f4f4f4;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
26 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
27 .container {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
28 max-width: 1200px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
29 margin: auto;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
30 background: white;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
31 padding: 20px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
32 box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
33 overflow-x: auto;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
34 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
35 h1 {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
36 text-align: center;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
37 color: #333;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
38 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
39 h2 {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
40 border-bottom: 2px solid #4CAF50;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
41 color: #4CAF50;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
42 padding-bottom: 5px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
43 margin-top: 28px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
44 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
45
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
46 /* baseline table setup */
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
47 table {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
48 border-collapse: collapse;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
49 margin: 20px 0;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
50 width: 100%;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
51 table-layout: fixed;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
52 background: #fff;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
53 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
54 table, th, td {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
55 border: 1px solid #ddd;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
56 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
57 th, td {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
58 padding: 10px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
59 text-align: center;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
60 vertical-align: middle;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
61 word-break: break-word;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
62 white-space: normal;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
63 overflow-wrap: anywhere;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
64 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
65 th {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
66 background-color: #4CAF50;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
67 color: white;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
68 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
69
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
70 .plot {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
71 text-align: center;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
72 margin: 20px 0;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
73 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
74 .plot img {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
75 max-width: 100%;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
76 height: auto;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
77 border: 1px solid #ddd;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
78 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
79
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
80 /* -------------------
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
81 sortable columns (3-state: none ⇅, asc ↑, desc ↓)
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
82 ------------------- */
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
83 table.performance-summary th.sortable {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
84 cursor: pointer;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
85 position: relative;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
86 user-select: none;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
87 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
88 /* default icon space */
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
89 table.performance-summary th.sortable::after {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
90 content: '⇅';
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
91 position: absolute;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
92 right: 12px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
93 top: 50%;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
94 transform: translateY(-50%);
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
95 font-size: 0.8em;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
96 color: #eaf5ea; /* light on green */
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
97 text-shadow: 0 0 1px rgba(0,0,0,0.15);
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
98 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
99 /* three states override the default */
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
100 table.performance-summary th.sortable.sorted-none::after { content: '⇅'; color: #eaf5ea; }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
101 table.performance-summary th.sortable.sorted-asc::after { content: '↑'; color: #ffffff; }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
102 table.performance-summary th.sortable.sorted-desc::after { content: '↓'; color: #ffffff; }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
103
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
104 /* show ~30 rows with a scrollbar (tweak if you want) */
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
105 .scroll-rows-30 {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
106 max-height: 900px; /* ~30 rows depending on row height */
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
107 overflow-y: auto; /* vertical scrollbar (“sidebar”) */
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
108 overflow-x: auto;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
109 }
8
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
110
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
111 /* Tabs + Help button (used by build_tabbed_html) */
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
112 .tabs {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
113 display: flex;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
114 align-items: center;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
115 border-bottom: 2px solid #ccc;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
116 margin-bottom: 1rem;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
117 gap: 6px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
118 flex-wrap: wrap;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
119 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
120 .tab {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
121 padding: 10px 20px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
122 cursor: pointer;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
123 border: 1px solid #ccc;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
124 border-bottom: none;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
125 background: #f9f9f9;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
126 margin-right: 5px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
127 border-top-left-radius: 8px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
128 border-top-right-radius: 8px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
129 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
130 .tab.active {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
131 background: white;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
132 font-weight: bold;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
133 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
134 .help-btn {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
135 margin-left: auto;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
136 padding: 6px 12px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
137 font-size: 0.9rem;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
138 border: 1px solid #4CAF50;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
139 border-radius: 4px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
140 background: #4CAF50;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
141 color: white;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
142 cursor: pointer;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
143 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
144 .tab-content {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
145 display: none;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
146 padding: 20px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
147 border: 1px solid #ccc;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
148 border-top: none;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
149 background: #fff;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
150 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
151 .tab-content.active {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
152 display: block;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
153 }
8
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
154
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
155 /* Modal (used by get_metrics_help_modal) */
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
156 .modal {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
157 display: none;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
158 position: fixed;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
159 z-index: 9999;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
160 left: 0; top: 0;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
161 width: 100%; height: 100%;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
162 overflow: auto;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
163 background-color: rgba(0,0,0,0.4);
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
164 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
165 .modal-content {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
166 background-color: #fefefe;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
167 margin: 8% auto;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
168 padding: 20px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
169 border: 1px solid #888;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
170 width: 90%;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
171 max-width: 900px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
172 border-radius: 8px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
173 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
174 .modal .close {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
175 color: #777;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
176 float: right;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
177 font-size: 28px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
178 font-weight: bold;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
179 line-height: 1;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
180 margin-left: 8px;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
181 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
182 .modal .close:hover,
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
183 .modal .close:focus {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
184 color: black;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
185 text-decoration: none;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
186 cursor: pointer;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
187 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
188 .metrics-guide h3 { margin-top: 20px; }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
189 .metrics-guide p { margin: 6px 0; }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
190 .metrics-guide ul { margin: 10px 0; padding-left: 20px; }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
191 </style>
8
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
192
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
193 <script>
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
194 // Guard to avoid double-initialization if this block is included twice
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
195 (function(){
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
196 if (window.__perfSummarySortInit) return;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
197 window.__perfSummarySortInit = true;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
198
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
199 function initPerfSummarySorting() {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
200 // Record original order for "back to original"
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
201 document.querySelectorAll('table.performance-summary tbody').forEach(tbody => {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
202 Array.from(tbody.rows).forEach((row, i) => { row.dataset.originalOrder = i; });
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
203 });
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
204
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
205 const getText = td => (td?.innerText || '').trim();
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
206 const cmp = (idx, asc) => (a, b) => {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
207 const v1 = getText(a.children[idx]);
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
208 const v2 = getText(b.children[idx]);
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
209 const n1 = parseFloat(v1), n2 = parseFloat(v2);
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
210 if (!isNaN(n1) && !isNaN(n2)) return asc ? n1 - n2 : n2 - n1; // numeric
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
211 return asc ? v1.localeCompare(v2) : v2.localeCompare(v1); // lexical
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
212 };
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
213
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
214 document.querySelectorAll('table.performance-summary th.sortable').forEach(th => {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
215 // initialize to “none”
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
216 th.classList.remove('sorted-asc','sorted-desc');
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
217 th.classList.add('sorted-none');
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
218
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
219 th.addEventListener('click', () => {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
220 const table = th.closest('table');
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
221 const headerRow = th.parentNode;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
222 const allTh = headerRow.querySelectorAll('th.sortable');
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
223 const tbody = table.querySelector('tbody');
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
224
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
225 // Determine current state BEFORE clearing
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
226 const isAsc = th.classList.contains('sorted-asc');
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
227 const isDesc = th.classList.contains('sorted-desc');
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
228
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
229 // Reset all headers in this row
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
230 allTh.forEach(x => x.classList.remove('sorted-asc','sorted-desc','sorted-none'));
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
231
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
232 // Compute next state
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
233 let next;
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
234 if (!isAsc && !isDesc) {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
235 next = 'asc';
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
236 } else if (isAsc) {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
237 next = 'desc';
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
238 } else {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
239 next = 'none';
8
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
240 }
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
241 th.classList.add('sorted-' + next);
8
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
242
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
243 // Sort rows according to the chosen state
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
244 const rows = Array.from(tbody.rows);
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
245 if (next === 'none') {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
246 rows.sort((a, b) => (a.dataset.originalOrder - b.dataset.originalOrder));
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
247 } else {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
248 const idx = Array.from(headerRow.children).indexOf(th);
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
249 rows.sort(cmp(idx, next === 'asc'));
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
250 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
251 rows.forEach(r => tbody.appendChild(r));
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
252 });
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
253 });
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
254 }
8
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
255
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
256 // Run after DOM is ready
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
257 if (document.readyState === 'loading') {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
258 document.addEventListener('DOMContentLoaded', initPerfSummarySorting);
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
259 } else {
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
260 initPerfSummarySorting();
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
261 }
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
262 })();
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
263 </script>
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
264 </head>
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
265 <body>
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
266 <div class="container">
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
267 """
0
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
268
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
269
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
270 def get_html_closing():
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
271 """Closes .container, body, and html."""
0
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
272 return """
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
273 </div>
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
274 </body>
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
275 </html>
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
276 """
0
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
277
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
278
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
279 def encode_image_to_base64(image_path: str) -> str:
0
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
280 """Convert an image file to a base64 encoded string."""
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
281 with open(image_path, "rb") as img_file:
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
282 return base64.b64encode(img_file.read()).decode("utf-8")
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
283
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
284
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
285 def json_to_nested_html_table(json_data, depth: int = 0) -> str:
0
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
286 """
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
287 Convert a JSON-able object to an HTML nested table.
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
288 Renders dicts as two-column tables (key/value) and lists as index/value rows.
0
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
289 """
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
290 # Base case: flat dict (no nested dict/list values)
0
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
291 if isinstance(json_data, dict) and all(
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
292 not isinstance(v, (dict, list)) for v in json_data.values()
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
293 ):
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
294 rows = [
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
295 f"<tr><th>{key}</th><td>{value}</td></tr>"
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
296 for key, value in json_data.items()
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
297 ]
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
298 return f"<table>{''.join(rows)}</table>"
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
299
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
300 # Base case: list of simple values
0
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
301 if isinstance(json_data, list) and all(
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
302 not isinstance(v, (dict, list)) for v in json_data
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
303 ):
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
304 rows = [
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
305 f"<tr><th>Index {i}</th><td>{value}</td></tr>"
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
306 for i, value in enumerate(json_data)
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
307 ]
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
308 return f"<table>{''.join(rows)}</table>"
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
309
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
310 # Recursive cases
0
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
311 if isinstance(json_data, dict):
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
312 rows = [
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
313 (
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
314 f"<tr><th style='text-align:left;padding-left:{depth * 20}px;'>{key}</th>"
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
315 f"<td>{json_to_nested_html_table(value, depth + 1)}</td></tr>"
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
316 )
0
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
317 for key, value in json_data.items()
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
318 ]
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
319 return f"<table>{''.join(rows)}</table>"
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
320
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
321 if isinstance(json_data, list):
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
322 rows = [
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
323 (
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
324 f"<tr><th style='text-align:left;padding-left:{depth * 20}px;'>[{i}]</th>"
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
325 f"<td>{json_to_nested_html_table(value, depth + 1)}</td></tr>"
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
326 )
0
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
327 for i, value in enumerate(json_data)
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
328 ]
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
329 return f"<table>{''.join(rows)}</table>"
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
330
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
331 # Primitive
0
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
332 return f"{json_data}"
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
333
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
334
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
335 def json_to_html_table(json_data) -> str:
0
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
336 """
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
337 Convert JSON (dict or string) into a vertically oriented HTML table.
0
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
338 """
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
339 if isinstance(json_data, str):
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
340 json_data = json.loads(json_data)
54b871dfc51e planemo upload for repository https://github.com/goeckslab/gleam.git commit b7411ff35b6228ccdfd36cd4ebd946c03ac7f7e9
goeckslab
parents:
diff changeset
341 return json_to_nested_html_table(json_data)
2
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
342
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
343
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
344 def build_tabbed_html(metrics_html: str, train_val_html: str, test_html: str) -> str:
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
345 """
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
346 Build a 3-tab interface:
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
347 - Config and Results Summary
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
348 - Train/Validation Results
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
349 - Test Results
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
350 Includes a persistent "Help" button that toggles the metrics modal.
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
351 """
2
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
352 return f"""
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
353 <div class="tabs">
8
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
354 <div class="tab active" onclick="showTab('metrics')">Config and Results Summary</div>
2
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
355 <div class="tab" onclick="showTab('trainval')">Train/Validation Results</div>
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
356 <div class="tab" onclick="showTab('test')">Test Results</div>
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
357 <button id="openMetricsHelp" class="help-btn" title="Open metrics help">Help</button>
2
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
358 </div>
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
359
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
360 <div id="metrics" class="tab-content active">
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
361 {metrics_html}
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
362 </div>
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
363 <div id="trainval" class="tab-content">
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
364 {train_val_html}
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
365 </div>
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
366 <div id="test" class="tab-content">
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
367 {test_html}
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
368 </div>
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
369
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
370 <script>
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
371 function showTab(id) {{
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
372 document.querySelectorAll('.tab-content').forEach(el => el.classList.remove('active'));
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
373 document.querySelectorAll('.tab').forEach(el => el.classList.remove('active'));
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
374 document.getElementById(id).classList.add('active');
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
375 // find tab with matching onclick target
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
376 document.querySelectorAll('.tab').forEach(t => {{
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
377 if (t.getAttribute('onclick') && t.getAttribute('onclick').includes(id)) {{
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
378 t.classList.add('active');
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
379 }}
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
380 }});
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
381 }}
2
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
382 </script>
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
383 """
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
384
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
385
186424a7eca7 planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
goeckslab
parents: 1
diff changeset
386 def get_metrics_help_modal() -> str:
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
387 """
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
388 Returns a ready-to-use modal with a comprehensive metrics guide and
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
389 the small script that wires the "Help" button to open/close the modal.
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
390 """
8
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
391 modal_html = (
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
392 '<div id="metricsHelpModal" class="modal">'
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
393 ' <div class="modal-content">'
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
394 ' <span class="close">×</span>'
9
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
395 " <h2>Model Evaluation Metrics — Help Guide</h2>"
8
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
396 ' <div class="metrics-guide">'
9
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
397 " <h3>1) General Metrics (Regression and Classification)</h3>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
398 " <p><strong>Loss (Regression & Classification):</strong> "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
399 "Measures the difference between predicted and actual values, "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
400 "optimized during training. Lower is better. "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
401 "For regression, this is often Mean Squared Error (MSE) or "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
402 "Mean Absolute Error (MAE). For classification, it’s typically "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
403 "cross-entropy or log loss.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
404 " <h3>2) Regression Metrics</h3>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
405 " <p><strong>Mean Absolute Error (MAE):</strong> "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
406 "Average of absolute differences between predicted and actual values, "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
407 "in the same units as the target. Use for interpretable error measurement "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
408 "when all errors are equally important. Less sensitive to outliers than MSE.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
409 " <p><strong>Mean Squared Error (MSE):</strong> "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
410 "Average of squared differences between predicted and actual values. "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
411 "Penalizes larger errors more heavily, useful when large deviations are critical. "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
412 "Often used as the loss function in regression.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
413 " <p><strong>Root Mean Squared Error (RMSE):</strong> "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
414 "Square root of MSE, in the same units as the target. "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
415 "Balances interpretability and sensitivity to large errors. "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
416 "Widely used for regression evaluation.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
417 " <p><strong>Mean Absolute Percentage Error (MAPE):</strong> "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
418 "Average absolute error as a percentage of actual values. "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
419 "Scale-independent, ideal for comparing relative errors across datasets. "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
420 "Avoid when actual values are near zero.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
421 " <p><strong>Root Mean Squared Percentage Error (RMSPE):</strong> "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
422 "Square root of mean squared percentage error. Scale-independent, "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
423 "penalizes larger relative errors more than MAPE. Use for forecasting "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
424 "or when relative accuracy matters.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
425 " <p><strong>R² Score:</strong> Proportion of variance in the target "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
426 "explained by the model. Ranges from negative infinity to 1 (perfect prediction). "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
427 "Use to assess model fit; negative values indicate poor performance "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
428 "compared to predicting the mean.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
429 " <h3>3) Classification Metrics</h3>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
430 " <p><strong>Accuracy:</strong> Proportion of correct predictions "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
431 "among all predictions. Simple but misleading for imbalanced datasets, "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
432 "where high accuracy may hide poor performance on minority classes.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
433 " <p><strong>Micro Accuracy:</strong> Sums true positives and true negatives "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
434 "across all classes before computing accuracy. Suitable for multiclass or "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
435 "multilabel problems with imbalanced data.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
436 " <p><strong>Token Accuracy:</strong> Measures how often predicted tokens "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
437 "(e.g., in sequences) match true tokens. Common in NLP tasks like text generation "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
438 "or token classification.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
439 " <p><strong>Precision:</strong> Proportion of positive predictions that are "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
440 "correct (TP / (TP + FP)). Use when false positives are costly, e.g., spam detection.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
441 " <p><strong>Recall (Sensitivity):</strong> Proportion of actual positives "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
442 "correctly predicted (TP / (TP + FN)). Use when missing positives is risky, "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
443 "e.g., disease detection.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
444 " <p><strong>Specificity:</strong> True negative rate (TN / (TN + FP)). "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
445 "Measures ability to identify negatives. Useful in medical testing to avoid "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
446 "false alarms.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
447 " <h3>4) Classification: Macro, Micro, and Weighted Averages</h3>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
448 " <p><strong>Macro Precision / Recall / F1:</strong> Averages the metric "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
449 "across all classes, treating each equally. Best for balanced datasets where "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
450 "all classes are equally important.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
451 " <p><strong>Micro Precision / Recall / F1:</strong> Aggregates true positives, "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
452 "false positives, and false negatives across all classes before computing. "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
453 "Ideal for imbalanced or multilabel classification.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
454 " <p><strong>Weighted Precision / Recall / F1:</strong> Averages metrics "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
455 "across classes, weighted by the number of true instances per class. Balances "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
456 "class importance based on frequency.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
457 " <h3>5) Classification: Average Precision (PR-AUC Variants)</h3>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
458 " <p><strong>Average Precision Macro:</strong> Precision-Recall AUC averaged "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
459 "equally across classes. Use for balanced multiclass problems.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
460 " <p><strong>Average Precision Micro:</strong> Global Precision-Recall AUC "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
461 "using all instances. Best for imbalanced or multilabel classification.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
462 " <p><strong>Average Precision Samples:</strong> Precision-Recall AUC averaged "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
463 "across individual samples. Ideal for multilabel tasks where samples have multiple "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
464 "labels.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
465 " <h3>6) Classification: ROC-AUC Variants</h3>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
466 " <p><strong>ROC-AUC:</strong> Measures ability to distinguish between classes. "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
467 "AUC = 1 is perfect; 0.5 is random guessing. Use for binary classification.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
468 " <p><strong>Macro ROC-AUC:</strong> Averages AUC across all classes equally. "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
469 "Suitable for balanced multiclass problems.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
470 " <p><strong>Micro ROC-AUC:</strong> Computes AUC from aggregated predictions "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
471 "across all classes. Useful for imbalanced or multilabel settings.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
472 " <h3>7) Classification: Confusion Matrix Stats (Per Class)</h3>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
473 " <p><strong>True Positives / Negatives (TP / TN):</strong> Correct predictions "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
474 "for positives and negatives, respectively.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
475 " <p><strong>False Positives / Negatives (FP / FN):</strong> Incorrect predictions "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
476 "— false alarms and missed detections.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
477 " <h3>8) Classification: Ranking Metrics</h3>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
478 " <p><strong>Hits at K:</strong> Measures whether the true label is among the "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
479 "top-K predictions. Common in recommendation systems and retrieval tasks.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
480 " <h3>9) Other Metrics (Classification)</h3>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
481 " <p><strong>Cohen's Kappa:</strong> Measures agreement between predicted and "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
482 "actual labels, adjusted for chance. Useful for multiclass classification with "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
483 "imbalanced data.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
484 " <p><strong>Matthews Correlation Coefficient (MCC):</strong> Balanced measure "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
485 "using TP, TN, FP, and FN. Effective for imbalanced datasets.</p>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
486 " <h3>10) Metric Recommendations</h3>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
487 " <ul>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
488 " <li><strong>Regression:</strong> Use <strong>RMSE</strong> or "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
489 "<strong>MAE</strong> for general evaluation, <strong>MAPE</strong> for relative "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
490 "errors, and <strong>R²</strong> to assess model fit. Use <strong>MSE</strong> or "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
491 "<strong>RMSPE</strong> when large errors are critical.</li>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
492 " <li><strong>Classification (Balanced Data):</strong> Use <strong>Accuracy</strong> "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
493 "and <strong>F1</strong> for overall performance.</li>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
494 " <li><strong>Classification (Imbalanced Data):</strong> Use <strong>Precision</strong>, "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
495 "<strong>Recall</strong>, and <strong>ROC-AUC</strong> to focus on minority class "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
496 "performance.</li>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
497 " <li><strong>Multilabel or Imbalanced Classification:</strong> Use "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
498 "<strong>Micro Precision/Recall/F1</strong> or <strong>Micro ROC-AUC</strong>.</li>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
499 " <li><strong>Balanced Multiclass:</strong> Use <strong>Macro Precision/Recall/F1</strong> "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
500 "or <strong>Macro ROC-AUC</strong>.</li>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
501 " <li><strong>Class Frequency Matters:</strong> Use <strong>Weighted Precision/Recall/F1</strong> "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
502 "to account for class imbalance.</li>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
503 " <li><strong>Recommendation/Ranking:</strong> Use <strong>Hits at K</strong> for retrieval tasks.</li>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
504 " <li><strong>Detailed Analysis:</strong> Use <strong>Confusion Matrix stats</strong> "
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
505 "for class-wise performance in classification.</li>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
506 " </ul>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
507 " </div>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
508 " </div>"
9e912fce264c planemo upload for repository https://github.com/goeckslab/gleam.git commit eace0d7c2b2939029c052991d238a54947d2e191
goeckslab
parents: 8
diff changeset
509 "</div>"
8
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
510 )
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
511
8
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
512 modal_js = (
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
513 "<script>"
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
514 "document.addEventListener('DOMContentLoaded', function() {"
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
515 " var modal = document.getElementById('metricsHelpModal');"
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
516 " var openBtn = document.getElementById('openMetricsHelp');"
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
517 " var closeBtn = modal ? modal.querySelector('.close') : null;"
8
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
518 " if (openBtn && modal) {"
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
519 " openBtn.addEventListener('click', function(){ modal.style.display = 'block'; });"
8
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
520 " }"
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
521 " if (closeBtn && modal) {"
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
522 " closeBtn.addEventListener('click', function(){ modal.style.display = 'none'; });"
8
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
523 " }"
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
524 " window.addEventListener('click', function(ev){"
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
525 " if (ev.target === modal) { modal.style.display = 'none'; }"
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
526 " });"
8
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
527 "});"
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
528 "</script>"
85e6f4b2ad18 planemo upload for repository https://github.com/goeckslab/gleam.git commit 8a42eb9b33df7e1df5ad5153b380e20b910a05b6
goeckslab
parents: 2
diff changeset
529 )
10
b0d893d04d4c planemo upload for repository https://github.com/goeckslab/gleam.git commit 1594d503179f28987720594eb49b48a15486f073
goeckslab
parents: 9
diff changeset
530 return modal_html + modal_js