nonzeroexit commited on
Commit
2feaf5f
·
verified ·
1 Parent(s): 64f4cf4

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +1049 -934
index.html CHANGED
@@ -1,5 +1,4 @@
1
  <!DOCTYPE html>
2
-
3
  <html lang="en">
4
  <head>
5
  <meta charset="UTF-8">
@@ -10,608 +9,605 @@
10
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
11
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.23/jspdf.plugin.autotable.min.js"></script>
12
 
13
- <style>
14
- :root {
15
- --primary-color: #004d40; /* Dark Teal */
16
- --secondary-color: #00897b; /* Teal */
17
- --success-color: #4caf50; /* Green */
18
- --warning-color: #ff9800; /* Orange */
19
- --info-color: #2196f3; /* Blue */
20
- --background-color: #f0f4c3; /* Light Lime */
21
- --text-color: #333; /* Dark Gray */
22
- --container-bg-color: #ffffff; /* White */
23
- --border-color: #bdbdbd; /* Light Gray */
24
- --button-hover-bg: #00695c; /* Darker Teal */
25
- --clear-button-bg: #f44336; /* Red */
26
- --clear-button-hover-bg: #d32f2f; /* Darker Red */
27
- --analyze-button-bg: #00897b; /* Teal */
28
- --analyze-button-hover-bg: #00695c; /* Darker Teal */
29
- }
30
-
31
- /* Optional Dark Mode /
32
- .dark-mode {
33
- --primary-color: #b2dfdb; / Light Teal /
34
- --secondary-color: #4db6ac; / Medium Teal /
35
- --success-color: #81c784; / Light Green /
36
- --warning-color: #ffcc80; / Light Orange /
37
- --info-color: #90caf9; / Light Blue /
38
- --background-color: #212121; / Dark Gray /
39
- --text-color: #eee; / Light Gray /
40
- --container-bg-color: #424242;/ Darker Gray /
41
- --border-color: #616161; / Medium Gray /
42
- --button-hover-bg: #004d40; / Dark Teal /
43
- --clear-button-bg: #e57373; / Light Red /
44
- --clear-button-hover-bg: #f44336; / Red /
45
- --analyze-button-bg: #4db6ac; / Medium Teal /
46
- --analyze-button-hover-bg: #009688; / Teal */
47
- }
48
-
49
-
50
- body {
51
- font-family: 'Arial', sans-serif;
52
- line-height: 1.6;
53
- margin: 0;
54
- padding: 20px;
55
- min-height: 100vh;
56
- display: flex;
57
- flex-direction: column;
58
- align-items: center;
59
- background-color: var(--background-color);
60
- color: var(--text-color);
61
- transition: background-color 0.3s ease, color 0.3s ease;
62
- }
63
-
64
- .container {
65
- max-width: 800px;
66
- width: 100%;
67
- padding: 2rem;
68
- background: var(--container-bg-color);
69
- border-radius: 10px;
70
- box-shadow: 0 2px 15px rgba(0,0,0,0.1);
71
- text-align: center;
72
- transition: background-color 0.3s ease;
73
- display: flex;
74
- flex-direction: column;
75
- margin-bottom: 20px;
76
- }
77
-
78
- .input-group {
79
- margin-bottom: 1.5rem;
80
- position: relative;
81
- }
82
-
83
- #sequence {
84
- width: 100%;
85
- height: 150px;
86
- padding: 1rem;
87
- border: 2px solid var(--border-color);
88
- border-radius: 8px;
89
- font-family: monospace;
90
- font-size: 1rem;
91
- resize: vertical;
92
- transition: border-color 0.3s ease, background-color 0.3s ease;
93
- background-color: var(--container-bg-color);
94
- color: var(--text-color);
95
- box-sizing: border-box;
96
- }
97
-
98
- #file-input {
99
- margin-bottom: 1rem;
100
- }
101
-
102
- #sequence:focus {
103
- outline: none;
104
- border-color: var(--secondary-color);
105
- }
106
-
107
- button {
108
- color: white;
109
- border: none;
110
- padding: 0.8rem 2rem;
111
- border-radius: 5px;
112
- cursor: pointer;
113
- font-size: 1rem;
114
- transition: transform 0.2s ease, background-color 0.3s ease;
115
- /* margin-top: 1rem; Removed individual margin-top for buttons */
116
- }
117
- .button-group button{
118
- margin: 0 0.2rem;
119
- }
120
-
121
- button:hover {
122
- transform: translateY(-1px);
123
- }
124
-
125
- #clear-btn {
126
- background-color: var(--clear-button-bg);
127
- }
128
-
129
- #clear-btn:hover {
130
- background-color: var(--clear-button-hover-bg);
131
- }
132
-
133
- #predict-btn {
134
- background-color: var(--analyze-button-bg);
135
- min-width: 230px; /* To accommodate count-up text better */
136
- }
137
-
138
- #predict-btn:hover {
139
- background-color: var(--analyze-button-hover-bg);
140
- }
141
-
142
-
143
- .character-count {
144
- text-align: right;
145
- color: var(--text-color);
146
- font-size: 0.9rem;
147
- margin-top: 0.5rem;
148
- }
149
-
150
-
151
- .error-message {
152
- color: var(--warning-color);
153
- text-align: center;
154
- margin-top: 1rem;
155
- display: none;
156
- }
157
-
158
-
159
- .result {
160
- margin-top: 1.5rem;
161
- font-size: 1.2rem;
162
- font-weight: bold;
163
- color: var(--primary-color);
164
- text-align: center;
165
- }
166
-
167
- .info-icon {
168
- position: absolute;
169
- top: 1rem;
170
- right: 1rem;
171
- font-size: 1.2rem;
172
- color: var(--info-color);
173
- cursor: pointer;
174
- }
175
-
176
- .tooltip {
177
- position: absolute;
178
- top: 100%;
179
- right: 0;
180
- background-color: rgba(0, 0, 0, 0.8);
181
- color: white;
182
- padding: 0.5rem;
183
- border-radius: 5px;
184
- display: none;
185
- z-index: 10;
186
- width: 250px;
187
- text-align: left;
188
- font-size: 0.9rem;
189
- line-height: 1.4;
190
- }
191
-
192
- .info-icon:hover + .tooltip,
193
- .tooltip:hover {
194
- display: block;
195
- }
196
-
197
- @keyframes fadeIn {
198
- from { opacity: 0; transform: translateY(-10px); }
199
- to { opacity: 1; transform: translateY(0); }
200
- }
201
-
202
- .result.show {
203
- animation: fadeIn 0.5s ease forwards;
204
- }
205
-
206
- .tabs {
207
- display: flex;
208
- justify-content: center;
209
- margin-bottom: 1rem;
210
- border-bottom: 2px solid var(--border-color);
211
- }
212
-
213
- .tab {
214
- padding: 0.5rem 1rem;
215
- margin: 0 0.5rem;
216
- cursor: pointer;
217
- border: 2px solid transparent;
218
- border-radius: 5px 5px 0 0;
219
- background-color: transparent;
220
- color: var(--text-color);
221
- transition: border-color 0.3s ease, background-color 0.3s ease;
222
- display: flex;
223
- align-items: center;
224
- gap: 0.5rem;
225
- }
226
-
227
- .tab.active {
228
- border-color: var(--primary-color);
229
- background-color: var(--primary-color);
230
- color: white;
231
- }
232
-
233
-
234
- .tab-content {
235
- display: none;
236
- padding: 1rem;
237
- text-align: left;
238
- }
239
-
240
- .tab-content.active {
241
- display: block;
242
- }
243
-
244
- .metrics-table {
245
- width: 100%;
246
- border-collapse: collapse;
247
- margin-top: 1rem;
248
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
249
- }
250
-
251
-
252
- .metrics-table th, .metrics-table td {
253
- padding: 0.5rem;
254
- border: 1px solid var(--border-color);
255
- text-align: center;
256
- }
257
-
258
- .metrics-table th {
259
- background-color: var(--primary-color);
260
- color: white;
261
- font-weight: bold;
262
- text-transform: uppercase;
263
- letter-spacing: 0.05em;
264
- }
265
-
266
-
267
- .metrics-table td {
268
- padding: 0.8rem 0.5rem;
269
- }
270
- .metrics-table tr:nth-child(even) {
271
- background-color: #f9f9f9;
272
- }
273
- .dark-mode .metrics-table tr:nth-child(even) {
274
- background-color: #555;
275
- }
276
-
277
- .logos-container {
278
- display: flex;
279
- justify-content: center;
280
- align-items: center;
281
- margin-bottom: 1rem;
282
- width: 100%;
283
- }
284
- .logos-container img {
285
-
286
- transform: scale(1.083);
287
- max-width: 100%;
288
- height: auto;
289
- }
290
-
291
- footer {
292
- width: 100%;
293
- padding: 20px;
294
- background-color: var(--container-bg-color);
295
- border-top: 1px solid var(--border-color);
296
- font-size: 0.9rem;
297
- color: var(--text-color);
298
- text-align: center;
299
- box-sizing: border-box;
300
- position: relative;
301
- left: 0;
302
- right: 0;
303
- margin: 0;
304
- width: 100vw;
305
- margin-left: calc(-100vw / 2 + 50%);
306
- margin-right: calc(-100vw / 2 + 50%);
307
- white-space: normal;
308
- overflow-wrap: break-word;
309
- }
310
- footer p, footer address {
311
- margin: 0.5rem 0;
312
- white-space: normal;
313
- overflow-wrap: break-word;
314
- }
315
-
316
-
317
- .button-group-wrapper { /* New wrapper for buttons and the time info */
318
- display: flex;
319
- flex-direction: column;
320
- align-items: center;
321
- width: 100%;
322
- margin-top: 1rem; /* Spacing for the wrapper itself */
323
- }
324
- #processing-time-info {
325
- font-size: 0.9em;
326
- color: var(--text-color);
327
- margin-bottom: 0.75rem; /* Space between this info and the buttons */
328
- }
329
- .dark-mode #processing-time-info {
330
- color: var(--text-color); /* Ensure dark mode text color is applied */
331
- }
332
- .button-group {
333
- display: flex;
334
- justify-content: center;
335
- align-items: center;
336
- width: 100%;
337
- }
338
-
339
- #download-link {
340
- color: var(--secondary-color);
341
- text-decoration: none;
342
- font-weight: bold;
343
- display: block;
344
- margin: 10px auto;
345
- text-align: center;
346
- }
347
- #download-link:hover{
348
- text-decoration: underline;
349
- }
350
- .tab-content h2 {
351
- color: var(--primary-color);
352
- margin-bottom: 0.5rem;
353
- border-bottom: 2px solid var(--secondary-color);
354
- padding-bottom: 0.25rem;
355
- display: inline-block;
356
- }
357
-
358
- .tab-content h3 {
359
- color: var(--secondary-color);
360
- margin-top: 1.5rem;
361
- margin-bottom: 0.5rem;
362
- }
363
- .tab-content ul {
364
- list-style: disc;
365
- margin-left: 20px;
366
- padding-left: 0;
367
- }
368
-
369
- .tab-content li {
370
- margin-bottom: 0.25rem;
371
- }
372
- .tab-content p {
373
- margin-bottom: 1rem;
374
- line-height: 1.7;
375
- }
376
-
377
- #shap-plot-container {
378
- width: 100%;
379
- min-height: 300px;
380
- border: 1px solid var(--border-color);
381
- border-radius: 5px;
382
- margin-top: 1rem;
383
- display: flex;
384
- justify-content: center;
385
- align-items: center;
386
- overflow-x: auto;
387
- }
388
- #shap-plot-container img{
389
- max-width: 100%;
390
- height: auto;
391
- display: block;
392
- }
393
-
394
- .results-display-group {
395
- display: grid;
396
- grid-template-columns: 1fr 1fr;
397
- gap: 1rem;
398
- margin-top: 2rem;
399
- }
400
-
401
- .result-box {
402
- border: 1px solid var(--border-color);
403
- border-radius: 8px;
404
- background-color: var(--container-bg-color);
405
- box-shadow: 0 2px 5px rgba(0,0,0,0.05);
406
- overflow: hidden;
407
- color: var(--text-color);
408
- }
409
-
410
- .dark-mode .result-box {
411
- background-color: #424242;
412
- border-color: #616161;
413
- }
414
-
415
-
416
- .result-header {
417
- background-color: var(--primary-color);
418
- color: white;
419
- padding: 0.7rem 1rem;
420
- font-weight: bold;
421
- font-size: 1.1rem;
422
- display: flex;
423
- align-items: center;
424
- gap: 0.8rem;
425
- }
426
-
427
- .result-content {
428
- padding: 1rem;
429
- min-height: 50px;
430
- display: flex;
431
- flex-direction: column;
432
- justify-content: center;
433
- text-align: left;
434
- }
435
- .result-content p.info-message {
436
- text-align: center;
437
- margin-bottom: 0;
438
- margin-top: 0;
439
- }
440
- .result-content ul {
441
- margin: 0.5rem 0 0 1.5rem;
442
- padding: 0;
443
- list-style: disc;
444
- }
445
- .result-content ul li {
446
- margin-bottom: 0.25rem;
447
- }
448
- .result-content h4 {
449
- color: var(--secondary-color);
450
- margin-top: 0.5rem;
451
- margin-bottom: 0.5rem;
452
- }
453
-
454
- .scrollable-content {
455
- max-height: 400px;
456
- overflow-y: auto;
457
- padding: 1rem;
458
- border: 1px solid var(--border-color);
459
- border-radius: 8px;
460
- margin-top: 1rem;
461
- background-color: var(--background-color);
462
- }
463
- .dark-mode .scrollable-content {
464
- background-color: #333;
465
- border-color: #616161;
466
- }
467
- .scrollable-content h4 {
468
- color: var(--secondary-color);
469
- margin-top: 1rem;
470
- margin-bottom: 0.5rem;
471
- }
472
-
473
-
474
- .mic-checkbox-group {
475
- margin-top: 1.5rem;
476
- padding: 1rem;
477
- border: 1px solid var(--border-color);
478
- border-radius: 8px;
479
- background-color: var(--container-bg-color);
480
- box-shadow: 0 1px 5px rgba(0,0,0,0.05);
481
- display: flex;
482
- flex-wrap: wrap;
483
- justify-content: center;
484
- gap: 15px;
485
- margin-bottom: 1.5rem;
486
- }
487
-
488
- .dark-mode .mic-checkbox-group {
489
- background-color: #424242;
490
- border-color: #616161;
491
- }
492
-
493
- .mic-checkbox-container {
494
- display: flex;
495
- align-items: center;
496
- cursor: pointer;
497
- font-size: 1rem;
498
- color: var(--text-color);
499
- user-select: none;
500
- }
501
-
502
- .mic-checkbox-container input[type="checkbox"] {
503
- appearance: none;
504
- -webkit-appearance: none;
505
- width: 20px;
506
- height: 20px;
507
- border: 2px solid var(--primary-color);
508
- border-radius: 4px;
509
- margin-right: 8px;
510
- cursor: pointer;
511
- position: relative;
512
- outline: none;
513
- transition: all 0.2s ease-in-out;
514
- }
515
-
516
- .mic-checkbox-container input[type="checkbox"]:checked {
517
- background-color: var(--primary-color);
518
- border-color: var(--primary-color);
519
- }
520
-
521
- .mic-checkbox-container input[type="checkbox"]:checked::before {
522
- content: '\2713';
523
- display: block;
524
- position: absolute;
525
- top: 50%;
526
- left: 50%;
527
- transform: translate(-50%, -50%);
528
- font-size: 14px;
529
- color: white;
530
- }
531
-
532
- .mic-checkbox-container .mic-label {
533
- margin-left: 5px;
534
- font-weight: normal;
535
- }
536
-
537
- /* Email-related CSS from original is kept for future reference but is unused */
538
- #user-email-input-group {
539
- margin-top: 1.5rem;
540
- margin-bottom: 1rem;
541
- }
542
- #user-email {
543
- width: 100%;
544
- padding: 0.7rem;
545
- border: 1px solid var(--border-color);
546
- border-radius: 5px;
547
- box-sizing: border-box;
548
- font-size: 1rem;
549
- color: var(--text-color);
550
- background-color: var(--container-bg-color);
551
- }
552
- #user-email:focus {
553
- outline: none;
554
- border-color: var(--secondary-color);
555
- }
556
- #email-status {
557
- text-align: left;
558
- font-size: 0.9rem;
559
- margin-top: 0.3rem;
560
- min-height: 1.2em;
561
- }
562
-
563
-
564
- @media (max-width: 768px) {
565
  body {
566
- padding: 10px;
 
 
 
 
 
 
 
 
 
 
567
  }
568
- .results-display-group {
569
- grid-template-columns: 1fr;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
570
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571
  footer {
572
- padding-left: 10px;
573
- padding-right: 10px;
574
- margin-left: calc(-50vw + 50%);
575
- margin-right: calc(-50vw / 2 + 50%);
576
- }
577
- }
578
-
579
- .team-member-list {
580
- list-style: none;
581
- padding: 0;
582
- display: flex;
583
- flex-direction: column;
584
- align-items: flex-start;
585
- gap: 15px;
586
- }
587
-
588
- .team-member-list li {
589
- display: flex;
590
- align-items: center;
591
- gap: 15px;
592
- font-size: 1.1rem;
593
- color: var(--text-color);
594
- background-color: var(--background-color);
595
- padding: 10px 15px;
596
- border-radius: 8px;
597
- box-shadow: 0 1px 3px rgba(0,0,0,0.08);
598
- width: 100%;
599
- box-sizing: border-box;
600
- }
601
-
602
- .dark-mode .team-member-list li {
603
- background-color: #333;
604
- box-shadow: 0 1px 3px rgba(255,255,255,0.08);
605
- }
606
-
607
- .team-member-list img {
608
- width: 60px;
609
- height: 60px;
610
- border-radius: 50%;
611
- object-fit: cover;
612
- border: 2px solid var(--secondary-color);
613
- flex-shrink: 0;
614
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
615
  </style>
616
 
617
  </head>
@@ -622,363 +618,362 @@ footer p, footer address {
622
  <img src="image2.png" alt="Tool Logo">
623
  </div>
624
 
625
-
626
- <div class="tabs">
627
- <div class="tab active" data-tab="prediction">
628
- <i class="fas fa-search"></i> Prediction
629
- </div>
630
- <div class="tab" data-tab="model">
631
- <i class="fas fa-chart-line"></i> Models' Metrics & Sample run
632
- </div>
633
- <div class="tab" data-tab="about">
634
- <i class="fas fa-info-circle"></i> About
635
- </div>
636
- <div class="tab" data-tab="usage">
637
- <i class="fas fa-book"></i> Usage Guide
638
- </div>
639
- </div>
640
-
641
- <div class="tab-content active" id="prediction">
642
- <h2>AMP & MIC Predictor</h2>
643
- <p>Enter an amino acid sequence (between 10 and 100 valid amino acids) or upload a FASTA file to predict AMP class and MIC values.</p>
644
- <div class="input-group">
645
- <input type="file" id="file-input" accept=".fasta,.fa,.fna">
646
- <textarea id="sequence" placeholder="Enter amino acid sequence (10-100 Valid AAs) or upload a FASTA file..." maxlength="100"></textarea>
647
- <div class="character-count">
648
- <span id="char-count">0</span>/100
649
  </div>
650
- <i class="info-icon" id="info-icon">ⓘ</i>
651
- <div class="tooltip">
652
- Enter the amino acid sequence you want to classify or upload a FASTA file. The sequence must be between 10 and 100 characters long and contain only standard amino acid characters (ACDEFGHIKLMNPQRSTVWY).
 
 
 
 
 
653
  </div>
654
  </div>
655
 
656
- <h3 style="margin-top: 0rem; margin-bottom: 0.5rem;">Select Bacteria for MIC Prediction</h3>
657
- <p style="margin-top: 0; margin-bottom: 1rem;">Choose one or more bacteria for which you'd like to predict the Minimum Inhibitory Concentration (MIC) of the peptide. MIC prediction is only performed if the sequence is classified as an Antimicrobial Peptide (AMP).</p>
658
-
659
- <div class="mic-checkbox-group">
660
- <label class="mic-checkbox-container">
661
- <input type="checkbox" id="mic-ecoli" value="e_coli" disabled>
662
- <span class="mic-label">E.coli</span>
663
- </label>
664
- <label class="mic-checkbox-container">
665
- <input type="checkbox" id="mic-paeruginosa" value="p_aeruginosa" disabled>
666
- <span class="mic-label">P. aeruginosa</span>
667
- </label>
668
- <label class="mic-checkbox-container">
669
- <input type="checkbox" id="mic-saureus" value="s_aureus" disabled>
670
- <span class="mic-label">S. aureus</span>
671
- </label>
672
- <label class="mic-checkbox-container">
673
- <input type="checkbox" id="mic-kpneumoniae" value="k_pneumoniae" disabled>
674
- <span class="mic-label">K. pneumoniae</span>
675
- </label>
676
- </div>
677
-
678
- <!-- REMOVED HTML FOR EMAIL INPUT SECTION -->
679
- <!-- The email input section is removed to focus purely on prediction functionality -->
680
- <!-- <div class="input-group" id="user-email-input-group" style="margin-top: 1.5rem; margin-bottom: 1rem;">
681
- <label for="user-email" style="display:block; text-align:left; margin-bottom:0.5rem; font-weight:bold;">Please enter your Email Address for detailed results:<span style="color:red;">*</span></label>
682
- <input type="email" id="user-email" placeholder="Enter your email to receive the PDF report" required>
683
- <div id="email-error" class="error-message" style="text-align:left; font-size:0.9rem; margin-top:0.3rem; display:none;"></div>
684
- <div id="email-status" style="text-align:left; font-size:0.9rem; margin-top:0.3rem; min-height: 1.2em;"></div>
685
- </div> -->
686
-
687
- <!-- Wrapper for estimated time and buttons -->
688
- <div class="button-group-wrapper">
689
- <div id="processing-time-info">Estimated processing time: around 30 seconds.</div>
690
- <div class="button-group">
691
- <button onclick="clearInput()" id="clear-btn">Clear Input</button>
692
- <button onclick="classifySequenceDebounced()" id="predict-btn">Submit</button>
693
  </div>
694
- </div>
695
 
696
- <div class="error-message" id="error"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
697
 
698
- <div class="results-display-group">
699
- <div class="result-box">
700
- <div class="result-header"><i class="fas fa-file-alt"></i>Classification</div>
701
- <div class="result-content" id="amp-classification-output">
702
- <p class="info-message">The prediction will appear here.</p>
 
 
 
 
 
 
 
 
 
 
703
  </div>
704
  </div>
705
 
706
- <div class="result-box">
707
- <div class="result-header"><i class="fas fa-info-circle"></i> Additional Details</div>
708
- <div class="result-content" id="additional-details-output">
709
- <p class="info-message">The detailed report will appear here.</p>
710
- <a id="download-link" style="display: none;">Download Detailed Report (PDF)</a>
 
 
 
 
 
 
 
 
 
 
 
711
  </div>
712
  </div>
713
  </div>
714
- </div>
715
 
716
- <div class="tab-content" id="model">
717
- <h2>Classifier Metrics</h2>
718
- <p>The following table presents the performance metrics of our antimicrobial peptide classification model. These metrics were obtained on a held-out test set, separate from the training data.</p>
719
- <table class="metrics-table">
720
- <thead>
721
- <tr>
722
- <th>Metric</th>
723
- <th>Value</th>
724
- <th>Description</th>
725
- </tr>
726
- </thead>
727
- <tbody>
728
- <tr>
729
- <td>Accuracy</td>
730
- <td>0.963</td>
731
- <td>The overall correctness of the model, representing the proportion of correctly classified sequences (both AMP and Non-AMP).</td>
732
- </tr>
733
- <tr>
734
- <td>Precision</td>
735
- <td>0.964</td>
736
- <td>Out of all sequences predicted as AMPs, the proportion that are truly AMPs. A high precision indicates fewer false positives.</td>
737
- </tr>
738
- <tr>
739
- <td>Recall</td>
740
- <td>0.963</td>
741
- <td>Out of all actual AMP sequences, the proportion that the model correctly identifies. A high recall indicates fewer false negatives.</td>
742
- </tr>
743
- <tr>
744
- <td>F1-Score</td>
745
- <td>0.963</td>
746
- <td>The harmonic mean of precision and recall, providing a balanced measure of the model's performance.</td>
747
- </tr>
748
- <tr>
749
- <td>Validation Accuracy</td>
750
- <td>0.968</td>
751
- <td>The accuracy of the model on a separate validation dataset, used during model development to tune hyperparameters.</td>
752
- </tr>
753
- </tbody>
754
- </table>
755
-
756
- <h2 style="margin-top: 2rem;">Regressor Metrics (MIC Prediction Models)</h2>
757
- <p>The Minimum Inhibitory Concentration (MIC) prediction is handled by separate regressor models. Their performance metrics for each bacterium are detailed below:</p>
758
-
759
- <table class="metrics-table">
760
- <thead>
761
- <tr>
762
- <th>Bacterium</th>
763
- <th>MSE (log)</th>
764
- <th>MSE</th>
765
- <th>R2</th>
766
- <th>MAE</th>
767
- <th>Pearson</th>
768
- <th>Kendall</th>
769
- </tr>
770
- </thead>
771
- <tbody>
772
- <tr>
773
- <td>E.coli</td>
774
- <td>0.0481</td>
775
- <td>0.4864</td>
776
- <td>0.7023</td>
777
- <td>0.1375</td>
778
- <td>0.8394</td>
779
- <td>0.6725</td>
780
- </tr>
781
- <tr>
782
- <td>P. aeruginosa</td>
783
- <td>0.0517</td>
784
- <td>0.5227</td>
785
- <td>0.6864</td>
786
- <td>0.1233</td>
787
- <td>0.8311</td>
788
- <td>0.6922</td>
789
- </tr>
790
- <tr>
791
- <td>S.aureus</td>
792
- <td>0.0517</td>
793
- <td>0.4988</td>
794
- <td>0.6828</td>
795
- <td>0.1472</td>
796
- <td>0.8278</td>
797
- <td>0.6536</td>
798
- </tr>
799
- <tr>
800
- <td>K. pneumoniae</td>
801
- <td>0.0538</td>
802
- <td>0.4292</td>
803
- <td>0.7416</td>
804
- <td>0.1479</td>
805
- <td>0.8693</td>
806
- <td>0.7194</td>
807
- </tr>
808
- </tbody>
809
- </table>
810
-
811
- <h2 style="margin-top: 2rem;">Model Interpretability</h2>
812
- <p>To understand how our model makes predictions, we use SHAP (SHapley Additive exPlanations) values globally and LIME (Local Interpretable Model-agnostic Explanations) locally. SHAP values help assess the overall contribution of each feature to model predictions across the dataset, while LIME explains the features influencing a single, specific prediction.</p>
813
-
814
- <h3>Global SHAP Plot</h3>
815
- <p>The SHAP plot below visualizes the features that most significantly influence the model's predictions *on average across all data*. Positive SHAP values generally contribute to the sequence being classified as AMP, while negative values contribute to Non-AMP classification.</p>
816
-
817
- <div id="shap-plot-container">
818
- <img src="shap.png" alt="SHAP Plot" >
819
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
820
 
821
- <h3>Interpretation of Global SHAP Plot</h3>
822
- <div class="scrollable-content">
823
- <p>Based on the SHAP plot, the model's predictions for Antimicrobial Peptides (AMPs) are influenced by a combination of sequence-based, structural, and biophysical features. Here’s a breakdown of the key features and their biological implications:</p>
824
- <h4>A. Sequence-Based Features</h4>
825
- <h5>APAAC13 & APAAC5 (Amphiphilic Pseudo-Amino Acid Composition)</h5>
826
  <ul>
827
- <li><strong>Description:</strong> These features encode hydrophobicity, charge, and side-chain properties, reflecting the amphiphilic nature of the peptide.</li>
828
- <li><strong>Interpretation:<b> Higher APAAC values have a positive SHAP impact, indicating they are predictive of AMP activity. This suggests that the model values amphiphilic sequences, which are crucial for disrupting bacterial membranes.</b></strong></li>
 
 
 
 
 
 
829
  </ul>
830
- <h5>Amino Acid Composition (M, C)</h5>
 
 
 
 
 
 
831
  <ul>
832
- <li><strong>M (Methionine):</strong>
833
- <ul>
834
- <li><strong>Description:</strong> Methionine is often associated with structural stability in peptides.</li>
835
- <li><strong>Interpretation:</strong> The plot suggests Methionine content has a positive influence, possibly contributing to the stability of AMP candidates.</li>
836
- </ul>
837
- </li>
838
- <li><strong>C (Cysteine):</strong>
839
- <ul>
840
- <li><strong>Description:</strong> Cysteine is known for forming disulfide bonds, which can stabilize AMP structures like defensins.</li>
841
- <li><strong>Interpretation:</strong> High cysteine content appears to have a positive SHAP impact. This could be because disulfide-stabilized AMPs often exhibit enhanced antimicrobial action.</li>
842
- </ul>
843
- </li>
844
  </ul>
845
- <h4>B. Structural and Biophysical Features</h4>
846
- <ul>
847
- <li><strong>HydrophobicityD3001:</strong>
848
- <ul>
849
- <li><strong>Description:</b> Represents the overall hydrophobicity of the peptide sequence.</li>
850
- <li><strong>Interpretation:</strong> Hydrophobicity is shown to be a critical feature. More hydrophobic peptides are strongly favored for AMP classification, aligning with the understanding that hydrophobicity is essential for membrane insertion and disruption.</li>
851
- </ul>
852
- </li>
853
- <li><strong>PolarityD1001:</strong>
854
- <ul>
855
- <li><strong>Description:<b> Measures the polarity of the peptide sequence.</b></strong></li>
856
- <li><strong>Interpretation:</strong> The model considers polarity, likely in balance with hydrophobicity. An optimal AMP efficacy is often linked to having both hydrophobic and polar residues to facilitate membrane interaction and solubility.</li>
857
- </ul>
858
- </li>
859
- <li><strong>Solvent Accessibility (SolventAccessibilityD3001):</strong>
860
- <ul>
861
- <li><strong>Description:</strong> Reflects how exposed the residues are to the solvent (water).</li>
862
- <li><strong>Interpretation:</strong> Solvent-accessible residues positively contribute to AMP prediction. This might indicate that exposed residues facilitate interaction with bacterial membranes or the surrounding environment.</li>
863
- </ul>
864
- </li>
865
- <li><strong>Charge (ChargeD2001):</strong>
866
- <ul>
867
- <li><strong>Description:<b> Represents the net charge of the peptide.</b></strong></li>
868
- <li><strong>Interpretation:</strong> Charge is a significant positive predictor. Most AMPs are cationic, enabling them to interact with negatively charged bacterial membranes. Higher charge, as indicated by positive SHAP values, typically enhances antimicrobial potency.</li>
869
- </ul>
870
- </li>
871
- <li><strong>PolarizabilityD3001 & NormalizedVDWVD3001:<b>
872
- <ul>
873
- <li><strong>Description:<b> These features relate to electronic distribution (Polarizability) and steric effects (NormalizedVDWVD) of the peptide.</b></strong></li>
874
- <li><strong>Interpretation:</b> These properties impact membrane penetration and peptide-membrane interactions. Their positive SHAP values suggest they are important for AMP activity, possibly by influencing how the peptide inserts into and destabilizes membranes.</li>
875
- </ul>
876
- </li>
877
  </ul>
878
- <h4>C. Geary Autocorrelation Features</h4>
879
- <p>Geary autocorrelation descriptors reflect spatial properties of peptides, encoding information about the adhesion and distribution of physicochemical properties along the sequence.</p>
880
  <ul>
881
- <li><strong>GearyAuto_Hydrophobicity30:</strong>
882
- <ul>
883
- <li><strong>Description:</strong> Encodes the clustering of hydrophobic residues within a spatial lag of 30.</li>
884
- <li><strong>Interpretation:<b> Higher values of hydrophobicity autocorrelation are positively associated with AMP prediction. This likely reflects the importance of hydrophobic clustering in forming amphipathic structures, such as α-helices, which are common and effective in AMPs.</b></b></li>
885
- </ul>
886
- </li>
887
- <li><strong>GearyAuto_Steric30 & GearyAuto_Steric29:</strong>
888
- <ul>
889
- <li><strong>Description:</b> Reflect peptide backbone flexibility and steric properties at spatial lags of 30 and 29.</li>
890
- <li><strong>Interpretation:</strong> These features have a positive SHAP impact, suggesting that a certain degree of peptide backbone flexibility may be beneficial for AMP action. Flexibility could enhance the peptide's ability to interact with and adapt to diverse bacterial membrane structures.</li>
891
- </ul>
892
- </li>
893
- <li><strong>GearyAuto_ResidueASA30:<b>
894
- <ul>
895
- <li><strong>Description:</strong> Indicates the autocorrelation of accessible surface area of residues at a spatial lag of 30.</li>
896
- <li><strong>Interpretation:<b> Higher autocorrelation of residue accessible surface area is favored. This could mean that a consistent pattern of residue exposure, possibly with higher exposure of charged or polar residues, improves bacterial targeting or membrane interaction.</b></b></li>
897
- </ul>
898
- </li>
899
  </ul>
 
 
900
  </div>
901
 
902
- <h3>Sample Run</h3>
903
- <p>You can test the model with various sequences to understand its behavior. Here are a few examples:</p>
904
- <ul>
905
- <li><strong>Test 1:</strong> Long Sequence of 99 AAs (P-AMP) - MEKAALIFIGLLLFSTCTQILAQSCNNDSDCTNLKCATKNIKCEQNKCQCLDERYIRA
906
- ISLNTRSPRCNVQSCIDHCKAIGEVIYVCFTYHCYCRKPPM</li>
907
- <li><strong>Test 2:</strong> Long Sequence of 99 AAs (Non-AMP) - MKSLLPLAILAALAVAALCYESHESMESYEVSPFTTRRNANTFISPQQRWHAK
908
- AQERVRELNKPAQEINREACDDYKLCERYALIYGYNAAYNRYFRQR</li>
909
- <li><strong>Test 3:</strong> Short Sequence of 51 AAs (P-AMP) - SLQGGAPNFPQPSQQNGGWQVSPDLGRDDKGNTRGQIEIQNKGKDHDFNAG</li>
910
- <li><strong>Test 4:<b> Short Sequence of 50 AAs (Non-AMP) - MKPLKQKVSITLDEDVIKNLKTLAEECDRSLSQYINLILKEHLKNLDQQ</b></b></li>
911
- <li><strong>Test 5:</strong> Invalid Characters (eg. X) -
912
- MEKAALIFIGLLLFSTCTQILAQSC(XX).</li>
913
- </ul>
914
- </div>
915
-
916
- <div class="tab-content" id="about">
917
- <h2>About This Tool</h2>
918
- <p>This web application provides a user-friendly interface for classifying amino acid sequences as either Antimicrobial Peptides (AMPs) or Non-Antimicrobial Peptides (Non-AMPs). AMPs are crucial components of the innate immune system, offering defense against a wide range of pathogens.</p>
919
- <h3>Model Selection Criteria</h3>
920
- <p>To identify the most effective model, our team rigorously evaluated over 225 combinations of feature extraction and selection methods across four different machine learning models for each target organism. The evaluation included both classification and regression tasks, with a focus on predicting antimicrobial activity and estimating minimum inhibitory concentration (MIC) values. The final model was selected based on the following criteria:</p>
921
- <ul>
922
- <li><strong>High Accuracy, F1-score, and Validation Accuracy:</strong> The model achieved excellent performance metrics on a held-out test set, demonstrating its ability to generalize to unseen data.</li>
923
- <li><strong>Robustness to Sequence Length Variations:<b> The model performs consistently well on sequences of varying lengths, within the specified range (10-100 amino acids).</b></strong></li>
924
- <li><strong>Generalization Ability:</strong> The model was trained and evaluated on diverse datasets to ensure its ability to classify a broad range of AMP sequences.</li>
925
- <li><strong>Robust regression capability:<b> Assessed using Mean Squared Error (MSE), R-squared (R²), Pearson correlation, and Kendall’s tau, the model demonstrated strong agreement between predicted and true MIC values.</b></b></li>
926
- </ul>
927
- <h3>Intended Use</h3>
928
- <p>This tool is intended for research and educational purposes. It can be a valuable resource for researchers studying antimicrobial peptides and developing new therapeutic strategies. However, it is not a replacement for laboratory-based experimental validation.</p>
929
- <h3>Our Team</h3>
930
- <ul class="team-member-list">
931
- <li><img src="team-member-1.jpg" alt="Ali Magdi"> Ali Magdi - Computational Biologist</li>
932
- <li><img src="team-member-2.jpg" alt="Ahmed Amr"> Ahmed Amr - Computational Biologist</li>
933
- <li><img src="team-member-3.jpg" alt="Omar Loay"> Omar Loay - Molecular Biologist</li>
934
- <li><img src="team-member-4.jpg" alt="Prof. Eman Badr"> Prof. Eman Badr - Full Professor and Director of BCBU</li>
935
- </ul>
936
- <h3>Acknowledgements</h3>
937
- <p>We extend our gratitude to the following organizations for their support:</p>
938
- <ul>
939
- <li>Bioinformatics and Computational Biology Unit at Zewail City.</li>
940
- <li>The Centre for Genomics at Zewail City.</li>
941
- </ul>
942
- <h3>Contact</h3>
943
- <p>For questions, inquiries, or feedback, please reach out to us at: <a href="mailto:epicamp.sup@gmail.com">epicamp.sup@gmail.com</a></p>
944
- </div>
945
-
946
- <div class="tab-content" id="usage">
947
- <h2>Usage Guide</h2>
948
- <p>Follow these steps to use the AMP Classifier:</p>
949
- <h3>Step 1: Prepare Your Sequence</h3>
950
- <ul>
951
- <li>You can either enter the amino acid sequence directly or upload a FASTA file.</li>
952
- <li>Ensure your sequence contains only standard amino acid characters (ACDEFGHIKLMNPQRSTVWY).</li>
953
- <li>The sequence length must be between 10 and 100 amino acids.</li>
954
- </ul>
955
- <h3>Step 2: Input the Sequence</h3>
956
- <ul>
957
- <li><strong>Direct Input:</strong> Type or paste your sequence into the text area provided.</li>
958
- <li><strong>FASTA File Upload:<b> Click the "Choose File" button and select your .fasta, .fa, or .fna file.</b></b></li>
959
- <li>The character count will update as you type or upload a sequence.</li>
960
- </ul>
961
- <h3>Step 3: Analyze the Sequence</h3>
962
- <ul>
963
- <li>Click the "Submit" button.</li>
964
- <li>A message indicating the estimated processing time will be visible above the buttons, and the button itself will show elapsed time.</li>
965
- </ul>
966
- <h3>Step 4: View the Results</h3>
967
- <ul>
968
- <li>Once the analysis is complete, the prediction (AMP or Non-AMP) will be displayed in the "AMP Classification" box.</li>
969
- <li>A link to "Download Detailed Report (PDF)" will appear in the "Additional Details" box if the report was generated successfully.</li>
970
- </ul>
971
- <h3>Step 5: Clear the Input</h3>
972
- <ul>
973
- <li>To analyze another sequence, click the "Clear Input" button. This will reset the input fields and results.</li>
974
- </ul>
975
- <h3>Troubleshooting</h3>
976
  <ul>
977
- <li><strong>Invalid Characters:</b> If you see an error message about invalid characters, double-check that your sequence contains only standard amino acid characters.</li>
978
- <li><strong>Sequence Length:</strong> Ensure your sequence is between 10 and 100 characters long.</li>
979
- <li><strong>Invalid FASTA Format:<b> If you encounter an error with a FASTA file, make sure the file is correctly formatted.</b></b></li>
980
  </ul>
981
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
982
  </div>
983
 
984
  <footer>
@@ -1006,6 +1001,11 @@ footer p, footer address {
1006
  const tabs = document.querySelectorAll('.tab');
1007
  const tabContents = document.querySelectorAll('.tab-content');
1008
 
 
 
 
 
 
1009
  let clientInstance;
1010
  let debounceTimer;
1011
  let countUpIntervalId; // For count-up timer
@@ -1107,6 +1107,14 @@ footer p, footer address {
1107
  predictBtn.disabled = true;
1108
  predictBtn.textContent = 'Submit';
1109
  }
 
 
 
 
 
 
 
 
1110
  }
1111
 
1112
  function handleFileSelect(event) {
@@ -1226,6 +1234,19 @@ footer p, footer address {
1226
  return isValid;
1227
  }
1228
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1229
  function updateCharacterCount() {
1230
  if(!sequenceInput || !charCount) return;
1231
  const currentLength = sequenceInput.value.length;
@@ -1299,10 +1320,35 @@ footer p, footer address {
1299
  }
1300
 
1301
  const currentSequence = sequenceInput ? sequenceInput.value.trim().toUpperCase() : "";
 
1302
 
1303
- if (!validateSequence(currentSequence)) return;
 
 
 
 
 
1304
 
1305
- clearError();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1306
 
1307
  if (predictBtn) predictBtn.disabled = true;
1308
  if (ampClassificationOutput) ampClassificationOutput.innerHTML = '<p class="info-message">Analyzing...</p>';
@@ -1394,6 +1440,8 @@ footer p, footer address {
1394
  } catch (pdfGenerationError) {
1395
  console.error("Error during PDF report content generation:", pdfGenerationError);
1396
  showError(`PDF report generation failed: ${pdfGenerationError.message}`);
 
 
1397
  pdfDoc = null; // Ensure pdfDoc is null on error
1398
  }
1399
 
@@ -1414,11 +1462,18 @@ footer p, footer address {
1414
  if (!additionalDetailsOutput.contains(downloadLink)) {
1415
  additionalDetailsOutput.appendChild(downloadLink);
1416
  }
 
 
 
 
1417
  } else {
1418
  additionalDetailsOutput.innerHTML = '<p class="info-message" style="color: var(--warning-color);">Could not generate PDF report for download.</p>';
1419
  if (downloadLink.parentNode === additionalDetailsOutput) {
1420
  downloadLink.style.display = 'none';
1421
  }
 
 
 
1422
  }
1423
  }
1424
 
@@ -1440,12 +1495,72 @@ footer p, footer address {
1440
  downloadLink.style.display = 'none';
1441
  }
1442
  }
 
 
1443
  } finally {
1444
  if (countUpIntervalId) { clearInterval(countUpIntervalId); countUpIntervalId = null; }
1445
  if (predictBtn) { predictBtn.disabled = false; predictBtn.textContent = 'Submit';}
1446
  }
1447
  }
1448
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1449
  async function getBase64Image(imgSrc) {
1450
  return new Promise((resolve) => {
1451
  if (!imgSrc) { resolve(null); return; }
@@ -1643,7 +1758,7 @@ footer p, footer address {
1643
  pdf.setFontSize(16); pdf.setTextColor(primaryC[0],primaryC[1],primaryC[2]);
1644
  pdf.text("Global SHAP Feature Importance:",20,yPos);
1645
  yPos+=8;
1646
- try{pdf.addImage(shapPlotB64,'PNG',(pageWidth-imgW)/2,yPos,imgW,imgH); yPos+=imgH+10;}
1647
  catch(e){console.error("Error adding SHAP PDF:",e); yPos+=10;}
1648
  }
1649
  } else {
@@ -1672,4 +1787,4 @@ footer p, footer address {
1672
  </script>
1673
 
1674
  </body>
1675
- </html>
 
1
  <!DOCTYPE html>
 
2
  <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
 
9
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
10
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.23/jspdf.plugin.autotable.min.js"></script>
11
 
12
+ <style>
13
+ :root {
14
+ --primary-color: #004d40; /* Dark Teal */
15
+ --secondary-color: #00897b; /* Teal */
16
+ --success-color: #4caf50; /* Green */
17
+ --warning-color: #ff9800; /* Orange */
18
+ --info-color: #2196f3; /* Blue */
19
+ --background-color: #f0f4c3; /* Light Lime */
20
+ --text-color: #333; /* Dark Gray */
21
+ --container-bg-color: #ffffff; /* White */
22
+ --border-color: #bdbdbd; /* Light Gray */
23
+ --button-hover-bg: #00695c; /* Darker Teal */
24
+ --clear-button-bg: #f44336; /* Red */
25
+ --clear-button-hover-bg: #d32f2f; /* Darker Red */
26
+ --analyze-button-bg: #00897b; /* Teal */
27
+ --analyze-button-hover-bg: #00695c; /* Darker Teal */
28
+ }
29
+
30
+ /* Optional Dark Mode */
31
+ .dark-mode {
32
+ --primary-color: #b2dfdb; /* Light Teal */
33
+ --secondary-color: #4db6ac; /* Medium Teal */
34
+ --success-color: #81c784; /* Light Green */
35
+ --warning-color: #ffcc80; /* Light Orange */
36
+ --info-color: #90caf9; /* Light Blue */
37
+ --background-color: #212121; /* Dark Gray */
38
+ --text-color: #eee; /* Light Gray */
39
+ --container-bg-color: #424242;/* Darker Gray */
40
+ --border-color: #616161; /* Medium Gray */
41
+ --button-hover-bg: #004d40; /* Dark Teal */
42
+ --clear-button-bg: #e57373; /* Light Red */
43
+ --clear-button-hover-bg: #f44336; /* Red */
44
+ --analyze-button-bg: #4db6ac; /* Medium Teal */
45
+ --analyze-button-hover-bg: #009688; /* Teal */
46
+ }
47
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  body {
49
+ font-family: 'Arial', sans-serif;
50
+ line-height: 1.6;
51
+ margin: 0;
52
+ padding: 20px;
53
+ min-height: 100vh;
54
+ display: flex;
55
+ flex-direction: column;
56
+ align-items: center;
57
+ background-color: var(--background-color);
58
+ color: var(--text-color);
59
+ transition: background-color 0.3s ease, color 0.3s ease;
60
  }
61
+
62
+ .container {
63
+ max-width: 800px;
64
+ width: 100%;
65
+ padding: 2rem;
66
+ background: var(--container-bg-color);
67
+ border-radius: 10px;
68
+ box-shadow: 0 2px 15px rgba(0,0,0,0.1);
69
+ text-align: center;
70
+ transition: background-color 0.3s ease;
71
+ display: flex;
72
+ flex-direction: column;
73
+ margin-bottom: 20px;
74
+ }
75
+
76
+ .input-group {
77
+ margin-bottom: 1.5rem;
78
+ position: relative;
79
+ }
80
+
81
+ #sequence {
82
+ width: 100%;
83
+ height: 150px;
84
+ padding: 1rem;
85
+ border: 2px solid var(--border-color);
86
+ border-radius: 8px;
87
+ font-family: monospace;
88
+ font-size: 1rem;
89
+ resize: vertical;
90
+ transition: border-color 0.3s ease, background-color 0.3s ease;
91
+ background-color: var(--container-bg-color);
92
+ color: var(--text-color);
93
+ box-sizing: border-box;
94
+ }
95
+
96
+ #file-input {
97
+ margin-bottom: 1rem;
98
+ }
99
+
100
+ #sequence:focus {
101
+ outline: none;
102
+ border-color: var(--secondary-color);
103
+ }
104
+
105
+ button {
106
+ color: white;
107
+ border: none;
108
+ padding: 0.8rem 2rem;
109
+ border-radius: 5px;
110
+ cursor: pointer;
111
+ font-size: 1rem;
112
+ transition: transform 0.2s ease, background-color 0.3s ease;
113
+ /* margin-top: 1rem; Removed individual margin-top for buttons */
114
+ }
115
+ .button-group button{
116
+ margin: 0 0.2rem;
117
+ }
118
+
119
+ button:hover {
120
+ transform: translateY(-1px);
121
+ }
122
+
123
+ #clear-btn {
124
+ background-color: var(--clear-button-bg);
125
+ }
126
+
127
+ #clear-btn:hover {
128
+ background-color: var(--clear-button-hover-bg);
129
+ }
130
+
131
+ #predict-btn {
132
+ background-color: var(--analyze-button-bg);
133
+ min-width: 230px; /* To accommodate count-up text better */
134
+ }
135
+
136
+ #predict-btn:hover {
137
+ background-color: var(--analyze-button-hover-bg);
138
+ }
139
+
140
+
141
+ .character-count {
142
+ text-align: right;
143
+ color: var(--text-color);
144
+ font-size: 0.9rem;
145
+ margin-top: 0.5rem;
146
+ }
147
+
148
+
149
+ .error-message {
150
+ color: var(--warning-color);
151
+ text-align: center;
152
+ margin-top: 1rem;
153
+ display: none;
154
+ }
155
+
156
+
157
+ .result {
158
+ margin-top: 1.5rem;
159
+ font-size: 1.2rem;
160
+ font-weight: bold;
161
+ color: var(--primary-color);
162
+ text-align: center;
163
+ }
164
+
165
+ .info-icon {
166
+ position: absolute;
167
+ top: 1rem;
168
+ right: 1rem;
169
+ font-size: 1.2rem;
170
+ color: var(--info-color);
171
+ cursor: pointer;
172
+ }
173
+
174
+ .tooltip {
175
+ position: absolute;
176
+ top: 100%;
177
+ right: 0;
178
+ background-color: rgba(0, 0, 0, 0.8);
179
+ color: white;
180
+ padding: 0.5rem;
181
+ border-radius: 5px;
182
+ display: none;
183
+ z-index: 10;
184
+ width: 250px;
185
+ text-align: left;
186
+ font-size: 0.9rem;
187
+ line-height: 1.4;
188
+ }
189
+
190
+ .info-icon:hover + .tooltip,
191
+ .tooltip:hover {
192
+ display: block;
193
+ }
194
+
195
+ @keyframes fadeIn {
196
+ from { opacity: 0; transform: translateY(-10px); }
197
+ to { opacity: 1; transform: translateY(0); }
198
+ }
199
+
200
+ .result.show {
201
+ animation: fadeIn 0.5s ease forwards;
202
+ }
203
+
204
+ .tabs {
205
+ display: flex;
206
+ justify-content: center;
207
+ margin-bottom: 1rem;
208
+ border-bottom: 2px solid var(--border-color);
209
+ }
210
+
211
+ .tab {
212
+ padding: 0.5rem 1rem;
213
+ margin: 0 0.5rem;
214
+ cursor: pointer;
215
+ border: 2px solid transparent;
216
+ border-radius: 5px 5px 0 0;
217
+ background-color: transparent;
218
+ color: var(--text-color);
219
+ transition: border-color 0.3s ease, background-color 0.3s ease;
220
+ display: flex;
221
+ align-items: center;
222
+ gap: 0.5rem;
223
+ }
224
+
225
+ .tab.active {
226
+ border-color: var(--primary-color);
227
+ background-color: var(--primary-color);
228
+ color: white;
229
+ }
230
+
231
+ .tab-content {
232
+ display: none;
233
+ padding: 1rem;
234
+ text-align: left;
235
+ }
236
+
237
+ .tab-content.active {
238
+ display: block;
239
  }
