-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1555 lines (1348 loc) · 61 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
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
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Immune Cell Knowledge Graph</title>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: #f8f9fa;
}
.container {
max-width: 1200px;
margin: 0 auto;
background-color: white;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.tab-description {
background-color: #f8f9fa;
padding: 20px;
margin: 20px 0;
border-radius: 8px;
color: #666;
line-height: 1.6;
}
/* Tabs moved to top */
.tabs {
display: flex;
border-bottom: 2px solid #ddd;
background-color: #f8f9fa;
border-radius: 8px 8px 0 0;
}
.tab-button {
flex: 1;
padding: 15px 25px;
border: none;
background: none;
font-size: 16px;
font-weight: 500;
color: #666;
cursor: pointer;
position: relative;
transition: color 0.3s;
}
.tab-button:hover {
color: #007bff;
}
.hoverlabel {
pointer-events: auto !important;
cursor: pointer;
}
.js-plotly-plot .plotly .modebar {
z-index: 999;
}
.plotly-hover-box {
background: white;
border: 1px solid #ddd;
border-radius: 4px;
padding: 10px;
position: absolute;
pointer-events: auto !important;
max-width: 300px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.plotly-hover-box a {
color: #007bff;
text-decoration: none;
display: inline-block;
margin: 2px 0;
}
.plotly-hover-box a:hover {
text-decoration: underline;
}
.tab-button.active {
color: #007bff;
}
.tab-button.active::after {
content: '';
position: absolute;
bottom: -2px;
left: 0;
width: 100%;
height: 2px;
background-color: #007bff;
}
/* Home tab content */
.home-content {
padding: 30px;
text-align: center;
}
.home-title {
color: #000000;
font-weight: bold;
margin-bottom: 30px;
font-size: 36px;
}
.home-description {
font-size: 16px;
color: #666;
max-width: 800px;
margin: 20px auto 40px;
line-height: 1.6;
padding: 20px;
background-color: #f8f9fa;
border-radius: 8px;
}
.home-image {
margin: 40px auto;
max-width: 100%;
height: auto;
}
.home-image img {
width: 100%;
max-width: 1000px;
height: auto;
}
.publication {
margin-top: 50px;
padding: 30px;
background-color: #f8f9fa;
border-radius: 8px;
}
.publication h3 {
color: #333;
margin-bottom: 15px;
}
.publication .title {
font-weight: 600;
margin: 10px 0;
font-size: 18px;
}
.publication .authors {
margin: 10px 0;
color: #444;
}
.publication .affiliations {
font-size: 13px;
color: #666;
max-width: 700px;
margin: 10px auto;
line-height: 1.4;
text-align: left;
}
.autocomplete-wrapper {
position: relative;
}
.suggestions-list {
position: absolute;
top: 100%;
left: 0;
right: 0;
background: white;
border: 1px solid #ddd;
border-top: none;
border-radius: 0 0 4px 4px;
max-height: 200px;
overflow-y: auto;
display: none;
z-index: 1000;
margin: 0;
padding: 0;
list-style: none;
}
.suggestions-list li {
padding: 8px 12px;
cursor: pointer;
}
.suggestions-list li:hover {
background-color: #f0f0f0;
}
.phenotype-input-container {
display: flex;
gap: 10px;
margin-bottom: 10px;
}
.check-button {
padding: 8px 16px;
background-color: #6c757d;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
.check-button:hover {
background-color: #5a6268;
}
.match-status {
margin-top: 10px;
padding: 15px;
border-radius: 4px;
background-color: #f8f9fa;
border-left: 4px solid;
}
.match-status.exact {
border-left-color: #28a745;
}
.match-status.error {
border-left-color: #dc3545;
}
.match-status.fuzzy {
border-left-color: #ffc107;
}
.match-status.loading {
border-left-color: #007bff;
}
.loading {
color: #007bff;
}
.check-button:disabled {
background-color: #ccc;
cursor: not-allowed;
}
.suggested-terms {
margin-top: 10px;
}
.suggested-terms li {
padding: 5px 0;
cursor: pointer;
color: #007bff;
}
.suggested-terms li:hover {
text-decoration: underline;
}
.faq-section {
padding: 20px;
max-width: 800px;
margin: 0 auto;
}
.faq-item {
border: 1px solid #e2e8f0;
border-radius: 8px;
overflow: hidden;
}
.faq-question {
padding: 15px 20px;
background-color: #f8f9fa;
cursor: pointer;
font-weight: 500;
display: flex;
justify-content: space-between;
align-items: center;
transition: background-color 0.3s;
}
.faq-question:hover {
background-color: #e9ecef;
}
.faq-answer {
padding: 0;
max-height: 0;
overflow: hidden;
transition: all 0.3s ease-out;
background-color: white;
}
.faq-answer.active {
padding: 20px;
max-height: 500px;
}
.faq-arrow {
font-size: 12px;
transition: transform 0.3s;
}
.faq-question.active .faq-arrow {
transform: rotate(180deg);
}
/* Other tab content styles */
.tab-content {
display: none;
padding: 30px;
}
.tab-content.active {
display: block;
}
/* Form styles */
.form-group {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 8px;
font-weight: 500;
color: #333;
}
input[type="text"], select, textarea {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 16px;
}
textarea {
height: 150px;
font-family: monospace;
resize: vertical;
}
button {
background-color: #007bff;
color: white;
border: none;
padding: 12px 24px;
border-radius: 4px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #0056b3;
}
.loading-indicator {
display: none;
text-align: center;
padding: 20px;
margin: 20px 0;
background-color: #f0f8ff;
border-radius: 6px;
color: #3498db;
font-weight: 500;
}
.error-message {
color: #dc3545;
padding: 10px;
margin: 10px 0;
background-color: #fdf3f2;
border-left: 4px solid #dc3545;
display: none;
}
/* Results styling */
.results-container {
display: flex;
justify-content: space-between;
gap: 20px;
margin: 20px 0;
}
.results-column {
flex: 1;
min-width: 0;
}
.results-column h4 {
margin-top: 0;
margin-bottom: 10px;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: #f8f9fa;
font-weight: 600;
}
tr:hover {
background-color: #f8f9fa;
}
#plotContainer, #perturbPlot, #mechanismPlot {
margin: 20px 0;
text-align: center;
width: 100%;
}
/* Add new progress bar styles */
.progress-container {
display: none;
margin: 20px 0;
background-color: #f8f9fa;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.progress-bar-outer {
width: 100%;
height: 20px;
background-color: #e9ecef;
border-radius: 10px;
overflow: hidden;
}
.progress-bar-inner {
width: 0%;
height: 100%;
background-color: #007bff;
transition: width 0.3s ease;
}
.progress-text {
text-align: center;
margin-top: 10px;
color: #666;
font-size: 14px;
}
.progress-steps {
display: flex;
justify-content: space-between;
margin-top: 15px;
padding: 0 10px;
}
.progress-step {
font-size: 12px;
color: #999;
position: relative;
}
.progress-step.completed {
color: #007bff;
font-weight: 500;
}
/* Style for clickable rows */
.clickable-row td:first-child {
color: #007bff;
text-decoration: underline;
cursor: pointer;
}
/* Loading popup styles */
.popup-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1000;
justify-content: center;
align-items: center;
}
.popup-content {
background-color: white;
padding: 20px 40px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
text-align: center;
}
.popup-content p {
margin: 0;
font-size: 16px;
color: #333;
}
/* Optional: Add a loading spinner */
.loader {
border: 3px solid #f3f3f3;
border-radius: 50%;
border-top: 3px solid #007bff;
width: 24px;
height: 24px;
animation: spin 1s linear infinite;
margin: 10px auto;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
</head>
<body>
<div class="container">
<div class="tabs">
<button class="tab-button active" onclick="switchTab('home')">Home</button>
<button class="tab-button" onclick="switchTab('tab1')">Gene Set Annotation</button>
<button class="tab-button" onclick="switchTab('tab2')">Phenotype of Genes (Forward Genetics)</button>
<button class="tab-button" onclick="switchTab('tab3')">Gene Perturbation Effect (Reverse Genetics)</button>
<button class="tab-button" onclick="switchTab('tab4')">Perturbation Mechanism</button>
<button class="tab-button" onclick="switchTab('tab5')">FAQ</button>
</div>
<!-- Home Tab -->
<div id="home" class="tab-content active">
<div class="home-content">
<h1 class="home-title">Immune Cell Knowledge Graph</h1>
<p class="home-description">
An interactive tool for examination of immune cell types, offering pathway analysis, gene set discovery, and
perturbation predictions in a cell type specific manner. All findings are backed by published literature with
interactive visualizations.
</p>
<div class="home-image">
<img src="./image/website-1.png" alt="Immune Cell Knowledge Graph">
</div>
<div class="publication">
<h3>Publication:</h3>
<p class="title">AI-derived immune cell knowledge graphs to advance immunotherapy</p>
<p class="authors">Authors: Shan He<sup>1</sup>, Yukun Tan<sup>1</sup>, Vakul Mohanty<sup>1</sup>, Hind Rafei<sup>2</sup>, Katayoun Rezvani<sup>2</sup>, Ken Chen<sup>1</sup>*</p>
<p class="affiliations">
<sup>1</sup> Department of Bioinformatics and Computational Biology, The University of Texas MD Anderson Cancer Center, Houston, Texas 77030, USA<br>
<sup>2</sup> Department of Stem Cell Transplantation and Cellular Therapy, The University of Texas MD Anderson Cancer Center, Houston, Texas 77030, USA
</p>
</div>
</div>
</div>
<!-- Gene Set Annotation Tab -->
<div id="tab1" class="tab-content">
<p class="home-description">
Analyze a set of genes to discover their pathway relationships in specific immune cell types. Input your genes of interest
and select a cell type to identify significant pathway associations supported by published literature.
<br><br>
- Manuscript reference: "ICKGs outperform traditional enrichment methods in gene set annotation"
</p>
<div class="input-section">
<div class="form-group">
<label for="geneInput">Enter gene names (one per line) to analyze pathway relationships:</label>
<textarea id="geneInput" placeholder="Example:
GZMK
PRF1
..."></textarea>
</div>
<div class="form-group">
<label for="cellType">Select Cell Type:</label>
<select id="cellType" required>
<option value="NK">NK Cell</option>
<option value="T">T Cell</option>
<option value="B">B Cell</option>
<option value="M">Macrophage</option>
</select>
</div>
<div id="progressContainer" class="progress-container">
<div class="progress-bar-outer">
<div id="progressBar" class="progress-bar-inner"></div>
</div>
<div id="progressText" class="progress-text">Initializing...</div>
<div class="progress-steps">
<div class="progress-step" data-step="validation">Validation</div>
<div class="progress-step" data-step="processing">Processing</div>
<div class="progress-step" data-step="analysis">Analysis</div>
<div class="progress-step" data-step="completion">Completion</div>
</div>
</div>
<button onclick="analyzeGenes()">Analyze</button>
</div>
<div id="geneSetLoading" class="loading-indicator">Analyzing genes, please wait...</div>
<div id="geneSetResults"></div>
</div>
<!-- Phenotype to Genes (Forward Genetics) Tab -->
<div id="tab2" class="tab-content">
<p class="home-description">
"Forward genetics is a molecular genetics approach of determining the genetic basis responsible for a phenotype"
<br><br>
Generate top 10 cell type-specific genes associated with your phenotype of interest. Enter a phenotype (e.g., "antigen-induced exhaustion")
and select a cell type to discover genes and potential mechanism in which these genes contribute to that biological process, backed by literature evidence.
<br><br>
- Manuscript reference: "ICKGs hypothesize molecular mechanisms associated with immunophenotypes"
</p>
<div class="input-section">
<div class="form-group">
<label for="phenotype">Enter phenotype:</label>
<div class="phenotype-input-container">
<input type="text" id="phenotype" placeholder="e.g., antigen-induced exhaustion">
<button onclick="checkPhenotype()" class="check-button">Check</button>
</div>
<div id="matchStatus" class="match-status" style="display: none;">
<!-- Match status will be shown here -->
</div>
</div>
<div class="form-group">
<label for="genesetCellType">Cell Type:</label>
<select id="genesetCellType" required>
<option value="NK">NK Cell</option>
<option value="T">T Cell</option>
<option value="B">B Cell</option>
<option value="M">Macrophage</option>
</select>
</div>
<button onclick="generateGeneset()">Generate Gene Set</button>
</div>
<div id="genesetLoading" class="loading-indicator">Generating gene set, please wait...</div>
<div id="genesetError" class="error-message"></div>
<div id="plotContainer"></div>
<div id="genesetResults"></div>
</div>
<!-- Gene Perturbation effect (Reverse Genetics) Tab -->
<div id="tab3" class="tab-content">
<p class="home-description">
"Reverse genetics is a method in molecular genetics that is used to help understand the function(s) of a gene by analysing the phenotypic effects
caused by the alteration of the gene"
<br><br>
Output top 10 activated or inhibited genes/phenotypes by a gene of interest based on PageRank score.
This analysis could potentially inform on the change in genetic and phenotypic landscape with the experimental perturbation of that gene.
Input a gene of interest and cell type to analyze how it affect molecular or functional level in a corresponding cell type, based on statistical analysis of the knowledge graph.
<br><br>
- Manuscript reference: "ICKGs predict shift in transcriptomic profiles following experimental manipulations"
</p>
<div class="input-section">
<div class="form-group">
<label for="perturbationGene">Gene:</label>
<input type="text" id="perturbationGene" placeholder="e.g., IKZF2">
</div>
<div class="form-group">
<label for="perturbCellType">Cell Type:</label>
<select id="perturbCellType" required>
<option value="NK">NK Cell</option>
<option value="T">T Cell</option>
<option value="B">B Cell</option>
<option value="M">Macrophage</option>
</select>
</div>
<button onclick="predictPerturbation()">Analyze Perturbation</button>
</div>
<div id="perturbLoading" class="loading-indicator">Analyzing perturbation effects, please wait...</div>
<div id="perturbError" class="error-message"></div>
<div id="plotContainer"></div>
<div id="perturbResults"></div>
<div id="pathVisualizationContainer" style="margin-top: 30px; display: none;">
<h4>Path Visualization</h4>
<div id="pathPlot"></div>
</div>
<div class="popup-overlay" id="loadingPopup">
<div class="popup-content">
<div class="loader"></div>
<p>Querying subgraph...</p>
</div>
</div>
</div>
<!-- Perturbation Mechanism Tab -->
<div id="tab4" class="tab-content">
<p class="home-description">
Investigate the relationship among genes. Input a key gene of interests and some downstream gene of interests to visualize
and understand the molecular pathways through which the key gene influences downstream genes.
<br><br>
- Manuscript reference: "ICKGs predict shift in transcriptomic profiles following experimental manipulations"
</p>
<div class="input-section">
<div class="form-group">
<label for="mechanismGenes">Enter genes of interest (one per line):</label>
<textarea id="mechanismGenes" placeholder="Example:
NMMHCIIA
PLCG2
IGA
..."></textarea>
</div>
<div class="form-group">
<label for="mechanismPerturbGene">Perturbation Gene:</label>
<input type="text" id="mechanismPerturbGene" placeholder="e.g., BLIMP1">
</div>
<div class="form-group">
<label for="mechanismCellType">Cell Type:</label>
<select id="mechanismCellType" required>
<option value="NK">NK Cell</option>
<option value="T">T Cell</option>
<option value="B">B Cell</option>
<option value="M">Macrophage</option>
</select>
</div>
<button onclick="analyzeMechanism()">Analyze Mechanism</button>
</div>
<div id="mechanismLoading" class="loading-indicator">Analyzing mechanism, please wait...</div>
<div id="mechanismError" class="error-message"></div>
<div id="mechanismPlot"></div>
</div>
<div id="tab5" class="tab-content">
<div class="faq-section">
<h2 class="text-2xl font-bold mb-6">Frequently Asked Questions</h2>
<div class="faq-container">
<div class="faq-item mb-4">
<div class="faq-question" onclick="toggleFAQ(this)">
What is the Immune Cell Knowledge Graph?
<span class="faq-arrow">▼</span>
</div>
<div class="faq-answer">
The Immune Cell Knowledge Graph is an interactive tool that helps researchers explore and understand relationships between genes, pathways, and cell types in the immune system. It integrates data from published literature to provide insights into immune cell behavior and function.
</div>
</div>
<div class="faq-item mb-4">
<div class="faq-question" onclick="toggleFAQ(this)">
Which cell types are currently supported?
<span class="faq-arrow">▼</span>
</div>
<div class="faq-answer">
The tool currently supports four major immune cell types:
- NK Cells (Natural Killer Cells)
- T Cells
- B Cells
- Macrophages
</div>
</div>
<div class="faq-item mb-4">
<div class="faq-question" onclick="toggleFAQ(this)">
How do I use the Gene Set Annotation feature?
<span class="faq-arrow">▼</span>
</div>
<div class="faq-answer">
To use the Gene Set Annotation feature:
1. Enter your genes of interest (one per line) in the text area
2. Select the relevant cell type from the dropdown menu
3. Click "Analyze" to see pathway relationships and statistical significance
The tool will return pathway associations supported by published literature.
</div>
</div>
<div class="faq-item mb-4">
<div class="faq-question" onclick="toggleFAQ(this)">
What is Forward Genetics analysis?
<span class="faq-arrow">▼</span>
</div>
<div class="faq-answer">
Forward Genetics analysis helps you identify genes associated with a specific phenotype. Enter a phenotype of interest (e.g., "antigen-induced exhaustion") and select a cell type to discover the top genes that contribute to that biological process, along with supporting evidence from literature.
</div>
</div>
<div class="faq-item mb-4">
<div class="faq-question" onclick="toggleFAQ(this)">
How does the Reverse Genetics analysis work?
<span class="faq-arrow">▼</span>
</div>
<div class="faq-answer">
Reverse Genetics analysis predicts the effects of perturbing (modifying) a specific gene. Enter a gene of interest and cell type to see:
- Top 10 activated or inhibited genes
- Affected phenotypes
- Interactive visualizations of the relationships
Results are based on statistical analysis of the knowledge graph and literature evidence.
</div>
</div>
<div class="faq-item mb-4">
<div class="faq-question" onclick="toggleFAQ(this)">
How can I interpret the visualization results?
<span class="faq-arrow">▼</span>
</div>
<div class="faq-answer">
The visualizations show relationships between genes, phenotypes, and pathways:
- Green indicates activation/positive relationships
- Red indicates inhibition/negative relationships
- Line thickness represents the strength of evidence
- Hover over elements to see additional details
- Click on relationships to see supporting literature evidence
</div>
</div>
</div>
</div>
</div>
</div>
<script>
let debounceTimeout;
document.getElementById('phenotype').addEventListener('input', function(e) {
clearTimeout(debounceTimeout);
const query = e.target.value.trim();
debounceTimeout = setTimeout(async () => {
if (query.length < 2) {
document.getElementById('suggestions').style.display = 'none';
return;
}
try {
const response = await fetch(`https://chloehe1129.pythonanywhere.com/search-nodes?query=${encodeURIComponent(query)}`);
const data = await response.json();
const suggestionsList = document.getElementById('suggestions');
if (data.matches.length > 0) {
let suggestionsHTML = '';
if (!data.has_exact_match) {
suggestionsHTML += `
<li class="no-match-header">
No exact match found in the graph, are you interested in the following terms?
</li>`;
}
suggestionsHTML += data.matches.map(s =>
`<li data-value="${s.value}">${s.value}</li>`
).join('');
suggestionsList.innerHTML = suggestionsHTML;
suggestionsList.style.display = 'block';
} else {
suggestionsList.style.display = 'none';
}
} catch (error) {
console.error('Error fetching suggestions:', error);
}
}, 300);
});
document.getElementById('suggestions').addEventListener('click', function(e) {
if (e.target.tagName === 'LI') {
document.getElementById('phenotype').value = e.target.dataset.value;
this.style.display = 'none';
}
});
// Hide suggestions when clicking outside
document.addEventListener('click', function(e) {
if (!e.target.closest('.autocomplete-wrapper')) {
document.getElementById('suggestions').style.display = 'none';
}
});
function switchTab(tabId) {
// Hide all tab contents
document.querySelectorAll('.tab-content').forEach(tab => {
tab.classList.remove('active');
});
// Remove active class from all tab buttons
document.querySelectorAll('.tab-button').forEach(button => {
button.classList.remove('active');
});
// Show the selected tab content
document.getElementById(tabId).classList.add('active');
// Add active class to the clicked button
event.currentTarget.classList.add('active');
}
async function analyzeGenes() {
const geneInput = document.getElementById('geneInput').value;
const cellType = document.getElementById('cellType').value;
const genes = geneInput.split('\n').map(gene => gene.trim()).filter(gene => gene);
if (genes.length === 0) {
alert('Please enter at least one gene');
return;
}
const loading = document.getElementById('geneSetLoading');
const results = document.getElementById('geneSetResults');
const progressContainer = document.getElementById('progressContainer');
const progressBar = document.getElementById('progressBar');
const progressText = document.getElementById('progressText');
// Reset and show progress elements
loading.style.display = 'block';
progressContainer.style.display = 'block';
results.innerHTML = '';
progressBar.style.width = '0%';
// Update progress steps
updateProgressStep('validation');
try {
// Simulate validation progress
await updateProgress(20, 'Validating input genes...');
// Update to processing step
updateProgressStep('processing');
await updateProgress(40, 'Processing gene relationships...');
console.log('Analyzing genes...');
const response = await fetch('https://chloehe1129.pythonanywhere.com/analyze', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
genes: genes,
cellType: cellType
})
});
// Update to analysis step
updateProgressStep('analysis');
await updateProgress(70, 'Analyzing pathway connections...');
const data = await response.json();
// Update to completion step
updateProgressStep('completion');
await updateProgress(100, 'Analysis complete!');
if (data.error) {
results.innerHTML = `<div class="error-message">Error: ${data.error}</div>`;
} else {
const table = `
<table>
<thead>
<tr>
<th>Pathway</th>
<th>Score</th>
<th>P-value</th>
<th>95% CI</th>
</tr>
</thead>
<tbody>
${data.results.map(result => `
<tr>
<td>${result.pathway}</td>
<td>${result.score.toFixed(6)}</td>
<td>${result.p_value.toFixed(4)}</td>
<td>[${result.ci_lower.toFixed(6)}, ${result.ci_upper.toFixed(6)}]</td>
</tr>
`).join('')}
</tbody>
</table>
`;
results.innerHTML = table;
}
} catch (error) {
results.innerHTML = `<div class="error-message">Error: Failed to connect to the server</div>`;
console.error('Analysis error:', error);
} finally {
// Hide loading indicator after a brief delay
setTimeout(() => {
loading.style.display = 'none';
progressContainer.style.display = 'none';
}, 1000);
}
}
function updateProgressStep(step) {