-
Notifications
You must be signed in to change notification settings - Fork 9
/
ui.R
1834 lines (1569 loc) · 109 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
# Asc-Seurat
# Version 2.2.1
set.seed(1407)
suppressMessages( require("shiny") )
suppressMessages( require("shinyWidgets") )
suppressMessages( require("DT") )
suppressMessages( require("reactable") )
suppressMessages( require("rclipboard") )
suppressMessages( require("shinycssloaders") )
suppressMessages( require("shinyFeedback") )
if (dir.exists('/app/user_work')) {
source("/app/R/ui_functions.R")
source("/app/R/improved_dot_and_violin_plots.R")
} else {
source("R/ui_functions.R")
source("R/improved_dot_and_violin_plots.R")
}
function(request) {
## This set the app to properly work with docker
if (dir.exists('/app/user_work')) {
setwd('/app/user_work')
}
fluidPage(
shinyFeedback::useShinyFeedback(),
####################
#### Custom CSS ####
####################
tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "asc_seurat.css")
),
tags$head(
tags$style(HTML("
p {
font-size:16px;
}
.down-group {
border: 1px solid #ccc;
border-radius: 6px;
padding: 0px 5px;
margin: 5px -10px;
background-color: #eadaf7;
}
.shiny-output-error-validation {
color: #ff0000;
font-weight: bold;
}
"))),
rclipboardSetup(),
# Sets the background color of the application
setBackgroundColor(
color = c("#F7FBFF", "#d6c5e3"),
gradient = "radial",
direction = c("top", "left")),
########################
# Asc-Seurat interface #
########################
titlePanel(title = "Asc-Seurat - Analytical single-cell Seurat-based web application"),
br(),
tabsetPanel(
######################
## Introduction tab ##
######################
tabPanel("Introduction",
h2("Introduction to Asc-Seurat"),
br(),
p("Asc-Seurat, pronounced \"ask Seurat\", is based on the popular R package \"Seurat\", from the Satija Lab. It includes many, but not all, features of the Seurat package."),
p("It also takes advantage of \"Dynverse\", a collection of R packages that allows the execution of multiple trajectory inference models."),
p("Finally, Asc-Seurat uses BioMart, through the biomaRt R package, to promote the functional annotation of genes from many species."),
br(),
p(
"For more information, check Seurat's manual and vignettes",
a(tags$a(href="https://satijalab.org/seurat/", "here,", target="_blank")),
"and their publications",
a(tags$a(href="https://satijalab.org/publications/", "here.", target="_blank")),
"Also, check dynverse's documentation",
a(tags$a(href="https://dynverse.org/", "here", target="_blank")),
"and its publication",
a(tags$a(href="https://doi.org/10.1038/s41587-019-0071-9", "here;", target="_blank")),
"and BioMart's documentation",
a(tags$a(href="https://www.ensembl.org/biomart/martview/dc4f7144c82d3d4b4c1bd8f27ca07b6c", "here,", target="_blank")),
"and biomaRt's vignettes",
a(tags$a(href="https://bioconductor.org/packages/release/bioc/html/biomaRt.html", "here.", target="_blank"))
),
tags$hr(),
h2("Tutorial and documentation"),
br(),
p("A step-by-step introduction of Asc-Seurat's functionalities is available at ", a(tags$a(href="https://asc-seurat.readthedocs.io/en/latest/index.html", "https://asc-seurat.readthedocs.io.", target="_blank")), ". Asc-Seurat is published on ", a(tags$a(href="https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-021-04472-2", "BMC Bioinformatics.", target="_blank"))),
p("For questions or issues related to Asc-Seurat's functionalities, please visit", a(tags$a(href="https://github.com/KirstLab/asc_seurat", "our GitHub.", target="_blank"))),
br(),
p("Note that both Seurat and dynverse teams are also present on GitHub. For questions or issues related to Seurat's or dynverse's functionalities, please visit", a(tags$a(href="https://github.com/satijalab/seurat/issues", "Seurat's GitHub page", target="_blank")), "or", a(tags$a(href="https://github.com/dynverse/dyno/issues", "Dynverse's GitHub page.", target="_blank"))),
tags$hr(),
h2("Funding"),
br(),
p("Asc-Seurat was developed in the context of a project supported by the United States Department of Energy, Office of Science, Biological and Environmental Research program [DE-SC0018247]."),
br(),
tags$hr(),
h2("Acknowledgments"),
## Adds the images
a(
img(src = 'University_of_Florida.png',
width = "30%",
align = "center",
style='border-right: 40px solid transparent'),
img(src = 'Universidade_de_Brasilia.png',
width = "20%",
align = "center",
style='border-right: 40px solid transparent'),
),
tags$hr(),
p(strong("Asc-Seurat, version 2.2.1"), "- Released on February, 2022.", align = "center")
),
######################################
### One sample ###
######################################
tabPanel("One sample",
fluidRow(
br(),
p(strong("Note that at any time, users can save a bookmark (purple button at the right bottom) that will save your parameter choices. Using the saved bookmark, it is possible to re-load all selected parameters and re-execute the analysis, to reproduce the results.")),
br(),
p("Choose the sample to be analyzed and the initial requirements to load the data. Note that cells that do not match the parameters will not be load."),
p("These parameters are used to exclude low-quality cells and allow the data to load quickly. Users can add more restrictive parameters after visualizing the distributions in the next section."),
p("Alternatively, it is possible to load a previously clustered dataset, saving some time by not running the complete analysis."),
# p(strong("After selecting the parameters, click on the blue button to load the data.")),
br(),
column(width = 3,
div(class = "option-group",
radioButtons("sample_tab1_options",
"Run a new analysis or read a previously saved file?",
choices = list("Run a new analysis" = 0,
"Load file" = 1),
selected = c(0) )),
conditionalPanel (
condition = "input.sample_tab1_options == 0",
my_withSpinner(
uiOutput('select_sample_tab1'))
),
),
conditionalPanel (
condition = "input.sample_tab1_options == 1",
column(width = 3,
my_withSpinner( uiOutput("select_sample_tab1_rds_ui") ),
),
column( width = 3,
actionButtonInput("load_10X_rds",
HTML("Load clustered data"))
),
),
conditionalPanel (
condition = "input.sample_tab1_options == 0",
column(width = 2,
input_project_name("proj_name")
),
column(width = 2,
div(class = "option-group",
numericInput("min_cells",
label = "Min. number of cells expressing a gene for the gene to be included",
value = 3))
),
column(width = 2,
div(class = "option-group",
numericInput("min_features",
label = "Min. number of genes a cell must express to be included",
value = 200))
),
column( width = 3,
textInput_regex("mito_regex") ,
),
column( width = 3,
actionButtonInput("load_10X",
HTML("Load data of the selected sample"))
),
),
), # fluid row
# If data is already clustered, this options doesn't appear
conditionalPanel (
condition = "input.sample_tab1_options == 0",
conditionalPanel (
condition = "input.load_10X != 0",
fluidRow(
titlePanel("Genes targeted as mitochondrial"),
p("The genes below were targeted by the parameter \"common identifier of mitochondrial genes\", set above."),
column(12,
my_withSpinner( verbatimTextOutput("target_genes_mitho") )
)
), # Fluid row
),
fluidRow(
titlePanel("Screening plot to define filtering parameters"),
br(),
p("Use this plot to define more restrictive parameters and exclude cells based on their number of expressed genes and the percentage of reads that map to the mitochondrial genome."),
# p("The parameters can be set on the right side of the plot and must be set using a higher value than the ones above. Otherwise, they will have no effect since the cells were already excluded."),
#br(),
p("After setting the parameters, click on \"Show/update plot of filtered data\" to visualize the data after filtering."),
br(),
br(),
column(width = 10,
my_withSpinner( plotOutput("VlnPlot") )
),
column(width = 2,
div(class = "option-group",
numericInput("min_count",
label = "Keep only cells that expressed at least this number of genes",
value = 0),
numericInput("max_count",
label = "Exclude any cell that expressed more than this number of genes (i.e. possible doublets)",
value = 10000)),
numericInput_max_mito_perc("max_mito_perc", value = 100),
actionButtonInput("run_vinplot",
HTML("Show/update plot of filtered data"))
)
), # fluid row
conditionalPanel(
condition = "input.run_vinplot!= 0",
fluidRow (
titlePanel("Screening plot showing the remaining cells after filtering"),
column(width = 10,
my_withSpinner( plotOutput("VlnPlot_filt") )
),
# download plot
column(2,
numericInput_plot_height("p1_height"),
numericInput_plot_width("p1_width", value=25),
selectInput_plot_res("p1_res"),
selectInput_plot_format("p1_format"),
downloadButton("p1_down", HTML("Download Plot") )
)
), # fluid row
), # Ends conditional
fluidRow(
titlePanel("Normalization and dimension reduction analysis (PCA)"),
br(),
#p("Note that only the most variable genes are used in the dimension reduction step (PCA)."),
#br(),
column(width = 3,
select_norm_methods("normaliz_method")
),
conditionalPanel(
condition = "input.normaliz_method == 0",
column(width = 4,
numericInput_scale_factor("scale_factor"),
radioInput_most_var_method("most_var_method"),
numericInput_var_genes("n_of_var_genes")
),
),
column(width = 3,
actionButtonInput("run_pca",
HTML("Run the PCA analysis"))
)
), # Fluid row,
conditionalPanel(
condition = "input.run_pca!= 0",
fluidRow(
titlePanel("Elbow plot showing the variation explained by each Principal Component"),
br(),
p("Choose the number of components that explain the most variation."),
br(),
column(width = 6,
my_withSpinner( plotOutput("n_of_PCAs") )
),
# Plot download
column(2,
numericInput_plot_height("p2_height", value=12),
numericInput_plot_width("p2_width", value=18),
selectInput_plot_res("p2_res"),
selectInput_plot_format("p2_format"),
downloadButton("p2_down", HTML("Download Plot"))
),
column(width = 3,
numericInput_n_of_PCs("n_of_PCs")
)
) # Fluid row
), # Ends conditional
),
fluidRow(
titlePanel("Clustering"),
conditionalPanel (
condition = "input.sample_tab1_options == 0",
br(),
p("Be aware that this parameter is central in the cluster definition. It is recommended to try different values and define the most appropriate value according to the expectations of the cell populations present in the sample."),
p("Quoting from", a(tags$a(href="https://satijalab.org/seurat/archive/v1.4/pbmc3k_tutorial.html", "Seurat's tutorial", target="_blank")), ":", em("\"We find that setting this parameter between 0.6-1.2 typically returns good results for single-cell datasets of around 3K cells. Optimal resolution often increases for larger datasets.\"")),
br(),
column(width = 3,
numericInput_resolution_clust("resolution_clust")
),
column(width = 3,
actionButtonInput("run_clustering",
HTML("Run the clustering analysis"))
)
), # Fluid row
),
conditionalPanel(
condition = "input.run_clustering!= 0 || input.load_10X_rds!= 0",
fluidRow(
titlePanel("Clustering plots"),
column(width = 6,
my_withSpinner( plotOutput("umap") )
),
column(width = 6,
my_withSpinner( plotOutput("tSNE") )
)
), # Fluid row
fluidRow(
br(),
# download plot
column(width = 3,
div(class = "down-group",
radioButtons("p3_down_opt",
"Select the plot to download",
choices = list("UMAP" = "UMAP",
"t-SNE" = "t-SNE"),
selected = c("UMAP")))
),
column(2,
numericInput_plot_height("p3_height", value=10),
numericInput_plot_width("p3_width", value=18)
),
column(2,
selectInput_plot_res("p3_res"),
selectInput_plot_format("p3_format")
),
column(2,
div(class = "down-group",
downloadButton("p3_down", HTML("Download Plot")))
),
),
fluidRow(
titlePanel("Number of cells per cluster"),
p("First row shows the cluster ID. The second row shows the number of cells per cluster."),
column(12,
my_withSpinner( verbatimTextOutput("cluster_size") )
)
), # Fluid row
), # Ends conditional
conditionalPanel (
condition = "input.sample_tab1_options == 0",
fluidRow(
titlePanel("Excluding or selecting clusters for reanalysis"),
br(),
p("Sometimes, it is helpful to exclude or select the clusters that are of interest. After excluding or selecting the cells of interest, it is recommended to repeat the clustering step using only the subset."),
p("After selecting the clusters, click on the blue button (Reanalyze after selection/exclusion of clusters). Asc-Seurat will run the analyses of the new subset until the PCA step.", strong("Then, users need to set the new number of components using the elbow plot (above) and click on the button \"Run the clustering analysis\" again.")),
br(),
column(3,
radioButtons_filter_clusters("filter_clusters")
),
conditionalPanel(
condition = "input.filter_clusters != 0",
column(3,
radioButtons_filter_clusters_opt("filter_clusters_opt")
),
column( 3,
div(class = "option-group",
my_withSpinner( uiOutput("cluster_list_ui") ))
),
column( 3,
div(class = "option-group",
actionButtonInput("rerun_after_filtering",
HTML("Reanalyze after selection/exclusion of clusters")))
),
) # ends conditional
),
fluidRow(
br(),
h3("Saving the processed data for the trajectory inference analysis"),
p("The button below allows for saving the processed data in a file that can be used for the pseudo-time analysis."),
#p("Asc-Seurat will save only the most recently processed data."),
br(),
p(strong("Note:", "The processed data needs to be saved in the folder", code("RDS_files/"), "so it can be load automatically in the tab \"Trajectory inference.\"" )),
column(6,
br(),
downloadButton("downloadRDS",
"Download the processed data to use in the trajectory inference analysis",
class = "down_butt")
)
),
),
fluidRow(
titlePanel("Identification of markers / Differential expression analysis"),
column(3,
radioButtons_find_markers("find_markers_tab1")
)
),
conditionalPanel(
condition = "input.find_markers_tab1 == 1",
fluidRow(
br(),
p("Check the Seurat's vignettes", a(tags$a(href="https://satijalab.org/seurat/v3.2/de_vignette.html", "here", target="_blank")), "and the function's manual", a(tags$a(href="https://www.rdocumentation.org/packages/Seurat/versions/3.1.4/topics/FindAllMarkers", "here",target="_blank")), "to see the options for each parameters of this section. "),
br(),
column(3,
div(class = "option-group",
radioButtons("find_markers_tab1_opt",
"Select the analysis to perform?",
choices = list("Identify markers for all clusters" = 0,
"Identify markers for one specific cluster" = 1,
"Identify markers distinguishing a cluster from other(s) cluster(s)" = 2),
selected = c(0)))),
conditionalPanel (
condition = "input.find_markers_tab1_opt == 1",
column(3,
div(class = "option-group",
my_withSpinner( uiOutput("find_markers_clust_id_tab1_ui") ))),
), # ends conditional
conditionalPanel (
condition = "input.find_markers_tab1_opt == 2",
column(3,
div(class = "option-group",
my_withSpinner( uiOutput("find_markers_clust_ID1_tab1_ui") ),
my_withSpinner( uiOutput("find_markers_clust_ID2_tab1_ui") ))),
), # ends conditional
column(3,
div(class = "option-group",
numericInput("find_markers_tab1_logfc_threshold",
label = "Select the (log) fold change threshold",
value = 0.25),
numericInput("find_markers_tab1_min_pct",
label = "Select the minimal percentage of cells expressing a gene for this gene to be tested (0 = 0%, 1 = 100%)",
value = 0.1,
step = 0.01),
pickerInput_find_markers_test("find_markers_tab1_test.use"),
conditionalPanel(
condition = "input.find_markers_tab1_opt != 0",
radioButtons("find_markers_tab1_filt_pos",
"Filter only positive markers?",
choices = c("yes" = "TRUE",
"no" = "FALSE"),
selected = "TRUE")),
numericInput("find_markers_tab1_return_thresh",
label = "Select the (adjusted) p-value threshold",
value = "0.05",
step = 0.01),
),
actionButtonInput("run_ident_markers_tab1",
HTML("Search for markers/D.E. genes"))),
), # ends conditional
), # ends fluidrow
conditionalPanel(
condition = "input.find_markers_tab1 == 1",
fluidRow(
titlePanel("List of markers or differentially expressed genes"),
conditionalPanel(
condition = "input.run_ident_markers_tab1 != 0",
column(12,
my_withSpinner( reactableOutput("markers_tab1_react")) ),
),
br(),
column(4,
downloadButton("download_markers_tab1",
"Download the list of markers or D.E. genes"))
), # ends fluidrow
), # ends conditional
fluidRow(
titlePanel("Expression of markers"),
br(),
p("In this section, users can visualize the gene expression of selected genes (e.g., tissue markers). Start by loading a", strong("csv"), "file with at least two columns. The first column must be the gene ID, and the second is a grouping variable (e.g., the tissue name). A third column can be used to store the common name of the gene but is optional."),
br(),
column(width = 3,
fileInput_markers_list("markers_list"),
div(class = "option-group",
selectInput("markers_list_header_opt",
"Does your file have a header?",
choices = c("", "Yes", "No"),
multiple = FALSE,
selectize = TRUE,
selected = NULL)),
div(class = "option-group",
actionButtonInput("load_markers",
HTML("Load markers")))),
column(width = 2,
conditionalPanel(
condition = "input.load_markers > 0",
my_withSpinner( uiOutput('marker_group_selec') ),
define_if_use_all_genes_or_select("filter_genes_q"),
conditionalPanel(
condition = "input.filter_genes_q == 0",
define_what_id_to_use("genes_ids")
))),
conditionalPanel(
condition = "input.filter_genes_q == 0",
column(width = 3,
my_withSpinner( uiOutput('marker_genes_selec') )
)
),
column(width = 2,
conditionalPanel(
condition = "input.load_markers > 0",
radioButtons_slot_selection_heatmap("slot_selection_heatmap"))),
column(width = 2,
conditionalPanel(
condition = "input.load_markers > 0",
actionButtonInput("run_heatmap",
HTML("Show heatmap"))))
), # Fluid row
#heat map
conditionalPanel(
condition = "input.run_heatmap > 0",
fluidRow(
br(),
titlePanel("Heatmap"),
br(),
strong("Note that the scale of colors of the heatmap is adjusted based on the expression of the selected genes."),
br(),
column(width = 10,
my_withSpinner( uiOutput("heat_map_ui"))),
column(2,
numericInput_plot_height("p4_height", value=15),
numericInput_plot_width("p4_width", value=20),
selectInput_plot_res("p4_res"),
selectInput_plot_format("p4_format"),
downloadButton("p4_down", HTML("Download Plot"))),
column(width = 10,
verbatimTextOutput("test"))
),
fluidRow(
titlePanel("Visualization of gene expression of each cell and additional plots"),
br(),
p("Only genes selected for the heatmap can be selected for the additional plots."),
br(),
column(width = 3,
my_withSpinner( uiOutput("marker_to_feature_plot") )),
column(width = 2,
radioButtons_slot_selection_feature_plot("slot_selection_feature_plot")),
column(width = 3,
actionButtonInput("run_feature_plot",
HTML("Show the expression of genes at the cell level")))
)
), # Ends conditional
conditionalPanel (
condition = "input.run_feature_plot > 0",
fluidRow(
titlePanel("Feature plots"),
column(width = 4,
my_withSpinner( uiOutput("feature_plot") )),
column(width = 4,
my_withSpinner( uiOutput("feature_plot_dark", height = "300px") )),
column(width = 4,
my_withSpinner( uiOutput("umap2",
height = "300px") ))
), # Ends Fluid row
fluidRow(
titlePanel("Violin and Dot plots"),
column(width = 6,
my_withSpinner( uiOutput("run_vln_plot") )),
column(width = 6,
my_withSpinner( uiOutput("run_dot_plot") ))),
), # Ends conditional
conditionalPanel (
condition = "input.run_feature_plot > 0",
fluidRow(
titlePanel("Downloading additional plots"),
p("In this section, it is possible to download the feature, violin, and dot plots of each selected gene."),
p("The files will be saved in the folder:", em("images/one_sample_plots_<current date>__<current time>")),
br(),
column(width = 2,
radioButtons_down_add_plots("down_add_plots_tab1")),
conditionalPanel (
condition = "input.down_add_plots_tab1 == 1",
column(width = 2,
my_withSpinner( uiOutput("select_genes_add_plot_to_down_ui") ),
),
column(2,
div(class = "option-group",
p(strong("Select the options for the feature plots")) ),
numericInput_plot_height("add_p_tab1_feat_height", value=10),
numericInput_plot_width("add_p_tab1_feat_width", value=14),
selectInput_plot_res("add_p_tab1_feat_res"),
selectInput_plot_format("add_p_tab1_feat_format")),
column(2,
div(class = "option-group",
p(strong("Select the options for the violin plots")) ),
numericInput_plot_height("add_p_tab1_violin_height", value=10),
numericInput_plot_width("add_p_tab1_violin_width", value=14),
selectInput_plot_res("add_p_tab1_violin_res"),
selectInput_plot_format("add_p_tab1_violin_format")),
column(2,
div(class = "option-group",
p(strong("Select the options for the dot plots")) ),
numericInput_plot_height("add_p_tab1_dot_height", value=10),
numericInput_plot_width("add_p_tab1_dot_width", value=14),
selectInput_plot_res("add_p_tab1_dot_res"),
selectInput_plot_format("add_p_tab1_dot_format")),
column(width = 3,
actionButtonInput("start_down_add_plots_tab1",
HTML("Download additional plots")))))
),
bookmarkButton(style = "position:absolute;right:2em; background-color:#BF3EFF; color:#FFFFFF;"),
tags$hr(),
p(strong("Asc-Seurat, version 2.2.1"), "- Released on February, 2022.", align = "center")
# Ends page
),
####################################
### Integrative analysis - Tab 2 ###
####################################
tabPanel("Integration of multiple samples",
br(),
p(strong("Note that at any time, you can save a bookmark (purple button at the right bottom) that will save your parameter choices. Using the saved bookmark, it is possible to re-load all selected parameters and re-execute the analysis, to reproduce the results.")),
br(),
p("It is necessary to choose adequate parameters before loading the data for integration to avoid bias due to poor cells interfering in the anchoring step.", strong("Therefore, we recommend exploring each sample separately in the one sample tab and defining the best parameters before the integration.")),
br(),
p("It is necessary to have a configuration file in the csv format to load the samples for integration. Please visit",
a(tags$a(href="https://asc-seurat.readthedocs.io/en/latest/loading_data_int.html#loading-the-data-and-integration-of-multiple-samples documentation", "Asc-Seurat's documentation", target="_blank")), "for instructions on how to generate this file."),
br(),
p("Alternatively, it is possible to load previously integrated data, saving some time by not running the integration step."),
#p("After selecting the parameters, click on the blue button to load the data."),
br(),
fluidRow(
column(width = 3,
div(class = "option-group",
radioButtons("integration_options",
"Run a new integration analysis or read a previously saved file?",
choices = list("Run a new analysis" = 0,
"Load an integrated, unclustered, dataset" = 2,
"Load an integrated, clustered, dataset" = 1),
selected = c(0) )),
conditionalPanel (
condition = "input.integration_options == 0",
div(class = "option-group",
fileInput("samples_list_integration",
label = "Read the configuration file containing the samples' information",
accept = c(
'text/csv',
'text/comma-separated-values',
'text/tab-separated-values',
'csv',
'tsv') ) ),
my_withSpinner( uiOutput('select_sample_tab2') )
#),
),
),
conditionalPanel(
condition = "input.integration_options != 0",
column(width = 3,
my_withSpinner( uiOutput("load_integrated_ui") ),
div(class = "option-group",
selectInput(
inputId = "load_rds_int_normalization",
label = "Inform the normalization method used to generate the integrated dataset",
choices = list("",
"LogNormalization" = 0,
"SCtransform" = 1),
selected = "",
multiple = F))
),
),
conditionalPanel(
condition = "input.integration_options == 1",
column(width = 3,
actionButtonInput("load_rds_file2",
HTML("Load the integrated, clustered, data")))
),
conditionalPanel(
condition = "input.integration_options == 2",
column(width = 3,
actionButtonInput("load_rds_file3",
HTML("Load the integrated, unclustered, data")))
),
conditionalPanel (
condition = "input.integration_options == 0",
fluidRow(
column(width = 2,
textInput_regex("int_regex_mito"),
numericInput_var_genes("n_of_var_genes_integration",
label = "N of variable genes for integration"),
numericInput_n_of_PCs("n_of_PCs_integration",
"N of components for the integration"),
input_project_name("int_project_name")
),
column(width = 3,
select_norm_methods("normaliz_method_tab2"),
conditionalPanel(
condition = "input.normaliz_method_tab2 == 0",
numericInput_scale_factor("scale_factor_tab2"),
radioInput_most_var_method("most_var_method_tab2"),
),
),
column(width = 3,
actionButtonInput("load_rds_file",
HTML("Execute a new integration")))
),
), # ends conditional
), # ends fluidRow
conditionalPanel (
condition = "input.integration_options != 1",
conditionalPanel (
condition = "input.load_rds_file != 0",
fluidRow(
titlePanel("Genes targeted as mitochondrial"),
p("The genes below were targeted by the parameter \"common identifier of mitochondrial genes\", set above."),
column(12,
my_withSpinner( verbatimTextOutput("target_genes_mitho_tab2") )
)
), # Fluid row
),
conditionalPanel (
condition = "input.integration_options != 1",
fluidRow(
tags$hr(),
p("Since the integration is a time-consuming step, it is helpful to save the integrated data before running any additional analyses. The main advantage of saving the data is that if you need to restart the analysis (e. g., to change parameters), you can skip the integration step by loading the RDS file instead."),
br(),
p( strong("The rds files must be saved in the folder"), code("RDS_files.") ),
column(6,
downloadButton("download_int_data",
"Download RDS object containing the integrated data.")
)),
),
fluidRow(
titlePanel("Screening plot to define filtering parameters"),
br(),
p("Use this plot to define more restrictive parameters and exclude cells based on their number of expressed genes and the percentage of expressed genes from the mitochondria."),
#p("The parameters can be set on the right side of the plot."),
#br(),
p("After setting the parameters, click on \"Show/update plot of filtered data\" to visualize the data after filtering."),
column(width = 10,
my_withSpinner( plotOutput("VlnPlot_tab2") )),
column(width = 2,
div(class = "option-group",
numericInput("min_count_tab2",
label = "Keep only cells that expressed at least this number of genes",
value = "")),
div(class = "option-group",
numericInput("max_count_tab2",
label = "Exclude any cell that expressed more than this number of genes (i.e., possible doublets)",
value = "")
),
numericInput_max_mito_perc("max_mito_perc_tab2", value = "")),
column(width = 2,
actionButtonInput("run_vinplot_tab2",
HTML("Show/update plot of filtered data")),
conditionalPanel(
condition = "input.run_vinplot_tab2 == 0",
actionButtonInput("run_pca_tab2_1",
HTML("Run the PCA analysis"))
),
),
), # ends fluidRow
),
# fluid row
conditionalPanel(
condition = "input.run_vinplot_tab2!= 0",
fluidRow(
titlePanel("Screening plot showing the remaining cells after filtering"),
column(width = 10,
my_withSpinner( plotOutput("VlnPlot_filt_tab2") )
),
column(2,
numericInput_plot_height("p5_height", value=12),
numericInput_plot_width("p5_width", value=20),
selectInput_plot_res("p5_res"),
selectInput_plot_format("p5_format"),
downloadButton("p5_down", HTML("Download Plot")),
actionButtonInput("run_pca_tab2_2",
HTML("Run the PCA analysis")))
), # fluid row
), # Ends conditional
conditionalPanel(
condition = "input.run_pca_tab2_1 != 0 || input.run_pca_tab2_2 != 0",
fluidRow(
titlePanel("Elbow plot showing the variation explained by each component"),
br(),
p("Choose the number of components that explain the most variation."),
br(),
column(width = 6,
my_withSpinner( plotOutput("n_of_PCAs_tab2") )
),
column(2,
numericInput_plot_height("p6_height", value=10),
numericInput_plot_width("p6_width", value=18),
selectInput_plot_res("p6_res"),
selectInput_plot_format("p6_format"),
downloadButton("p6_down", HTML("Download Plot"))),
column(width = 3,
numericInput_n_of_PCs("n_of_PCs_tab2"))
) # Fluid row
), # Ends conditional
## Clustering tab2
fluidRow(
titlePanel("Clustering"),
conditionalPanel (
condition = "input.integration_options != 1",
br(),
p("Be aware that this parameter is central in the cluster definition. It is recommended to try different values and define the most appropriate according to the expectations of the cell populations present in your sample."),
p("Quoting from", a(tags$a(href="https://satijalab.org/seurat/archive/v1.4/pbmc3k_tutorial.html", "Seurat's tutorial", target="_blank")), ":", em("\"We find that setting this parameter between 0.6-1.2 typically returns good results for single-cell datasets of around 3K cells. Optimal resolution often increases for larger datasets.\"")),
br(),
column(width = 3,
numericInput_resolution_clust("resolution_clust_tab2")),
column(width = 3,
actionButtonInput("run_clustering_tab2",
HTML("Run the clustering analysis")))
), # Fluid row
),
conditionalPanel(
condition = "input.run_clustering_tab2 != 0 || input.load_rds_file2 != 0",
fluidRow(
titlePanel("Clustering plots"),
column(width = 6,
my_withSpinner( plotOutput("umap_tab2") )
),
column(width = 6,
my_withSpinner( plotOutput("umap_three_samples_comb") )
)
), # Fluid row
fluidRow(
titlePanel("Clustering plots (UMAP) separated by sample"),
column(width = 12,
my_withSpinner( plotOutput("umap_three_samples") )
)
), # Fluid row
fluidRow(
br(),
# download plot
column(width = 3,
div(class = "down-group",
radioButtons("p7_down_opt",
"Select the plot to download",
choices = list("UMAP" = "UMAP",
"UMAP colored by sample" = "UMAP1",
"UMAP split by sample"= "UMAP2"),
selected = "UMAP"))),
column(2,
numericInput_plot_height("p7_height", value=10),
numericInput_plot_width("p7_width", value=12)),
column(2,
selectInput_plot_res("p7_res"),
selectInput_plot_format("p7_format")),
column(2,
downloadButton("p7_down", HTML("Download Plot"))),
),# Fluid row
fluidRow(
titlePanel("Number of cells per cluster"),
p("The first row shows the cluster ID. The second row shows the number of cells per cluster."),
column(12,
my_withSpinner( verbatimTextOutput("cluster_size_tab2") ))
), # Fluid row
), # Ends conditional
conditionalPanel (
condition = "input.integration_options != 1",
fluidRow(
titlePanel("Excluding or selecting clusters for reanalysis"),
br(),
p("Sometimes, it is helpful to exclude or select the clusters that are more of interest.", "After selecting or excluding the cells of interest, it is recommended to repeat the clustering step using only the subset."),
p("After selecting the clusters, click on the blue button (Reanalyze after selection/exclusion of clusters). Asc-Seurat will run the analyses of the new subset until the PCA step.", strong("Then, you will need to set the new number of components using the elbow plot (above) and click on the button \"Run the clustering analysis\" again.")),
column(3,
radioButtons_filter_clusters("filter_clusters_tab2")
),
conditionalPanel(
condition = "input.filter_clusters_tab2 != 0",
column(3,
radioButtons_filter_clusters_opt("filter_clusters_opt_tab2")
),
column( 3,
div(class = "option-group",
my_withSpinner( uiOutput("cluster_list_tab2_ui") )
)
),
column( 3,