240
+
241
+ .metrics-table {
242
+ width: 100%;
243
+ border-collapse: collapse;
244
+ margin-top: 1rem;
245
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
246
+ }
247
+
248
+
249
+ .metrics-table th, .metrics-table td {
250
+ padding: 0.5rem;
251
+ border: 1px solid var(--border-color);
252
+ text-align: center;
253
+ }
254
+
255
+ .metrics-table th {
256
+ background-color: var(--primary-color);
257
+ color: white;
258
+ font-weight: bold;
259
+ text-transform: uppercase;
260
+ letter-spacing: 0.05em;
261
+ }
262
+
263
+ .metrics-table td {
264
+ padding: 0.8rem 0.5rem;
265
+ }
266
+ .metrics-table tr:nth-child(even) {
267
+ background-color: #f9f9f9;
268
+ }
269
+ .dark-mode .metrics-table tr:nth-child(even) {
270
+ background-color: #555;
271
+ }
272
+
273
+ .logos-container {
274
+ display: flex;
275
+ justify-content: center;
276
+ align-items: center;
277
+ margin-bottom: 1rem;
278
+ width: 100%;
279
+ }
280
+ .logos-container img {
281
+
282
+ transform: scale(1.083);
283
+ max-width: 100%;
284
+ height: auto;
285
+ }
286
+
287
  footer {
288
+ width: 100%;
289
+ padding: 20px;
290
+ background-color: var(--container-bg-color);
291
+ border-top: 1px solid var(--border-color);
292
+ font-size: 0.9rem;
293
+ color: var(--text-color);
294
+ text-align: center;
295
+ box-sizing: border-box;
296
+ position: relative;
297
+ left: 0;
298
+ right: 0;
299
+ margin: 0;
300
+ width: 100vw;
301
+ margin-left: calc(-100vw / 2 + 50%);
302
+ margin-right: calc(-100vw / 2 + 50%);
303
+ white-space: normal;
304
+ overflow-wrap: break-word;
305
+ }
306
+ footer p, footer address {
307
+ margin: 0.5rem 0;
308
+ white-space: normal;
309
+ overflow-wrap: break-word;
310
+ }
311
+
312
+
313
+ .button-group-wrapper { /* New wrapper for buttons and the time info */
314
+ display: flex;
315
+ flex-direction: column;
316
+ align-items: center;
317
+ width: 100%;
318
+ margin-top: 1rem; /* Spacing for the wrapper itself */
319
+ }
320
+ #processing-time-info {
321
+ font-size: 0.9em;
322
+ color: var(--text-color);
323
+ margin-bottom: 0.75rem; /* Space between this info and the buttons */
324
+ }
325
+ .dark-mode #processing-time-info {
326
+ color: var(--text-color); /* Ensure dark mode text color is applied */
327
+ }
328
+ .button-group {
329
+ display: flex;
330
+ justify-content: center;
331
+ align-items: center;
332
+ width: 100%;
333
+ }
334
+
335
+ #download-link {
336
+ color: var(--secondary-color);
337
+ text-decoration: none;
338
+ font-weight: bold;
339
+ display: block;
340
+ margin: 10px auto;
341
+ text-align: center;
342
+ }
343
+ #download-link:hover{
344
+ text-decoration: underline;
345
+ }
346
+ .tab-content h2 {
347
+ color: var(--primary-color);
348
+ margin-bottom: 0.5rem;
349
+ border-bottom: 2px solid var(--secondary-color);
350
+ padding-bottom: 0.25rem;
351
+ display: inline-block;
352
+ }
353
+
354
+ .tab-content h3 {
355
+ color: var(--secondary-color);
356
+ margin-top: 1.5rem;
357
+ margin-bottom: 0.5rem;
358
+ }
359
+ .tab-content ul {
360
+ list-style: disc;
361
+ margin-left: 20px;
362
+ padding-left: 0;
363
+ }
364
+
365
+ .tab-content li {
366
+ margin-bottom: 0.25rem;
367
+ }
368
+ .tab-content p {
369
+ margin-bottom: 1rem;
370
+ line-height: 1.7;
371
+ }
372
+
373
+ #shap-plot-container {
374
+ width: 100%;
375
+ min-height: 300px;
376
+ border: 1px solid var(--border-color);
377
+ border-radius: 5px;
378
+ margin-top: 1rem;
379
+ display: flex;
380
+ justify-content: center;
381
+ align-items: center;
382
+ overflow-x: auto;
383
+ }
384
+ #shap-plot-container img{
385
+ max-width: 100%;
386
+ height: auto;
387
+ display: block;
388
+ }
389
+
390
+ .results-display-group {
391
+ display: grid;
392
+ grid-template-columns: 1fr 1fr;
393
+ gap: 1rem;
394
+ margin-top: 2rem;
395
+ }
396
+
397
+ .result-box {
398
+ border: 1px solid var(--border-color);
399
+ border-radius: 8px;
400
+ background-color: var(--container-bg-color);
401
+ box-shadow: 0 2px 5px rgba(0,0,0,0.05);
402
+ overflow: hidden;
403
+ color: var(--text-color);
404
+ }
405
+
406
+ .dark-mode .result-box {
407
+ background-color: #424242;
408
+ border-color: #616161;
409
+ }
410
+
411
+
412
+ .result-header {
413
+ background-color: var(--primary-color);
414
+ color: white;
415
+ padding: 0.7rem 1rem;
416
+ font-weight: bold;
417
+ font-size: 1.1rem;
418
+ display: flex;
419
+ align-items: center;
420
+ gap: 0.8rem;
421
+ }
422
+
423
+ .result-content {
424
+ padding: 1rem;
425
+ min-height: 50px;
426
+ display: flex;
427
+ flex-direction: column;
428
+ justify-content: center;
429
+ text-align: left;
430
+ }
431
+ .result-content p.info-message {
432
+ text-align: center;
433
+ margin-bottom: 0;
434
+ margin-top: 0;
435
+ }
436
+ .result-content ul {
437
+ margin: 0.5rem 0 0 1.5rem;
438
+ padding: 0;
439
+ list-style: disc;
440
+ }
441
+ .result-content ul li {
442
+ margin-bottom: 0.25rem;
443
+ }
444
+ .result-content h4 {
445
+ color: var(--secondary-color);
446
+ margin-top: 0.5rem;
447
+ margin-bottom: 0.5rem;
448
+ }
449
+
450
+ .scrollable-content {
451
+ max-height: 400px;
452
+ overflow-y: auto;
453
+ padding: 1rem;
454
+ border: 1px solid var(--border-color);
455
+ border-radius: 8px;
456
+ margin-top: 1rem;
457
+ background-color: var(--background-color);
458
+ }
459
+ .dark-mode .scrollable-content {
460
+ background-color: #333;
461
+ border-color: #616161;
462
+ }
463
+ .scrollable-content h4 {
464
+ color: var(--secondary-color);
465
+ margin-top: 1rem;
466
+ margin-bottom: 0.5rem;
467
+ }
468
+
469
+
470
+ .mic-checkbox-group {
471
+ margin-top: 1.5rem;
472
+ padding: 1rem;
473
+ border: 1px solid var(--border-color);
474
+ border-radius: 8px;
475
+ background-color: var(--container-bg-color);
476
+ box-shadow: 0 1px 5px rgba(0,0,0,0.05);
477
+ display: flex;
478
+ flex-wrap: wrap;
479
+ justify-content: center;
480
+ gap: 15px;
481
+ margin-bottom: 1.5rem;
482
+ }
483
+
484
+ .dark-mode .mic-checkbox-group {
485
+ background-color: #424242;
486
+ border-color: #616161;
487
+ }
488
+
489
+ .mic-checkbox-container {
490
+ display: flex;
491
+ align-items: center;
492
+ cursor: pointer;
493
+ font-size: 1rem;
494
+ color: var(--text-color);
495
+ user-select: none;
496
+ }
497
+
498
+ .mic-checkbox-container input[type="checkbox"] {
499
+ appearance: none;
500
+ -webkit-appearance: none;
501
+ width: 20px;
502
+ height: 20px;
503
+ border: 2px solid var(--primary-color);
504
+ border-radius: 4px;
505
+ margin-right: 8px;
506
+ cursor: pointer;
507
+ position: relative;
508
+ outline: none;
509
+ transition: all 0.2s ease-in-out;
510
+ }
511
+
512
+ .mic-checkbox-container input[type="checkbox"]:checked {
513
+ background-color: var(--primary-color);
514
+ border-color: var(--primary-color);
515
+ }
516
+
517
+ .mic-checkbox-container input[type="checkbox"]:checked::before {
518
+ content: '\2713';
519
+ display: block;
520
+ position: absolute;
521
+ top: 50%;
522
+ left: 50%;
523
+ transform: translate(-50%, -50%);
524
+ font-size: 14px;
525
+ color: white;
526
+ }
527
+
528
+ .mic-checkbox-container .mic-label {
529
+ margin-left: 5px;
530
+ font-weight: normal;
531
+ }
532
+
533
+ /* Email-related CSS */
534
+ #user-email-input-group {
535
+ margin-top: 1.5rem;
536
+ margin-bottom: 1rem;
537
+ }
538
+ #user-email {
539
+ width: 100%;
540
+ padding: 0.7rem;
541
+ border: 1px solid var(--border-color);
542
+ border-radius: 5px;
543
+ box-sizing: border-box;
544
+ font-size: 1rem;
545
+ color: var(--text-color);
546
+ background-color: var(--container-bg-color);
547
+ }
548
+ #user-email:focus {
549
+ outline: none;
550
+ border-color: var(--secondary-color);
551
+ }
552
+ #email-status {
553
+ text-align: left;
554
+ font-size: 0.9rem;
555
+ margin-top: 0.3rem;
556
+ min-height: 1.2em;
557
+ }
558
+
559
+
560
+ @media (max-width: 768px) {
561
+ body {
562
+ padding: 10px;
563
+ }
564
+ .results-display-group {
565
+ grid-template-columns: 1fr;
566
+ }
567
+ footer {
568
+ padding-left: 10px;
569
+ padding-right: 10px;
570
+ margin-left: calc(-50vw + 50%);
571
+ margin-right: calc(-50vw / 2 + 50%);
572
+ }
573
+ }
574
+
575
+ .team-member-list {
576
+ list-style: none;
577
+ padding: 0;
578
+ display: flex;
579
+ flex-direction: column;
580
+ align-items: flex-start;
581
+ gap: 15px;
582
+ }
583
+
584
+ .team-member-list li {
585
+ display: flex;
586
+ align-items: center;
587
+ gap: 15px;
588
+ font-size: 1.1rem;
589
+ color: var(--text-color);
590
+ background-color: var(--background-color);
591
+ padding: 10px 15px;
592
+ border-radius: 8px;
593
+ box-shadow: 0 1px 3px rgba(0,0,0,0.08);
594
+ width: 100%;
595
+ box-sizing: border-box;
596
+ }
597
+
598
+ .dark-mode .team-member-list li {
599
+ background-color: #333;
600
+ box-shadow: 0 1px 3px rgba(255,255,255,0.08);
601
+ }
602
+
603
+ .team-member-list img {
604
+ width: 60px;
605
+ height: 60px;
606
+ border-radius: 50%;
607
+ object-fit: cover;
608
+ border: 2px solid var(--secondary-color);
609
+ flex-shrink: 0;
610
+ }
611
  </style>
