-
Notifications
You must be signed in to change notification settings - Fork 0
/
ampdb-text-search-result.php
447 lines (410 loc) · 21 KB
/
ampdb-text-search-result.php
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="logo.png" type="image/x-icon">
<title>AMPDB Text Search Result</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.1.3/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.datatables.net/1.13.3/css/dataTables.bootstrap5.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.datatables.net/1.13.3/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.13.3/js/dataTables.bootstrap5.min.js"></script>
<link rel="stylesheet" href="ss.css">
<link rel="stylesheet" href="scr.css">
</head>
<body>
<nav class="navbar navbar-expand-sm navbar-dark bg-dark fixed-top">
<div class="container-fluid">
<a class="navbar-brand fs-3" href="ampdb-home">AMPDB v1</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mynavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="mynavbar">
<ul class="navbar-nav me-auto">
<li class="nav-item">
<a class="nav-link" href="ampdb-home">Home</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle active" href="#" role="button" data-bs-toggle="dropdown">Search</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="ampdb-text-search">Text
Search</a></li>
<li><a class="dropdown-item" href="ampdb-specific-search">Specific Text
Search</a></li>
<li><a class="dropdown-item" href="ampdb-target-organism-search">Search by
Target
Organism</a></li>
<li><a class="dropdown-item" href="ampdb-pp-search">Search by
Physicochemical Properties</a>
</li>
<li><a class="dropdown-item" href="ampdb-composition-search">Search by
Protein
Composition</a>
</li>
<li><a class="dropdown-item" href="ampdb-activity-search">Search
by Activity</a></li>
<li><a class="dropdown-item" href="ampdb-advanced-search">Advanced Search</a>
</li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link " href="browse-all-data">Browse</a>
</li>
<li class="nav-item">
<a class="nav-link" href="ampdb-classification">Classification</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">Tools</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="https://ampdb-protein-sequence-alignment-toolbox.streamlit.app/" target="_blank">Protein Sequence Alignment
Toolbox</a></li>
<li><a class="dropdown-item" href="https://ampdb-protein-feature-calculation-toolbox.streamlit.app/" target="_blank">Protein Feature Calculation
Toolbox</a></li>
</ul>
<li class="nav-item">
<a class="nav-link" href="ampdb-data-stat">Statistics</a>
</li>
<li class="nav-item">
<a class="nav-link" href="ampdb-downloads">Downloads</a>
</li>
<li class="nav-item">
<a class="nav-link" href="ampdb-news">News/Updates</a>
</li>
<li class="nav-item">
<a class="nav-link" href="developers">Developers</a>
</li>
<li class="nav-item">
<a class="nav-link" href="ampdb-tutorial">Tutorial</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact">Contact</a>
</li>
</ul>
<form class="d-flex" action="ampdb-quick-search-result" method="get">
<input name="term" class="form-control me-2" type="text" placeholder="Quick Search">
<input type="submit" value="Search" name="search" class="btn btn-primary">
</form>
</div>
</div>
</nav>
<br><br>
<div class="container-fluid">
<div class="row justify-content-center">
<div class="col-lg-19 bg-light rounded my-2 py-2">
<h4 class="text-center text-success" style="font-size: 500; margin-top: 2%;"> AMPDB Text Search Result
</h4>
<div style="margin-left:5%; margin-right:5%;"><b style="font-weight: 500;">Search Term: </b><?php if (strlen($_GET['term']) == 0) {
echo "*";
} else {
echo $_GET['term'];
} ?>, <span id="num-rec"></span></div>
<div style="margin-left:5%;"><b style="font-weight: 500;">Dataset: </b><?php echo str_replace('`', '', str_replace('.tsv', '', str_replace('master', 'AMPDB v1 Master Dataset', explode("[", $_GET['ds'])[0]))); ?>, <b style="font-weight: 500;">Dataset Size: </b><?php echo explode("[", $_GET['ds'])[1] ?></div>
<div class="container-fluid">
<div class="row">
<div class="col-sm-6">
<span id="search-term"></span>
</div>
</div>
</div>
</div>
<hr>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-sm">
<form id="myForm" method="post" action="request">
<div style="margin-left: 5%;">
<button class="btn btn-sm btn-primary" style="margin-top: 1%;" type="button" data-bs-toggle="offcanvas" data-bs-target="#demo">
Filter By
</button>
<button class="btn btn-sm btn-warning " style="margin-top: 1%;" type="button" data-bs-toggle="" data-bs-target="" onclick="toggleCheckboxes(document.querySelectorAll('input[type=checkbox][name=ampdbid]'))">Select
All</button>
<input name="ids" type="text" id="result" style="display: none;">
<input name="allids" type="text" id="allids" style="display: none;">
<input name="ui" class="btn btn-sm btn-success" style="margin-top: 1%;" type="submit" value="Download Selected">
<input name="ui" class="btn btn-sm btn-success" style="margin-top: 1%;" type="submit" value="Download All">
</div>
</form>
</div>
</div>
</div>
<div class="offcanvas offcanvas-start" id="demo">
<div class="offcanvas-header">
<div style="font-weight: 500; font-size: x-large;">Filter Search result</div>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas"></button>
</div>
<div class="offcanvas-body">
<form onsubmit="submitForm(); return false;">
<div>
<button type="submit" class="float-end btn btn-sm btn-success me-2">Apply</button>
<button class="btn btn-sm btn-danger float-end me-1" onclick="removePreChecked()">Clear</button>
<button onclick="uncheckRadios()" type="button" data-bs-toggle="" data-bs-target="" class="btn btn-sm border border-2 float-end me-1" style="background-color: #F0F8FF;">Uncheck
<input class="form-check-input" type="radio" checked></button>
</div>
<input name="term" type="text" value="<?php echo $_GET['term']; ?>" style="display: none">
<input type="text" name="ds" value="<?php echo $_GET['ds']; ?>" style="display: none">
<br>
<div style="margin-top: 6.5%;" id="records-info"></div>
</form>
</div>
</div>
<div class="container-fluid" id="data" style="width: 90%;">
</div>
<div class="container d-flex justify-content-center">
<div class="spinner-border m-5 text-success" id="loading" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
<script>
function uncheckRadios() {
var radioButtons = document.querySelectorAll('input[type="radio"]');
radioButtons.forEach(function(radio) {
radio.checked = false;
});
}
function removePreChecked() {
var radioButtons = document.querySelectorAll('input[type="radio"]');
var checkboxes = document.querySelectorAll('input[type="checkbox"]');
radioButtons.forEach(function(radio) {
radio.checked = false;
});
checkboxes.forEach(function(checkbox) {
checkbox.checked = false;
});
}
function updateTextbox(checkbox) {
var resultTextbox = document.getElementById("result");
var checkboxValue = checkbox.value;
if (checkbox.checked) {
if (resultTextbox.value === '') {
resultTextbox.value += checkboxValue;
} else {
resultTextbox.value += ',' + checkboxValue;
}
} else {
var currentValue = resultTextbox.value;
var newValue = currentValue
.replace(checkboxValue + ',', '')
.replace(',' + checkboxValue, '')
.replace(checkboxValue, '');
resultTextbox.value = newValue;
}
}
function uncheckCheckbox() {
var checkbox = document.querySelector('input[name="sort"]');
checkbox.checked = false;
}
function toggleCheckboxes() {
const checkboxes = document.querySelectorAll('input[type=checkbox][name=ampdbid]');
const isChecked = checkboxes[0].checked;
const checkedValues = [];
for (let i = 0; i < checkboxes.length; i++) {
checkboxes[i].checked = !isChecked;
if (checkboxes[i].checked) {
checkedValues.push(checkboxes[i].value);
}
}
const resultInput = document.getElementById('result');
resultInput.value = checkedValues.join(',');
}
function getAllParameterValues(parameterName) {
var url = window.location.href;
var queryString = url.substring(url.indexOf('?') + 1);
var parameterPairs = queryString.split('&');
var parameterValues = [];
for (var i = 0; i < parameterPairs.length; i++) {
var pair = parameterPairs[i].split('=');
var name = decodeURIComponent(pair[0]);
var value = decodeURIComponent(pair[1]);
if (name === parameterName) {
parameterValues.push(value);
}
}
return parameterValues.join(",").replace(/\+/g, " ");
}
const term = getAllParameterValues('term');
const ds = getAllParameterValues('ds');
const activity = getAllParameterValues('activity');
const target = getAllParameterValues('target');
const organism = getAllParameterValues('organism');
const exist = getAllParameterValues('exist');
const lengthA = getAllParameterValues('length');
const sort = getAllParameterValues('sort')
const ad = getAllParameterValues('ad');
$.ajax({
url: "text-all-ids-browse-all-data.php",
type: "POST",
data: {
term: term,
ds: ds,
activity: activity,
target: target,
organism: organism,
exist: exist,
length: lengthA,
sort: sort,
ad: ad
},
success: function(result) {
document.getElementById("allids").value = result;
}
});
const term1 = getAllParameterValues('term');
const ds1 = getAllParameterValues('ds');
const activity1 = getAllParameterValues('activity');
const target1 = getAllParameterValues('target');
const organism1 = getAllParameterValues('organism');
const exist1 = getAllParameterValues('exist');
const length1 = getAllParameterValues('length');
const sort1 = getAllParameterValues('sort')
const ad1 = getAllParameterValues('ad');
$.ajax({
url: "text-count-browse-all-data.php",
type: "POST",
data: {
term: term1,
ds: ds1,
activity: activity1,
target: target1,
organism: organism1,
exist: exist1,
length: length1,
sort: sort1,
ad: ad1
},
success: function(result) {
if (result.length == 0) {
document.getElementById("num-rec").innerHTML = '<b style="font-weight: 500; color: red;">Warning: Query is not properly build. Some undesired character(s) may present in the query. Unable to show result!</b>';
} else {
document.getElementById("num-rec").innerHTML = '<b style="font-weight: 500;">Total Records Found: </b>' + result;
var myR = result;
$(window).scroll(function() {
if (myR > 0) {
if ($(window).scrollTop() + $(window).height() > $(document).height() - 220) {
if (!isrunning) {
showdata();
myR -= 10;
}
}
}
});
}
}
});
const term2 = getAllParameterValues('term');
const ds2 = getAllParameterValues('ds');
const activity2 = getAllParameterValues('activity');
const target2 = getAllParameterValues('target');
const organism2 = getAllParameterValues('organism');
const exist2 = getAllParameterValues('exist');
const length2 = getAllParameterValues('length');
const sort2 = getAllParameterValues('sort')
const ad2 = getAllParameterValues('ad');
$.ajax({
url: "text-option-browse-all-data.php",
type: "POST",
data: {
term: term2,
ds: ds2,
activity: activity2,
target: target2,
organism: organism2,
exist: exist2,
length: length2,
sort: sort2,
ad: ad2
},
success: function(result) {
document.getElementById("records-info").innerHTML = result;
}
});
const term3 = getAllParameterValues('term');
const ds3 = getAllParameterValues('ds');
const activity3 = getAllParameterValues('activity');
const target3 = getAllParameterValues('target');
const organism3 = getAllParameterValues('organism');
const exist3 = getAllParameterValues('exist');
const length3 = getAllParameterValues('length');
const sort3 = getAllParameterValues('sort');
const ad3 = getAllParameterValues('ad');
var page_no = 1;
var isrunning = false;
showdata();
function showdata() {
isrunning = true;
$("#loading").show();
$.post("text-data-browse-all-data.php", {
term: term3,
ds: ds3,
page: page_no,
activity: activity3,
target: target3,
organism: organism3,
exist: exist3,
length: length3,
sort: sort3,
ad: ad3
}, (response) => {
$("#data").append(response);
$("#loading").hide();
isrunning = false;
page_no++;
});
}
function submitForm() {
const checkboxes1 = document.querySelectorAll('input[type="checkbox"][name="activity"]:checked');
const values1 = [];
checkboxes1.forEach((checkbox) => {
values1.push(checkbox.value);
});
const urlParams1 = new URLSearchParams(window.location.search);
urlParams1.set('activity', values1.join(','));
const checkboxes2 = document.querySelectorAll('input[type="checkbox"][name="target"]:checked');
const values2 = [];
checkboxes2.forEach((checkbox) => {
values2.push(checkbox.value);
});
const urlParams2 = new URLSearchParams(window.location.search);
urlParams2.set('target', values2.join(','));
const checkboxes3 = document.querySelectorAll('input[type="checkbox"][name="organism"]:checked');
const values3 = [];
checkboxes3.forEach((checkbox) => {
values3.push(checkbox.value);
});
const urlParams3 = new URLSearchParams(window.location.search);
urlParams3.set('organism', values3.join(','));
const checkboxes4 = document.querySelectorAll('input[type="checkbox"][name="exist"]:checked');
const values4 = [];
checkboxes4.forEach((checkbox) => {
values4.push(checkbox.value);
});
const urlParams4 = new URLSearchParams(window.location.search);
urlParams4.set('exist', values4.join(','));
const checkboxes5 = document.querySelectorAll('input[type="radio"][name="length"]:checked');
const values5 = [];
checkboxes5.forEach((checkbox) => {
values5.push(checkbox.value);
});
const urlParams5 = new URLSearchParams(window.location.search);
urlParams5.set('length', values5.join(','));
const radioButton = document.querySelector('input[type="radio"][name="sort"]:checked');
const value2 = radioButton ? radioButton.value : '';
const urlParams6 = new URLSearchParams(window.location.search);
urlParams6.set('sort', value2);
const radioButton7 = document.querySelector('input[type="radio"][name="ad"]:checked');
const value7 = radioButton7 ? radioButton7.value : '';
const urlParams7 = new URLSearchParams(window.location.search);
urlParams7.set('ad', value7);
const the_Ids = document.getElementById('base').innerHTML;
window.location.href = new 'ampdb-text-search-result?' + the_Ids + urlParams1.toString() + '&' + urlParams2.toString() + '&' + urlParams3.toString() + '&' + urlParams4.toString() + '&' + urlParams5.toString() + '&' + urlParams6.toString() + '&' + urlParams7.toString();
}
</script>
<br><br><br>
<footer class="mt-3 text-center p-2 text-white" style="position: fixed; background-color: #5A6F80; font-size: small; left: 0; bottom: 0; width: 100%;">
© 2023 B&BL, DoAS, IIIT-A, UP-211015, India
</footer>
</body>
</html>