-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpecies_list.html
184 lines (144 loc) · 6.89 KB
/
Species_list.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Species list</title>
<link rel="canonical" href="https://getbootstrap.com/docs/5.0/examples/navbar-fixed/">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href= "https://cdn.datatables.net/1.13.4/css/dataTables.bootstrap5.min.css">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.js"> </script>
<script type="text/javascript" src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"> </script>
<script type="text/javascript" src="https://cdn.datatables.net/1.13.4/js/dataTables.bootstrap5.min.js"> </script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
<!-- Bootstrap core CSS -->
<link href="./assets/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
.table_padding{
padding-top:15px;
padding-bottom:15px;
padding-right:120px;
padding-left:120px;
}
th, td{
height:50px;
font-size: 18px;
}
</style>
<!-- Custom styles for this template -->
<link href="navbar-top-fixed.css" rel="stylesheet">
</head>
<body data-bs-spy="scroll" data-bs-target="#navbar-example">
<!-- Nav -->
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="./index.html">PanKB</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav me-auto mb-2 mb-md-0">
<li class="nav-item">
<a class="nav-link " aria-current="page" href="./About.html">About</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="./Species_list.html">Species</a>
</li>
<li class="nav-item">
<a class="nav-link " href="#">Download</a>
</li>
<li class="nav-item">
<a class="nav-link" href="./Publications.html" tabindex="-1" aria-disabled="true">Publications</a>
</li>
</ul>
</div>
</div>
</nav>
<script src="./assets/dist/js/bootstrap.bundle.min.js"></script>
<!-- Nav -->
<!-- Datatable -->
<div class="table_padding">
<table id="species_list" class="table table-hover" style="width:100%; table-layout: fixed;">
<thead>
<tr>
<th class="text-center align-middle">Species</th>
<th class="text-center align-middle">Openness</th>
<th class="text-center align-middle">Gene class distribution</th>
<th class="text-center align-middle">Number of genomes</th>
<th class="text-center align-middle">Pangenome analyses</th>
</tr>
</thead>
<tbody id="table-body"></tbody>
</table>
</div>
<!-- Datatable -->
<div id="loadingModal" class="modal" tabindex="-1" role="dialog" style="display:none; background-color: rgba(0,0,0,0.75);">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<p>Loading, please wait...</p>
</div>
</div>
</div>
</div>
<script>
// Load the JSON file
fetch('https://pankb.blob.core.windows.net/data/PanKB/web_data/species_list.json')
.then(response => response.json())
.then(data => {
const tableBody = document.getElementById('table-body');
// Iterate over each species
data.Species.forEach((species, index) => {
const total = data.Gene_class[index][0] + data.Gene_class[index][1] + data.Gene_class[index][2];
const coreWidth = (data.Gene_class[index][0] / total) * 100;
const accessoryWidth = (data.Gene_class[index][1] / total) * 100;
const rareWidth = (data.Gene_class[index][2] / total) * 100;
const row = document.createElement('tr');
row.innerHTML = `
<td class="text-center align-middle">${species}</td>
<td class="text-center align-middle">${data.Openness[index]}</td>
<td class="text-center align-middle">
<div style="display: flex; height: 20px; max-width: 80%; margin: auto; border-radius: 10px; overflow: hidden;">
<div style="width: ${coreWidth}%; background-color: rgba(128,0,128,0.8);" data-toggle="tooltip" title="Core: ${data.Gene_class[index][0]}"></div>
<div style="width: ${accessoryWidth}%; background-color: rgba(255,165,0,0.8);" data-toggle="tooltip" title="Accessory: ${data.Gene_class[index][1]}"></div>
<div style="width: ${rareWidth}%; background-color: rgba(0,128,0,0.8);" data-toggle="tooltip" title="Rare: ${data.Gene_class[index][2]}"></div>
</div>
</td>
<td class="text-center align-middle">${data.N_of_genome[index]}</td>
<td class="text-center align-middle">
<a id="${data.Pangenome_analyses[index]}" href="#" onclick="handleLinkClick(event, '${data.Pangenome_analyses[index]}')">${data.Pangenome_analyses[index]}</a>
</td>
`;
tableBody.appendChild(row);
});
// Initialize tooltips
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
// Initialize DataTable
$('#species_list').DataTable();
})
.catch(error => console.error(error));
function handleLinkClick(e, species) {
// Prevent the default link behavior
e.preventDefault();
// Navigate to the new page
window.location.href = `./Pangenome_analyses_overview.html?species=${species}`;
}
window.addEventListener('pageshow', function(event) {
// Hide the loading modal
document.getElementById('loadingModal').style.display = 'none';
});
</script>
</script>
</body>
</html>