612
 
613
  </head>
 
618
  <img src="image2.png" alt="Tool Logo">
619
  </div>
620
 
621
+ <div class="tabs">
622
+ <div class="tab active" data-tab="prediction">
623
+ <i class="fas fa-search"></i> Prediction
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
624
  </div>
625
+ <div class="tab" data-tab="model">
626
+ <i class="fas fa-chart-line"></i> Models' Metrics & Sample run
627
+ </div>
628
+ <div class="tab" data-tab="about">
629
+ <i class="fas fa-info-circle"></i> About
630
+ </div>
631
+ <div class="tab" data-tab="usage">
632
+ <i class="fas fa-book"></i> Usage Guide
633
  </div>
634
  </div>
635
 
636
+ <div class="tab-content active" id="prediction">
637
+ <h2>AMP & MIC Predictor</h2>
638
+ <p>Enter an amino acid sequence (between 10 and 100 valid amino acids) or upload a FASTA file to predict AMP class and MIC values.</p>
639
+ <div class="input-group">
640
+ <input type="file" id="file-input" accept=".fasta,.fa,.fna">
641
+ <textarea id="sequence" placeholder="Enter amino acid sequence (10-100 Valid AAs) or upload a FASTA file..." maxlength="100"></textarea>
642
+ <div class="character-count">
643
+ <span id="char-count">0</span>/100
644
+ </div>
645
+ <i class="info-icon" id="info-icon">ⓘ</i>
646
+ <div class="tooltip">
647
+ Enter the amino acid sequence you want to classify or upload a FASTA file. The sequence must be between 10 and 100 characters long and contain only standard amino acid characters (ACDEFGHIKLMNPQRSTVWY).
648
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
649
  </div>
 
