-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathui.R
5798 lines (5456 loc) · 455 KB
/
ui.R
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
library(shiny)
library(plotly)
library(shinythemes)
library(shinydashboard)
library(shinyalert)
library(shinyjs)
library(shinyBS)
library(CellChat)
library(stringr)
library(fontawesome)
#library(hdf5r)
library(shinycssloaders)
library(Seurat)
library(pbmcapply)
library(devtools)
library(harmony)
library(reticulate)
library(sceasy)
library(pheatmap)
library(heatmaply)
library(liana)
library(rGREAT)
library(anndata)
library(clustree)
library(magrittr)
library(rhandsontable)
library(dplyr)
library(EnhancedVolcano)
library(ggplot2)
library(lisi)
library(cowplot)
library(FastIntegration)
library(Signac)
library(cluster)
library(GenomeInfoDb)
library(EnsDb.Hsapiens.v86)
library(BSgenome.Hsapiens.UCSC.hg19)
library(data.table)
library(purrr)
library(dplyr)
library(DT)
library(msigdbr)
library(fgsea)
library(MOFA2)
library(stats)
library(ktplots)
library(ggplot2)
library(SeuratWrappers)
library(shinyWidgets)
#library(car)
#library(nortest)
library(shinyFiles)
library(bslib)
#library(torch)
tags$style(type="text/css",
".shiny-output-error { visibility: hidden; }",
".shiny-output-error:before { visibility: hidden; }"
)
shinyUI(fluidPage(theme = shinytheme("cerulean"),
tagList(tags$head(tags$style(type = 'text/css','.navbar-brand{display:none;}')),
navbarPage("",
tabPanel(icon("home"),
titlePanel(h1(p(strong("ezSinglecell : An integrated one-stop single-cell and spatial analysis toolbox for bench scientists")), align = "center")),
fluidRow(
column(
br(),
p(strong("ezSingleCell"), "is an integrated one-stop single-cell and spatial analysis toolbox developed by Chen Jinmiao's lab with an intention to empower bench scientists to perform downstream Bioinformatics analysis. In the current version, we incorporate 5 modules : Single cell RNA-seq, Single cell Data Integration, Single cell Multiomics, Single Cell ATAC-seq and Spatial Transcriptomics.", style="text-align:justify;color:black;font-size:15px"),
column(6,
imageOutput("demo_image"),
),
column(6,
imageOutput("demo_image1"),
),
br(),
br(),
p("In this web server, we combine in-house novel algorithms such as CELLiD (for cell type identification), along with existing top performing methods for both basic and advanced downstream analyses such as batch effect removal, trajectory, cell-cell communication, differential abundance, and spatial deconvolution.", style="text-align:justify;color:black;font-size:15px"),
p("Currently ezSingleCell supports inputs in different formats such as text, csv or 10X cell ranger output. ezSingleCell is also available as a software package with a" , a("ShinyApp interface", href = "https://github.com/JinmiaoChenLab/ezSingleCell2", target = "_blank"), ",that can be run on a computer with basic memory requirements", style="text-align:justify;color:black;font-size:15px"),
p("The toolkit uses example data from", a("DISCO", href = "https://www.immunesinglecell.org/", target="_blank"),"that contains data from 13998 samples, covering 461 tissues/cell lines/organoids, 158 diseases, and 20 platforms.", style="text-align:justify;color:black;font-size:15px"), width=12)),
# p(em("Developed by"),br("CJM Lab"),style="text-align:center; font-family: times")
wellPanel(
HTML(
'<p align="center" width="4">Singapore Immunology Network, Agency for Science, Technology and Research (A*STAR)</p>
<p align="center" width="4">Github: <a href="https://github.com/JinmiaoChenLab/">https://github.com/JinmiaoChenLab/</a></p>
<p align="center" width="4">Created by <a href="https://www.a-star.edu.sg/sign/people/principal-investigators/jinmiao-chen">Jinmiao Chen Lab</a> and collaborated with <a href="https://www.vishuo.com/en/"> Vishuo Biomedical Pte. Ltd.</a></p>'
)),
),
tabPanel("Single cell RNA-Sequencing",
navlistPanel(widths=c(2,10),
tabPanel("Overview",
h2(p("Workflow for scRNA-Seq module")),
br(),
column(12,
imageOutput("scrna_image1"),
),
#column(6,
#imageOutput("scrna_image2")
#),
),
tabPanel("Upload your data",
column(9,
column(5,
#h4('Load Data:'),
wellPanel(
conditionalPanel(
condition = "input.scInput == 'Raw Counts Matrix'",
titlePanel(h4(p("Load your example data"))),
actionBttn("loadexample_tpm", "Load example and run", icon = icon("hand-o-right"), size = 'sm', onclick = "$(tab).removeClass('disabled')"),
#bsPopover("loadexample_tpm", "Load Example Data","Press to load example data (Raw counts matrix)", placement = "bottom", trigger = "hover", options = NULL)
),
conditionalPanel(
condition = "input.scInput == '10X cellranger'",
titlePanel(h4(p("Load your example data"))),
actionBttn("loadexample_scH5", "Load example and run", icon = icon("hand-o-right"), size = 'sm', onclick = "$(tab).removeClass('disabled')"),
#bsPopover("loadexample_scH5", "Load Example Data","Press to load example data (cellRanger output)", placement = "bottom", trigger = "hover", options = NULL)
),
conditionalPanel(
condition = "input.scInput == 'rds object'",
titlePanel(h4(p("Load your example data"))),
actionBttn("loadexample_rds", "Load example and run", icon = icon("hand-o-right"), size = 'sm', onclick = "$(tab).removeClass('disabled')"),
#bsPopover("loadexample_rds", "Load Example Data","Press to load example data (rds object)", placement = "bottom", trigger = "hover", options = NULL)
),
conditionalPanel(
condition = "input.scInput == 'h5ad'",
titlePanel(h4(p("Load your example data"))),
actionBttn("loadexample_h5ad", "Load example and run", icon = icon("hand-o-right"), size = 'sm', onclick = "$(tab).removeClass('disabled')"),
#bsPopover("loadexample_h5ad", "Load Example Data","Press to load example data (h5ad object)", placement = "bottom", trigger = "hover", options = NULL)
),
titlePanel(h4(HTML("<b>Load your input data</b>"))),
br(),
selectInput("scInput",
label = "Select Data Input Type",
choices = c("Raw Counts Matrix", "10X cellranger", "rds object", "h5ad"),
selected = "Raw Counts Matrix"),
#bsPopover("scInput", "Select Input Format","Users can select input format", placement = "bottom", trigger = "hover", options = NULL),
conditionalPanel(
condition = "input.scInput == 'Raw Counts Matrix'",
fileInput("tpmFiles",
label = "Counts File (Accepted Format: text)",
accept = ".txt"),
),
conditionalPanel(
condition = "input.scInput == '10X cellranger'",
fileInput("scH5",
label = "Cellranger output (Accepted Format: .h5)",
accept = ".h5"),
),
conditionalPanel(
condition = "input.scInput == 'rds object'",
fileInput("rds",
label = "Seurat Object (Accepted Format: .rds)",
accept = ".rds"),
),
conditionalPanel(
condition = "input.scInput == 'h5ad'",
fileInput("h5ad",
label = "AnnData Object (Accepted Format: .h5ad)",
accept = ".h5ad"),
),
#column(6,
# numericInput(inputId = "min.genes",
# label = "Min. genes",
# value = 200,
# min = 1)
# ),
#column(6,
# numericInput(inputId = "min.cells",
# label = "Min. cells",
# value = 3,
# min = 1)
# ),
textInput(inputId = "projName",
label = "Project Name",
value = "scRNA"),
fluidRow(
actionBttn("loadButton", "Load data", icon = icon("hand-o-right"), size = 'sm', onclick = "$(tab).removeClass('disabled')"),
#bsPopover("loadButton", "Load Data","Press to load your data", placement = "bottom", trigger = "hover", options = NULL),
actionBttn("reset_scRNA", "Reset", icon = icon("repeat"), size = 'sm'),
#bsPopover("reset_scRNA", "Reload Data","Press to reanalyze your data", placement = "bottom", trigger = "hover", options = NULL)
),
)),
chooseSliderSkin("Modern"),
titlePanel(h4(p("Quality control"))),
column(6,
plotOutput("nFeature_RNAPlot", width = "200%")
),
column(4,
br(),
downloadBttn('download_nFeature_RNA', 'Download (as png)', size = 'sm')
),
column(12,
column(3,
numericInput("ob1",
label = "Min nFeature:",
value = 200,
min = 0,
step = 1),
),
column(3,
numericInput("ob2",
label = "Max nFeature:",
value = 2500,
min = 0,
step = 1),
),
column(3,
numericInput("ob3",
label = "Mt%:",
value = 5,
min = 0,
step = 1),
),
column(3,
br(),
actionBttn("filter_seurat", "Filter", icon = icon("hand-o-right"), size = 'sm'),
#bsPopover("filter_seurat", "Filter Data","Press to filter data based on parameters", placement = "bottom", trigger = "hover", options = NULL),
),
),
),
column(12,
withSpinner(dataTableOutput('countdataDT')),
downloadBttn('downloadCount', 'Download Table'),
)),
#tabPanel("2. Quality control Plot",
# tabsetPanel(id="qc_scRNA",
# tabPanel("Violin Plot",
# column(3,
# plotOutput("nFeature_RNAPlot")
# ),
# column(3,
# plotOutput("mitoPlot")
# ),
# column(3,
# plotOutput("nCount_RNAPlot")
# ),
# column(12,
# column(3,
# downloadBttn('download_nFeature_RNA', 'Download nFeature (as png)', size = 'sm'),
# ),
# column(3,
# downloadBttn('download_mito', 'Download mito (as png)', size = 'sm'),
# ),
# column(3,
# downloadBttn('download_nCount_RNA', 'Download nCount (as png)', size = 'sm'),
# ),
# )
# ),
# tabPanel("Feature Scatter Plot",
# column(5,
# plotlyOutput("FeatureScatterPlot1")
# ),
# column(5,
# plotlyOutput("FeatureScatterPlot2")
# ),
# br(),
# br(),
# column(12,
# column(5,
# downloadBttn('download_FeatureScatterPlot1', 'Download (as png)', size = 'sm'),
# ),
# column(5,
# downloadBttn('download_FeatureScatterPlot2', 'Download (as png)', size = 'sm'),
# ),
# ),
# )
# ),
# ),
tabPanel("Normalization and Variable Feature Selection", value = "test",
tags$script(
'
var tab = $(\'a[data-value="test"]\').parent().addClass("disabled");
$(function(){
$(tab.parent()).on("click", "li.disabled", function(e) {
e.preventDefault();
return false;
});
});
'
),
selectInput("norm1",
label = "Normalization method",
choices = c("LogNormalize", "SCTransform"),
selected = "SCTransform"
),
textOutput("nVarGenes"),
fluidRow(
column(3,
numericInput("var.genes",
label = "Number of variable genes",
value = 2000,
min = 500,
step = 500)
),
column(3,
selectInput("selection.method",
label = "Selection method",
choices = c("vst", "dispersion"))
),
column(4,
br(),
actionBttn("findVarGenes", "Identify highly variable genes", icon = icon("hand-pointer-o"), size = 'sm', onclick = "$(tab1).removeClass('disabled')"),
#bsPopover("findVarGenes", "Feature Selection","Press to identify highly variable features", placement = "bottom", trigger = "hover", options = NULL),
#actionButton("doSCTransform", "Run SCTransform", icon = icon("hand-pointer-o"))
# actionButton("doVarplot", "Plot variable genes", icon = icon("hand-pointer-o"))
)),
plotOutput("VarGenes", width = "100%"),
),
tabPanel( "PCA", value = "test1",
tags$script(
'
var tab1 = $(\'a[data-value="test1"]\').parent().addClass("disabled");
$(function(){
$(tab.parent()).on("click", "li.disabled", function(e) {
e.preventDefault();
return false;
});
});
'
),
tabsetPanel(id="Pca",
tabPanel(title="PCA Plot", value="P_panel1",
br(),
#column(3,
#selectInput("assays1",
# label = "Normalization method:",
# choices = c("LogNormalization", "SCTransform"),
# selected = "SCTransform"
# ),
# ),
br(),
column(3,
actionBttn("doPCA", "Run PCA", icon = icon("hand-pointer-o"), size = 'sm', onclick = "$(tab2).removeClass('disabled')"),
#bsPopover("doPCA", "Run PCA","Press to run PCA Analysis", placement = "bottom", trigger = "hover", options = NULL),
),
br(),
br(),
column(6,
plotlyOutput("PCA2DPlot", width = "100%")
),
column(12,
column(3,
br(),
downloadBttn('download_PCA', 'Download PCA Plot (as png)', size = 'sm'),
),
column(3,
br(),
downloadBttn('download_PCA_embedding', 'Download PCA Embedding (as csv)', size = 'sm'),
),
),
),
tabPanel(title="PC Gene Visualisation", value="P_panel2",
br(),
selectInput("select.pc",
label = "PC to plot",
choices = c(1:50)
),
fluidRow(
column(4,
plotOutput("vizPlot", width = "100%", height = "600px")
),
column(8,
plotOutput("PCHeatmap", width = "100%", height = "600px")
),
column(12,
column(3,
br(),
downloadBttn('download_vizPlot', 'Download vizPlot (as png)', size = 'sm'),
),
column(3,
br(),
downloadBttn('download_PCHeatmap', 'Download PCHeatmap (as png)', size = 'sm'),
),
#br(),
DT::dataTableOutput("PCtable"),
column(3,
downloadBttn('download_PCTable', 'Download top genes (as csv)', size = 'sm'),
),
),
),
),
tabPanel(title="Elbow", value="P_panel4",
br(),
#actionButton("doElbow", label = "Get Elbow Plot"),
#br(),
br(),
plotOutput("Elbow", width = "100%"),
column(12,
column(3,
downloadBttn('download_Elbow', 'Download ElbowPlot (as png)', size = 'sm'),
),
),
)
)),
tabPanel( "UMAP", value = "test2",
tags$script(
'
var tab2 = $(\'a[data-value="test2"]\').parent().addClass("disabled");
$(function(){
$(tab.parent()).on("click", "li.disabled", function(e) {
e.preventDefault();
return false;
});
});
'
),
#titlePanel(h4(p("UMAP Analysis"))),
br(),
fluidRow(
column(3,
numericInput("dim.used",
label = "Dimensions used",
value = 10)
),
br(),
column(3,
actionBttn("doUmap", "Run UMAP", icon = icon("hand-pointer-o"), size = 'sm', onclick = "$(tab3).removeClass('disabled')"),
#bsPopover("doUmap", "Run UMAP","Press to run UMAP Analysis", placement = "bottom", trigger = "hover", options = NULL),
textOutput("Umap.done"),
br()
)),
br(),
plotlyOutput("Umap_2d_plot_1", width = "50%"),
br(),
column(12,
column(3,
downloadBttn('download_UMAP', 'Download UMAP Plot (as png)', size = 'sm'),
),
column(3,
downloadBttn('download_UMAP_embedding', 'Download UMAP Embeddings (as csv)', size = 'sm'),
),
),
),
tabPanel( "tSNE", value = "test2",
tags$script(
'
var tab2 = $(\'a[data-value="test2"]\').parent().addClass("disabled");
$(function(){
$(tab.parent()).on("click", "li.disabled", function(e) {
e.preventDefault();
return false;
});
});
'
),
fluidRow(
column(3,
numericInput("dim.used",
label = "Dimensions used",
value = 10)
),
column(3,
uiOutput("perplex.option")
),
column(3,
br(),
actionBttn("doTsne", "Run TSNE", icon = icon("hand-pointer-o"), size = 'sm', onclick = "$(tab3).removeClass('disabled')"),
#bsPopover("doTsne", "Run tSNE Analysis","Press to run tSNE Analysis", placement = "bottom", trigger = "hover", options = NULL),
textOutput("Tsne.done"),
br()
)),
br(),
plotlyOutput("Tsne_2d_plot_1", width = "50%"),
br(),
column(12,
column(3,
downloadBttn('download_Tsne', 'Download tSNE Plot (as png)', size = 'sm'),
),
column(3,
downloadBttn('download_Tsne_embedding', 'Download tSNE Embeddings (as csv)', size = 'sm'),
),
),
),
tabPanel("Clustering", value = "test2",
tags$script(
'
var tab2 = $(\'a[data-value="test2"]\').parent().addClass("disabled");
$(function(){
$(tab.parent()).on("click", "li.disabled", function(e) {
e.preventDefault();
return false;
});
});
'
),
tabsetPanel(id="cluster",
tabPanel(title="Clustering", value="C_panel1",
br(),
fluidRow(
column(12,
column(2,
numericInput("clus.res",
label = "Resolution used",
value = 0.6,
min = 0.1,
step = 0.1)
),
column(2,
selectInput("dim.used",
label = "PC to use",
choices = c(10:50)),
),
column(2,
br(),
actionBttn("findCluster", "Find Clusters", icon = icon("hand-pointer-o"), size = 'sm', onclick = "$(tab3).removeClass('disabled')"),
#bsPopover("findCluster", "Run Clustering","Press to run Cluster Analysis", placement = "bottom", trigger = "hover", options = NULL),
textOutput("cluster.done"),
br()
),
),
column(6,
plotlyOutput("Cluster2DPlot_1", width = "100%"),
br(),
),
),
column(6,
column(6,
downloadBttn('download_Cluster', 'Download ClusterPlot (as png)', size = 'sm'),
),
column(6,
downloadBttn('download_ClusterTable', 'Download Cluster table (as csv)', size = 'sm'),
),
),
),
tabPanel(title="Determine cluster resolution", value="C_panel2",
br(),
column(9,
h4(p("Determine cluster resolution:")),
column(4,
numericInput("clus.res_a",
label = "Resolution (from)",
value = 0.6,
min = 0.1,
step = 0.1)
),
column(4,
numericInput("clus.res_b",
label = "Resolution (to)",
value = 1,
min = 0.1,
step = 0.1)
),
column(4,
br(),
actionBttn("findoptimumCluster", "Determine optimum resolution", icon = icon("hand-pointer-o"), size = 'sm'),
#bsPopover("findoptimumCluster", "Determine optimum resolution","Press to determine optimum cluster resolution", placement = "bottom", trigger = "hover", options = NULL),
),
br(),
column(12,
br(),
br(),
br(),
br(),
plotOutput("OptimumCluster2DPlot_1", width = "100%"),
br(),
),
column(12,
column(6,
downloadBttn('download_OptimumCluster', 'Download ClusterPlot (as png)', size = 'sm'),
),
column(6,
downloadBttn('download_OptimumClusterTable', 'Download Cluster table (as csv)', size = 'sm'),
),
),
),
),
tabPanel(title="Subcluster Analysis", value="C_panel3",
column(12,
titlePanel(h4(p("Subcluster Analysis"))),
),
column(3,
br(),
uiOutput("subcluster.gene.select"),
),
column(3,
br(),
numericInput("subcluster.res",
label = "Resolution used",
value = 0.6,
min = 0.1,
step = 0.1),
#bsTooltip("subcluster", "Perform Subcluster Analysis", placement = "bottom", trigger = "hover",
#options = NULL)
),
column(3,
br(),
br(),
actionBttn("subcluster", "Run Subcluster analysis", icon = icon("hand-pointer-o"), size = 'sm'),
#bsPopover("subcluster", "Subcluster Analysis","Press to perform Subcluster Analysis for a specific cluster at any given resolution", placement = "bottom", trigger = "hover", options = NULL),
textOutput("Subcluster.done"),
br()
),
br(),
br(),
br(),
column(9,
plotlyOutput("subcluster_plot")
),
column(12,
column(4,
downloadBttn('download_subcluster', 'Download Subcluster plot (as png)', size = 'sm'),
br(),
),
),
),
),
),
tabPanel("Cell type Identification", value = "test3",
tags$script(
'
var tab3 = $(\'a[data-value="test3"]\').parent().addClass("disabled");
$(function(){
$(tab.parent()).on("click", "li.disabled", function(e) {
e.preventDefault();
return false;
});
});
'
),
fluidRow(
column(3,
selectInput("cellid_method",
label = "Celltype annotation method",
choices = c("CELLiD", "Celltypist"),
selected = "CELLiD"),
),
),
tabsetPanel(id="ct1",
tabPanel(title="Celltype Identification", value="Ct_panel1",
conditionalPanel(
condition = "input.cellid_method == 'CELLiD'",
column(3,
selectInput("cellatlas",
label = "Reference Atlas",
choices = c("all", "adipose", "adrenal_gland", "blood", "bone_marrow", "brain", "breast", "breast_milk", "eye", "gut", "heart", "kidney", "liver", "lung", "pancreas", "PDAC", "skin", "testis", "thymus", "tonsil"),
selected = "all")
),
column(3,
br(),
actionBttn("doCELLiD", "Run CELLiD", icon = icon("hand-pointer-o"), size = 'sm', onclick = "$(tab4).removeClass('disabled')"),
#bsPopover("doCELLiD", "Perform Celltype Identification","Press to run celltype identification using CELLiD", placement = "bottom", trigger = "hover", options = NULL),
textOutput("CELLiD.done"),
br()
),
br(),
br(),
br(),
column(12,
column(6,
plotlyOutput("Umap_cellid", width = "100%"),
),
column(6,
plotlyOutput("Umap_cellid1", width = "100%"),
),
),
DT::dataTableOutput("ct.table"),
column(12,
column(4,
downloadBttn('download_Umap_cellid', 'Download CELLiD predict1 (as png)', size = 'sm'),
br(),
),
column(4,
downloadBttn('download_Umap_cellid1', 'Download CELLiD predict2 (as png)', size = 'sm'),
br(),
),
column(4,
downloadBttn('download_cellid_prediction', 'Download CELLiD predictions (in csv)', size = 'sm'),
br(),
),
),
tags$head(tags$script('
Shiny.addCustomMessageHandler("myCallbackHandler3",
function(typeMessage) {console.log(typeMessage)
if(typeMessage == 2){
console.log("got here");
$("a:contains(Spatial Transcriptomics)").click();
}
});
')),
column(3,
br(),
actionBttn("dodeconv_spatial", "Go to Spatial Deconvolution", icon = icon("hand-pointer-o"), size = 'sm'),
#bsPopover("dodeconv_spatial", "Perform Celltype Deconvolution","Press to navigate to Spatial module and perform celltype deconvolution", placement = "bottom", trigger = "hover", options = NULL),
),
tags$head(tags$script('
Shiny.addCustomMessageHandler("myCallbackHandler5",
function(typeMessage) {console.log(typeMessage)
if(typeMessage == 2){
console.log("got here");
$("a:contains(Single cell ATAC-seq)").click();
}
});
')),
column(3,
br(),
actionBttn("doct_atac", "Annotate cell types for ATAC-data", icon = icon("hand-pointer-o"), size = 'sm'),
#bsPopover("doct_atac", "Perform Celltype Label Transfer","Press to navigate to scATAC-seq module and perform celltype label transfer", placement = "bottom", trigger = "hover", options = NULL),
),
),
conditionalPanel(
condition = "input.cellid_method == 'Celltypist'",
column(3,
selectInput("celltypistatlas",
label = "Reference Atlas",
choices = c("Immune_All_Low.pkl", "Autopsy_COVID19_Lung.pkl", "Pan_Fetal_Human.pkl", "Nuclei_Lung_Airway.pkl", "Developing_Human_Thymus.pkl", "Human_Lung_Atlas.pkl", "Developing_Mouse_Brain.pkl", "Developing_Human_Brain.pkl", "Cells_Lung_Airway.pkl", "Healthy_COVID19_PBMC.pkl", "Human_IPF_Lung.pkl", "Adult_Mouse_Gut.pkl", "Immune_All_High.pkl", "COVID19_Immune_Landscape.pkl", "Human_PF_Lung.pkl", "COVID19_HumanChallenge_Blood.pkl", "Lethal_COVID19_Lung.pkl", "Cells_Fetal_Lung.pkl", "Cells_Intestinal_Tract.pkl"),
selected = "Immune_All_Low.pkl")
),
column(3,
br(),
actionBttn("doCelltypist", "Run Celltypist", icon = icon("hand-pointer-o"), size = 'sm', onclick = "$(tab4).removeClass('disabled')"),
#bsPopover("doCelltypist", "Perform Celltype Identification","Press to Press to run celltype identification using CellTypist", placement = "bottom", trigger = "hover", options = NULL),
textOutput("Celltypist.done"),
br()
),
br(),
br(),
br(),
column(12,
column(6,
plotlyOutput("Umap_celltypist", width = "100%"),
),
column(6,
plotlyOutput("Umap_celltypist1", width = "100%"),
),
),
DT::dataTableOutput("celltypist.table"),
#DT::dataTableOutput(outputId = "recoding"),
#DT::dataTableOutput(outputId = "newVars")
tags$head(tags$script('
Shiny.addCustomMessageHandler("myCallbackHandler3a",
function(typeMessage) {console.log(typeMessage)
if(typeMessage == 2){
console.log("got here");
$("a:contains(Spatial Transcriptomics)").click();
}
});
')),
column(3,
br(),
actionBttn("dodeconv_spatial1", "Go to Spatial Deconvolution", icon = icon("hand-pointer-o"), size = 'sm'),
#bsPopover("dodeconv_spatial1", "Perform Celltype Deconvolution","Press to navigate to Spatial module and perform celltype deconvolution", placement = "bottom", trigger = "hover", options = NULL),
),
tags$head(tags$script('
Shiny.addCustomMessageHandler("myCallbackHandler5a",
function(typeMessage) {console.log(typeMessage)
if(typeMessage == 2){
console.log("got here");
$("a:contains(Single cell ATAC-seq)").click();
}
});
')),
column(3,
br(),
actionBttn("doct_atac1", "Annotate cell types for ATAC-data", icon = icon("hand-pointer-o"), size = 'sm'),
#bsPopover("doct_atac1", "Perform Celltype Label Transfer","Press to navigate to scATAC-seq module and perform celltype label transfer", placement = "bottom", trigger = "hover", options = NULL),
),
),
),
tabPanel(title="Rename Clusters", value="Ct_panel2",
conditionalPanel(
condition = "input.cellid_method == 'CELLiD'",
column(12,
column(6,
br(),
h4(p("Please modify your celltypes below:")),
br(),
actionBttn("commitButton", "Rename clusters (if needed)", size = "sm"),
#bsPopover("commitButton", "Rename clusters","Press to rename clusters", placement = "bottom", trigger = "hover", options = NULL),
br(),
br(),
rHandsontableOutput("hot"),
),
column(6,
h4(p("UMAP with renamed celltypes")),
plotlyOutput("Umap_cellid2", width = "100%"),
br(),
),
),
),
conditionalPanel(
condition = "input.cellid_method == 'Celltypist'",
br(),
h3(p("Not supported yet"))
# column(12,
# column(6,
# br(),
# h4(p("Please modify your celltypes below:")),
# br(),
# #actionBttn("commitButton1", "Rename clusters", size = "sm"),
# br(),
# br(),
#rHandsontableOutput("cot"),
# ),
# column(6,
# h4(p("UMAP with renamed celltypes")),
# plotOutput("Umap_celltypist2", width = "100%"),
# br(),
# ),
#),
# ),
),
),
tabPanel(title="Visualize", value="Ct_panel3",
conditionalPanel(
condition = "input.cellid_method == 'CELLiD'",
column(12,
column(6,
br(),
uiOutput("ct.gene.select"),
actionBttn("Vis_seurat1", "Visualize", icon = icon("hand-pointer-o"), size = 'sm'),
plotlyOutput("ct.gene1.plot", width = "100%"),
br(),
),
column(6,
br(),
br(),
plotlyOutput("ct.gene.plot", width = "150%"),
br(),
),
),
column(12,
column(4,
downloadBttn('download_violn1', 'Download Violin plot (as png)', size = 'sm'),
br(),
),
column(4,
downloadBttn('download_feature1', 'Download Feature plot (as png)', size = 'sm'),
br(),
),
),
),
conditionalPanel(
condition = "input.cellid_method == 'Celltypist'",
column(6,
br(),
uiOutput("celltypist.gene.select"),
plotlyOutput("celltypist.gene1.plot", width = "100%"),
br(),
),
column(6,
plotlyOutput("celltypist.gene.plot", width = "150%"),
br(),
),
),
),
),
),
tabPanel("Cell type Similarity", value = "test4",
tags$script(
'
var tab4 = $(\'a[data-value="test4"]\').parent().addClass("disabled");
$(function(){
$(tab.parent()).on("click", "li.disabled", function(e) {
e.preventDefault();
return false;
});
});
'
),
column(3,
br(),
selectInput("cell1",
label = "Group by",
choices = c("seurat_clusters", "primary.predict", "newID"),
selected = "primary.predict"),
),
column(3,
br(),
selectInput("corr_method",
label = "Statistics",
choices = c("pearson", "spearman", "kendall"),
selected = "pearson"),
),
column(3,
br(),
br(),
actionBttn("cell_cell", "Run celltype similarity", icon = icon("hand-pointer-o"), size = 'sm', onclick = "$(tab5).removeClass('disabled')"),
#bsPopover("cell_cell", "Perform Celltype Similarity","Press to run Celltype Similarity Analysis", placement = "bottom", trigger = "hover", options = NULL),
textOutput("CELL.done"),
br()
),
br(),
br(),
br(),
column(9,
plotlyOutput("cell_cell_sim")
),
br(),
br(),
br(),
column(12,
column(4,
downloadBttn('download_cell_cell_sim', 'Download Celltype similarity plot (as png)', size = 'sm'),
),
column(4,
downloadBttn('download_cor.table', 'Download Celltype similarity table (in csv)', size = 'sm'),
),
),
br(),
br(),
br(),
br(),
br(),
DT::dataTableOutput("cor.table")
),
tabPanel("DEGs", value = "test5",
tags$script(
'
var tab5 = $(\'a[data-value="test5"]\').parent().addClass("disabled");
$(function(){
$(tab.parent()).on("click", "li.disabled", function(e) {
e.preventDefault();
return false;
});
});
'
),
fluidRow(
column(3,
selectInput("deg_method",
label = "Type of DEG analysis",
choices = c("Celltype specific", "Pairwise DEGs"),
selected = "Celltype specific"),
),
),
conditionalPanel(
condition = "input.deg_method == 'Celltype specific'",
fluidRow(
column(3,
selectInput("deg1",
label = "Group by",
choices = c("seurat_clusters", "primary.predict", "newID"),
selected = "primary.predict"),
),
column(3, numericInput("min_pct",
label = "min.pct",
value = 0.25,
min = 0,
step = 0.01)
),
column(3, numericInput("logfc",
label = "logfc.threshold",
value = 0.25,
min = 0,
step = 0.01)
),
column(3, selectInput("test.use",
label = "Test use",
choices = c("wilcox", "bimod", "roc", "t", "negbinom", "poisson", "LR", "MAST", "DESeq2"))
),
br(),
column(3,