650
 
651
+ <h3 style="margin-top: 0rem; margin-bottom: 0.5rem;">Select Bacteria for MIC Prediction</h3>
652
+ <p style="margin-top: 0; margin-bottom: 1rem;">Choose one or more bacteria for which you'd like to predict the Minimum Inhibitory Concentration (MIC) of the peptide. MIC prediction is only performed if the sequence is classified as an Antimicrobial Peptide (AMP).</p>
653
+
654
+ <div class="mic-checkbox-group">
655
+ <label class="mic-checkbox-container">
656
+ <input type="checkbox" id="mic-ecoli" value="e_coli" disabled>
657
+ <span class="mic-label">E.coli</span>
658
+ </label>
659
+ <label class="mic-checkbox-container">
660
+ <input type="checkbox" id="mic-paeruginosa" value="p_aeruginosa" disabled>
661
+ <span class="mic-label">P. aeruginosa</span>
662
+ </label>
663
+ <label class="mic-checkbox-container">
664
+ <input type="checkbox" id="mic-saureus" value="s_aureus" disabled>
665
+ <span class="mic-label">S. aureus</span>
666
+ </label>
667
+ <label class="mic-checkbox-container">
668
+ <input type="checkbox" id="mic-kpneumoniae" value="k_pneumoniae" disabled>
669
+ <span class="mic-label">K. pneumoniae</span>
670
+ </label>
671
+ </div>
672
 
673
+ <!-- Start of Email Input Section -->
674
+ <div class="input-group" id="user-email-input-group" style="margin-top: 1.5rem; margin-bottom: 1rem;">
675
+ <label for="user-email" style="display:block; text-align:left; margin-bottom:0.5rem; font-weight:bold;">Please enter your Email Address for detailed results:<span style="color:red;">*</span></label>
676
+ <input type="email" id="user-email" placeholder="Enter your email to receive the PDF report" required>
677
+ <div id="email-error" class="error-message" style="text-align:left; font-size:0.9rem; margin-top:0.3rem; display:none;"></div>
678
+ <div id="email-status" style="text-align:left; font-size:0.9rem; margin-top:0.3rem; min-height: 1.2em;"></div>
679
+ </div>
680
+ <!-- End of Email Input Section -->
681
+
682
+ <!-- Wrapper for estimated time and buttons -->
683
+ <div class="button-group-wrapper">
684
+ <div id="processing-time-info">Estimated processing time: around 30 seconds.</div>
685
+ <div class="button-group">
686
+ <button onclick="clearInput()" id="clear-btn">Clear Input</button>
687
+ <button onclick="classifySequenceDebounced()" id="predict-btn">Submit</button>
688
  </div>
689
  </div>
690
 
691
+ <div class="error-message" id="error"></div>
692
+
693
+ <div class="results-display-group">
694
+ <div class="result-box">
695
+ <div class="result-header"><i class="fas fa-file-alt"></i>Classification</div>
696
+ <div class="result-content" id="amp-classification-output">
697
+ <p class="info-message">The prediction will appear here.</p>
698
+ </div>
699
+ </div>
700
+
701
+ <div class="result-box">
702
+ <div class="result-header"><i class="fas fa-info-circle"></i> Additional Details</div>
703
+ <div class="result-content" id="additional-details-output">
704
+ <p class="info-message">The detailed report will appear here.</p>
705
+ <a id="download-link" style="display: none;">Download Detailed Report (PDF)</a>
706
+ </div>
707
  </div>
708
  </div>
709
  </div>
 
710
 
711
+ <div class="tab-content" id="model">
712
+ <h2>Classifier Metrics</h2>
713
+ <p>The following table presents the performance metrics of our antimicrobial peptide classification model. These metrics were obtained on a held-out test set, separate from the training data.</p>
714
+ <table class="metrics-table">
715
+ <thead>
716
+ <tr>
717
+ <th>Metric</th>
718
+ <th>Value</th>
719
+ <th>Description</th>
720
+ </tr>
721
+ </thead>
722
+ <tbody>
723
+ <tr>
724
+ <td>Accuracy</td>
725
+ <td>0.963</td>
726
+ <td>The overall correctness of the model, representing the proportion of correctly classified sequences (both AMP and Non-AMP).</td>
727
+ </tr>
728
+ <tr>
729
+ <td>Precision</td>
730
+ <td>0.964</td>
731
+ <td>Out of all sequences predicted as AMPs, the proportion that are truly AMPs. A high precision indicates fewer false positives.</td>
732
+ </tr>
733
+ <tr>
734
+ <td>Recall</td>
735
+ <td>0.963</td>
736
+ <td>Out of all actual AMP sequences, the proportion that the model correctly identifies. A high recall indicates fewer false negatives.</td>
737
+ </tr>
738
+ <tr>
739
+ <td>F1-Score</td>
740
+ <td>0.963</td>
741
+ <td>The harmonic mean of precision and recall, providing a balanced measure of the model's performance.</td>
742
+ </tr>
743
+ <tr>
744
+ <td>Validation Accuracy</td>
745
+ <td>0.968</td>
746
+ <td>The accuracy of the model on a separate validation dataset, used during model development to tune hyperparameters.</td>
747
+ </tr>
748
+ </tbody>
749
+ </table>
750
+
751
+ <h2 style="margin-top: 2rem;">Regressor Metrics (MIC Prediction Models)</h2>
752
+ <p>The Minimum Inhibitory Concentration (MIC) prediction is handled by separate regressor models. Their performance metrics for each bacterium are detailed below:</p>
753
+
754
+ <table class="metrics-table">
755
+ <thead>
756
+ <tr>
757
+ <th>Bacterium</th>
758
+ <th>MSE (log)</th>
759
+ <th>MSE</th>
760
+ <th>R2</th>
761
+ <th>MAE</th>
762
+ <th>Pearson</th>
763
+ <th>Kendall</th>
764
+ </tr>
765
+ </thead>
766
+ <tbody>
767
+ <tr>
768
+ <td>E.coli</td>
769
+ <td>0.0481</td>
770
+ <td>0.4864</td>
771
+ <td>0.7023</td>
772
+ <td>0.1375</td>
773
+ <td>0.8394</td>
774
+ <td>0.6725</td>
775
+ </tr>
776
+ <tr>
777
+ <td>P. aeruginosa</td>
778
+ <td>0.0517</td>
779
+ <td>0.5227</td>
780
+ <td>0.6864</td>
781
+ <td>0.1233</td>
782
+ <td>0.8311</td>
783
+ <td>0.6922</td>
784
+ </tr>
785
+ <tr>
786
+ <td>S.aureus</td>
787
+ <td>0.0517</td>
788
+ <td>0.4988</td>
789
+ <td>0.6828</td>
790
+ <td>0.1472</td>
791
+ <td>0.8278</td>
792
+ <td>0.6536</td>
793
+ </tr>
794
+ <tr>
795
+ <td>K. pneumoniae</td>
796
+ <td>0.0538</td>
797
+ <td>0.4292</td>
798
+ <td>0.7416</td>
799
+ <td>0.1479</td>
800
+ <td>0.8693</td>
801
+ <td>0.7194</td>
802
+ </tr>
803
+ </tbody>
804
+ </table>
805
+
806
+ <h2 style="margin-top: 2rem;">Model Interpretability</h2>
807
+ <p>To understand how our model makes predictions, we use SHAP (SHapley Additive exPlanations) values globally and LIME (Local Interpretable Model-agnostic Explanations) locally. SHAP values help assess the overall contribution of each feature to model predictions across the dataset, while LIME explains the features influencing a single, specific prediction.</p>
808
+
809
+ <h3>Global SHAP Plot</h3>
810
+ <p>The SHAP plot below visualizes the features that most significantly influence the model's predictions *on average across all data*. Positive SHAP values generally contribute to the sequence being classified as AMP, while negative values contribute to Non-AMP classification.</p>
811
+
812
+ <div id="shap-plot-container">
813
+ <img src="shap.png" alt="SHAP Plot" >
814
+ </div>
815
+
816
+ <h3>Interpretation of Global SHAP Plot</h3>
817
+ <div class="scrollable-content">
818
+ <p>Based on the SHAP plot, the model's predictions for Antimicrobial Peptides (AMPs) are influenced by a combination of sequence-based, structural, and biophysical features. Here’s a breakdown of the key features and their biological implications:</p>
819
+ <h4>A. Sequence-Based Features</h4>
820
+ <h5>APAAC13 & APAAC5 (Amphiphilic Pseudo-Amino Acid Composition)</h5>
821
+ <ul>
822
+ <li><strong>Description:</strong> These features encode hydrophobicity, charge, and side-chain properties, reflecting the amphiphilic nature of the peptide.</li>
823
+ <li><strong>Interpretation:<b> Higher APAAC values have a positive SHAP impact, indicating they are predictive of AMP activity. This suggests that the model values amphiphilic sequences, which are crucial for disrupting bacterial membranes.</b></strong></li>
824
+ </ul>
825
+ <h5>Amino Acid Composition (M, C)</h5>
826
+ <ul>
827
+ <li><strong>M (Methionine):</strong>
828
+ <ul>
829
+ <li><strong>Description:</strong> Methionine is often associated with structural stability in peptides.</li>
830
+ <li><strong>Interpretation:</strong> The plot suggests Methionine content has a positive influence, possibly contributing to the stability of AMP candidates.</li>
831
+ </ul>
832
+ </li>
833
+ <li><strong>C (Cysteine):</strong>
834
+ <ul>
835
+ <li><strong>Description:</strong> Cysteine is known for forming disulfide bonds, which can stabilize AMP structures like defensins.</li>
836
+ <li><strong>Interpretation:</strong> High cysteine content appears to have a positive SHAP impact. This could be because disulfide-stabilized AMPs often exhibit enhanced antimicrobial action.</li>
837
+ </ul>
838
+ </li>
839
+ </ul>
840
+ <h4>B. Structural and Biophysical Features</h4>
841
+ <ul>
842
+ <li><strong>HydrophobicityD3001:</strong>
843
+ <ul>
844
+ <li><strong>Description:<b> Represents the overall hydrophobicity of the peptide sequence.</b></strong></li>
845
+ <li><strong>Interpretation:</strong> Hydrophobicity is shown to be a critical feature. More hydrophobic peptides are strongly favored for AMP classification, aligning with the understanding that hydrophobicity is essential for membrane insertion and disruption.</li>
846
+ </ul>
847
+ </li>
848
+ <li><strong>PolarityD1001:</strong>
849
+ <ul>
850
+ <li><strong>Description:<b> Measures the polarity of the peptide sequence.</b></strong></li>
851
+ <li><strong>Interpretation:</strong> The model considers polarity, likely in balance with hydrophobicity. An optimal AMP efficacy is often linked to having both hydrophobic and polar residues to facilitate membrane interaction and solubility.</li>
852
+ </ul>
853
+ </li>
854
+ <li><strong>Solvent Accessibility (SolventAccessibilityD3001):</strong>
855
+ <ul>
856
+ <li><strong>Description:</strong> Reflects how exposed the residues are to the solvent (water).</li>
857
+ <li><strong>Interpretation:</strong> Solvent-accessible residues positively contribute to AMP prediction. This might indicate that exposed residues facilitate interaction with bacterial membranes or the surrounding environment.</li>
858
+ </ul>
859
+ </li>
860
+ <li><strong>Charge (ChargeD2001):</strong>
861
+ <ul>
862
+ <li><strong>Description:<b> Represents the net charge of the peptide.</b></strong></li>
863
+ <li><strong>Interpretation:</strong> Charge is a significant positive predictor. Most AMPs are cationic, enabling them to interact with negatively charged bacterial membranes. Higher charge, as indicated by positive SHAP values, typically enhances antimicrobial potency.</li>
864
+ </ul>
865
+ </li>
866
+ <li><strong>PolarizabilityD3001 & NormalizedVDWVD3001:<b>
867
+ <ul>
868
+ <li><strong>Description:<b> These features relate to electronic distribution (Polarizability) and steric effects (NormalizedVDWVD) of the peptide.</b></strong></li>
869
+ <li><strong>Interpretation:</b> These properties impact membrane penetration and peptide-membrane interactions. Their positive SHAP values suggest they are important for AMP activity, possibly by influencing how the peptide inserts into and destabilizes membranes.</li>
870
+ </ul>
871
+ </li>
872
+ </ul>
873
+ <h4>C. Geary Autocorrelation Features</h4>
874
+ <p>Geary autocorrelation descriptors reflect spatial properties of peptides, encoding information about the adhesion and distribution of physicochemical properties along the sequence.</p>
875
+ <ul>
876
+ <li><strong>GearyAuto_Hydrophobicity30:</strong>
877
+ <ul>
878
+ <li><strong>Description:</strong> Encodes the clustering of hydrophobic residues within a spatial lag of 30.</li>
879
+ <li><strong>Interpretation:<b> Higher values of hydrophobicity autocorrelation are positively associated with AMP prediction. This likely reflects the importance of hydrophobic clustering in forming amphipathic structures, such as α-helices, which are common and effective in AMPs.</b></b></li>
880
+ </ul>
881
+ </li>
882
+ <li><strong>GearyAuto_Steric30 & GearyAuto_Steric29:</strong>
883
+ <ul>
884
+ <li><strong>Description:</b> Reflect peptide backbone flexibility and steric properties at spatial lags of 30 and 29.</li>
885
+ <li><strong>Interpretation:</strong> These features have a positive SHAP impact, suggesting that a certain degree of peptide backbone flexibility may be beneficial for AMP action. Flexibility could enhance the peptide's ability to interact with and adapt to diverse bacterial membrane structures.</li>
886
+ </ul>
887
+ </li>
888
+ <li><strong>GearyAuto_ResidueASA30:<b>
889
+ <ul>
890
+ <li><strong>Description:</strong> Indicates the autocorrelation of accessible surface area of residues at a spatial lag of 30.</li>
891
+ <li><strong>Interpretation:<b> Higher autocorrelation of residue accessible surface area is favored. This could mean that a consistent pattern of residue exposure, possibly with higher exposure of charged or polar residues, improves bacterial targeting or membrane interaction.</b></b></li>
892
+ </ul>
893
+ </li>
894
+ </ul>
895
+ </div>
896
 
897
+ <h3>Sample Run</h3>
898
+ <p>You can test the model with various sequences to understand its behavior. Here are a few examples:</p>
 
 
 
899
  <ul>
900
+ <li><strong>Test 1:</strong> Long Sequence of 99 AAs (P-AMP) - MEKAALIFIGLLLFSTCTQILAQSCNNDSDCTNLKCATKNIKCEQNKCQCLDERYIRA
901
+ ISLNTRSPRCNVQSCIDHCKAIGEVIYVCFTYHCYCRKPPM</li>
902
+ <li><strong>Test 2:</strong> Long Sequence of 99 AAs (Non-AMP) - MKSLLPLAILAALAVAALCYESHESMESYEVSPFTTRRNANTFISPQQRWHAK
903
+ AQERVRELNKPAQEINREACDDYKLCERYALIYGYNAAYNRYFRQR</li>
904
+ <li><strong>Test 3:</strong> Short Sequence of 51 AAs (P-AMP) - SLQGGAPNFPQPSQQNGGWQVSPDLGRDDKGNTRGQIEIQNKGKDHDFNAG</li>
905
+ <li><strong>Test 4:<b> Short Sequence of 50 AAs (Non-AMP) - MKPLKQKVSITLDEDVIKNLKTLAEECDRSLSQYINLILKEHLKNLDQQ</b></b></li>
906
+ <li><strong>Test 5:</strong> Invalid Characters (eg. X) -
907
+ MEKAALIFIGLLLFSTCTQILAQSC(XX).</li>
908
  </ul>
909
+ </div>
910
+
911
+ <div class="tab-content" id="about">
912
+ <h2>About This Tool</h2>
913
+ <p>This web application provides a user-friendly interface for classifying amino acid sequences as either Antimicrobial Peptides (AMPs) or Non-Antimicrobial Peptides (Non-AMPs). AMPs are crucial components of the innate immune system, offering defense against a wide range of pathogens.</p>
914
+ <h3>Model Selection Criteria</h3>
915
+ <p>To identify the most effective model, our team rigorously evaluated over 225 combinations of feature extraction and selection methods across four different machine learning models for each target organism. The evaluation included both classification and regression tasks, with a focus on predicting antimicrobial activity and estimating minimum inhibitory concentration (MIC) values. The final model was selected based on the following criteria:</p>
916
  <ul>
917
+ <li><strong>High Accuracy, F1-score, and Validation Accuracy:</strong> The model achieved excellent performance metrics on a held-out test set, demonstrating its ability to generalize to unseen data.</li>
918
+ <li><strong>Robustness to Sequence Length Variations:<b> The model performs consistently well on sequences of varying lengths, within the specified range (10-100 amino acids).</b></strong></li>
919
+ <li><strong>Generalization Ability:</strong> The model was trained and evaluated on diverse datasets to ensure its ability to classify a broad range of AMP sequences.</li>
920
+ <li><strong>Robust regression capability:<b> Assessed using Mean Squared Error (MSE), R-squared (R²), Pearson correlation, and Kendall’s tau, the model demonstrated strong agreement between predicted and true MIC values.</b></b></li>
 
 
 
 
 
 
 
 
921
  </ul>
922
+ <h3>Intended Use</h3>
923
+ <p>This tool is intended for research and educational purposes. It can be a valuable resource for researchers studying antimicrobial peptides and developing new therapeutic strategies. However, it is not a replacement for laboratory-based experimental validation.</p>
924
+ <h3>Our Team</h3>
925
+ <ul class="team-member-list">
926
+ <li><img src="team-member-1.jpg" alt="Ali Magdi"> Ali Magdi - Computational Biologist</li>
927
+ <li><img src="team-member-2.jpg" alt="Ahmed Amr"> Ahmed Amr - Computational Biologist</li>
928
+ <li><img src="team-member-3.jpg" alt="Omar Loay"> Omar Loay - Molecular Biologist</li>
929
+ <li><img src="team-member-4.jpg" alt="Prof. Eman Badr"> Prof. Eman Badr - Full Professor and Director of BCBU</li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
930
  </ul>
931
+ <h3>Acknowledgements</h3>
932
+ <p>We extend our gratitude to the following organizations for their support:</p>
933
  <ul>
934
+ <li>Bioinformatics and Computational Biology Unit at Zewail City.</li>
935
+ <li>The Centre for Genomics at Zewail City.</li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
936
  </ul>
937
+ <h3>Contact</h3>
938
+ <p>For questions, inquiries, or feedback, please reach out to us at: <a href="mailto:epicamp.sup@gmail.com">epicamp.sup@gmail.com</a></p>
939
  </div>
940
 
941
+ <div class="tab-content" id="usage">
942
+ <h2>Usage Guide</h2>
943
+ <p>Follow these steps to use the AMP Classifier:</p>
944
+ <h3>Step 1: Prepare Your Sequence</h3>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
945
  <ul>
946
+ <li>You can either enter the amino acid sequence directly or upload a FASTA file.</li>
947
+ <li>Ensure your sequence contains only standard amino acid characters (ACDEFGHIKLMNPQRSTVWY).</li>
948
+ <li>The sequence length must be between 10 and 100 amino acids.</li>
949
  </ul>
950
+ <h3>Step 2: Input the Sequence</h3>
951
+ <ul>
952
+ <li><strong>Direct Input:</strong> Type or paste your sequence into the text area provided.</li>
953
+ <li><strong>FASTA File Upload:<b> Click the "Choose File" button and select your .fasta, .fa, or .fna file.</b></b></li>
954
+ <li>The character count will update as you type or upload a sequence.</li>
955
+ </ul>
956
+ <h3>Step 3: Analyze the Sequence</h3>
957
+ <ul>
958
+ <li>Click the "Submit" button.</li>
959
+ <li>A message indicating the estimated processing time will be visible above the buttons, and the button itself will show elapsed time.</li>
960
+ </ul>
961
+ <h3>Step 4: View the Results</h3>
962
+ <ul>
963
+ <li>Once the analysis is complete, the prediction (AMP or Non-AMP) will be displayed in the "AMP Classification" box.</li>
964
+ <li>A link to "Download Detailed Report (PDF)" will appear in the "Additional Details" box if the report was generated successfully.</li>
965
+ </ul>
966
+ <h3>Step 5: Clear the Input</h3>
967
+ <ul>
968
+ <li>To analyze another sequence, click the "Clear Input" button. This will reset the input fields and results.</li>
969
+ </ul>
970
+ <h3>Troubleshooting</h3>
971
+ <ul>
972
+ <li><strong>Invalid Characters:</b> If you see an error message about invalid characters, double-check that your sequence contains only standard amino acid characters.</li>
973
+ <li><strong>Sequence Length:</strong> Ensure your sequence is between 10 and 100 characters long.</li>
974
+ <li><strong>Invalid FASTA Format:<b> If you encounter an error with a FASTA file, make sure the file is correctly formatted.</b></b></li>
975
+ </ul>
976
+ </div>
977
  </div>
978
 
979
  <footer>
 
1001
  const tabs = document.querySelectorAll('.tab');
1002
  const tabContents = document.querySelectorAll('.tab-content');
1003
 
1004
+ // New constants for email functionality
1005
+ const userEmailInput = document.getElementById('user-email');
1006
+ const emailErrorDiv = document.getElementById('email-error');
1007
+ const emailStatusDiv = document.getElementById('email-status');
1008
+
1009
  let clientInstance;
1010
  let debounceTimer;
1011
  let countUpIntervalId; // For count-up timer
 
1107
  predictBtn.disabled = true;
1108
  predictBtn.textContent = 'Submit';
1109
  }
1110
+
1111
+ // Clear email specific fields
1112
+ if(userEmailInput) userEmailInput.value = '';
1113
+ if(emailErrorDiv) emailErrorDiv.style.display = 'none';
1114
+ if(emailStatusDiv) {
1115
+ emailStatusDiv.textContent = '';
1116
+ emailStatusDiv.style.color = 'var(--text-color)'; // Reset color
1117
+ }
1118
  }
1119
 
1120
  function handleFileSelect(event) {
 
1234
  return isValid;
1235
  }
1236
 
1237
+ // New email validation function
1238
+ function validateEmail(email) {
1239
+ if (!email) {
1240
+ return { isValid: false, message: "Email address is required to send the report." };
1241
+ }
1242
+ // Basic email regex for format validation
1243
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
1244
+ if (!emailRegex.test(email)) {
1245
+ return { isValid: false, message: "Please enter a valid email address." };
1246
+ }
1247
+ return { isValid: true, message: "" };
1248
+ }
1249
+
1250
  function updateCharacterCount() {
1251
  if(!sequenceInput || !charCount) return;
1252
  const currentLength = sequenceInput.value.length;
 
1320
  }
1321
 
1322
  const currentSequence = sequenceInput ? sequenceInput.value.trim().toUpperCase() : "";
1323
+ const userEmail = userEmailInput ? userEmailInput.value.trim() : "";
1324
 
1325
+ // Validate sequence first
1326
+ if (!validateSequence(currentSequence)) {
1327
+ if (countUpIntervalId) { clearInterval(countUpIntervalId); countUpIntervalId = null; }
1328
+ if (predictBtn) { predictBtn.disabled = false; predictBtn.textContent = 'Submit';}
1329
+ return;
1330
+ }
1331
 
1332
+ // Validate email after sequence
1333
+ const emailValidation = validateEmail(userEmail);
1334
+ if (!emailValidation.isValid) {
1335
+ if (emailErrorDiv) {
1336
+ emailErrorDiv.textContent = emailValidation.message;
1337
+ emailErrorDiv.style.display = 'block';
1338
+ }
1339
+ if (countUpIntervalId) { clearInterval(countUpIntervalId); countUpIntervalId = null; }
1340
+ if (predictBtn) { predictBtn.disabled = false; predictBtn.textContent = 'Submit';}
1341
+ return;
1342
+ } else {
1343
+ if (emailErrorDiv) emailErrorDiv.style.display = 'none';
1344
+ }
1345
+
1346
+ clearError(); // Clear any previous sequence errors
1347
+ if(emailErrorDiv) emailErrorDiv.style.display = 'none'; // Clear email validation error
1348
+ if(emailStatusDiv) { // Reset email status message
1349
+ emailStatusDiv.textContent = '';
1350
+ emailStatusDiv.style.color = 'var(--text-color)';
1351
+ }
1352
 
1353
  if (predictBtn) predictBtn.disabled = true;
1354
  if (ampClassificationOutput) ampClassificationOutput.innerHTML = '<p class="info-message">Analyzing...</p>';
 
1440
  } catch (pdfGenerationError) {
1441
  console.error("Error during PDF report content generation:", pdfGenerationError);
1442
  showError(`PDF report generation failed: ${pdfGenerationError.message}`);
1443
+ emailStatusDiv.textContent = 'PDF generation failed, cannot send email.';
1444
+ emailStatusDiv.style.color = 'var(--clear-button-bg)';
1445
  pdfDoc = null; // Ensure pdfDoc is null on error
1446
  }
1447
 
 
1462
  if (!additionalDetailsOutput.contains(downloadLink)) {
1463
  additionalDetailsOutput.appendChild(downloadLink);
1464
  }
1465
+
1466
+ // --- NEW: Call backend to send email ---
1467
+ await sendEmailWithReport(userEmail, pdfBlob, pdfFileName);
1468
+
1469
  } else {
1470
  additionalDetailsOutput.innerHTML = '<p class="info-message" style="color: var(--warning-color);">Could not generate PDF report for download.</p>';
1471
  if (downloadLink.parentNode === additionalDetailsOutput) {
1472
  downloadLink.style.display = 'none';
1473
  }
1474
+ // Also update email status if PDF couldn't be generated
1475
+ emailStatusDiv.textContent = 'PDF report could not be generated, email not sent.';
1476
+ emailStatusDiv.style.color = 'var(--clear-button-bg)';
1477
  }
1478
  }
1479
 
 
1495
  downloadLink.style.display = 'none';
1496
  }
1497
  }
1498
+ emailStatusDiv.textContent = `Email not sent due to prediction error: ${error.message}`;
1499
+ emailStatusDiv.style.color = 'var(--clear-button-bg)';
1500
  } finally {
1501
  if (countUpIntervalId) { clearInterval(countUpIntervalId); countUpIntervalId = null; }
1502
  if (predictBtn) { predictBtn.disabled = false; predictBtn.textContent = 'Submit';}
1503
  }
1504
  }
1505
 
1506
+ // New function to send email with the report
1507
+ async function sendEmailWithReport(email, pdfBlob, fileName) {
1508
+ if (!emailStatusDiv) return;
1509
+
1510
+ emailStatusDiv.textContent = 'Sending email...';
1511
+ emailStatusDiv.style.color = 'var(--info-color)'; // Blue for processing
1512
+
1513
+ const reader = new FileReader();
1514
+ reader.readAsDataURL(pdfBlob);
1515
+
1516
+ reader.onloadend = async function() {
1517
+ const base64data = reader.result;
1518
+ const base64PdfContent = base64data.split(',')[1]; // Strip "data:application/pdf;base64," prefix
1519
+
1520
+ try {
1521
+ // **IMPORTANT**: Replace with the actual URL of your backend email sending service.
1522
+ // For local testing, it might be 'http://localhost:3000/api/send-report-email'
1523
+ // For deployment, it will be your deployed backend's URL.
1524
+ const backendEndpoint = '/api/send-report-email';
1525
+
1526
+ const response = await fetch(backendEndpoint, {
1527
+ method: 'POST',
1528
+ headers: {
1529
+ 'Content-Type': 'application/json',
1530
+ },
1531
+ body: JSON.stringify({
1532
+ recipientEmail: email,
1533
+ pdfContent: base64PdfContent, // Base64 encoded PDF
1534
+ fileName: fileName,
1535
+ sequence: sequenceInput.value.trim(), // Optionally send sequence for email body context
1536
+ }),
1537
+ });
1538
+
1539
+ if (response.ok) {
1540
+ const result = await response.json();
1541
+ emailStatusDiv.textContent = result.message || 'Email sent successfully!';
1542
+ emailStatusDiv.style.color = 'var(--success-color)';
1543
+ } else {
1544
+ const errorData = await response.json();
1545
+ emailStatusDiv.textContent = `Failed to send email: ${errorData.message || response.statusText}`;
1546
+ emailStatusDiv.style.color = 'var(--clear-button-bg)';
1547
+ console.error('Backend email error:', errorData);
1548
+ }
1549
+ } catch (error) {
1550
+ emailStatusDiv.textContent = `Error communicating with email service: ${error.message}`;
1551
+ emailStatusDiv.style.color = 'var(--clear-button-bg)';
1552
+ console.error('Frontend network error sending email:', error);
1553
+ }
1554
+ };
1555
+
1556
+ reader.onerror = function(error) {
1557
+ emailStatusDiv.textContent = `Error reading PDF file for email: ${error.message}`;
1558
+ emailStatusDiv.style.color = 'var(--clear-button-bg)';
1559
+ console.error('FileReader error:', error);
1560
+ };
1561
+ }
1562
+
1563
+
1564
  async function getBase64Image(imgSrc) {
1565
  return new Promise((resolve) => {
1566
  if (!imgSrc) { resolve(null); return; }
 
1758
  pdf.setFontSize(16); pdf.setTextColor(primaryC[0],primaryC[1],primaryC[2]);
1759
  pdf.text("Global SHAP Feature Importance:",20,yPos);
1760
  yPos+=8;
1761
+ try{pdf.addImage(shapPlotB64,'PNG',(pageW idth-imgW)/2,yPos,imgW,imgH); yPos+=imgH+10;}
1762
  catch(e){console.error("Error adding SHAP PDF:",e); yPos+=10;}
1763
  }
1764
  } else {
 
1787
  </script>
1788
 
1789
  </body>
1790
+ </html>