forked from ZhenyiWangTHU/HemaScopeR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshiny_sc_st_all.R
5069 lines (4474 loc) · 189 KB
/
shiny_sc_st_all.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(shinyjs)
library(shinydashboard)
library(shinyWidgets)
library(slickR)
# sc libraries
library(Seurat)
library(phateR)
library(DoubletFinder)
library(monocle)
library(slingshot)
#library(URD) #没有这个包
library(GSVA)
library(limma)
library(plyr)
library(dplyr)
library(org.Mm.eg.db)
library(org.Hs.eg.db)
library(CellChat)
library(velocyto.R)
library(SeuratWrappers)
library(stringr)
library(scran)
library(ggpubr)
library(viridis)
library(pheatmap)
library(parallel)
library(reticulate)
library(SCENIC)
library(feather)
library(AUCell)
library(RcisTarget)
library(Matrix)
library(foreach)
library(doParallel)
library(clusterProfiler)
library(tools)
#st libraries
library(RColorBrewer)
library(Rfast2)
library(SeuratDisk)
library(abcCellmap)
library(biomaRt)
library(copykat)
library(gelnet)
library(ggplot2)
library(parallelDist)
library(patchwork)
library(markdown)
# getpot
#library(getopt) #没有这个包
library(tools)
# HemaScopeR
library(HemaScopeR)
Load_previous_results = function(previous_results_path=NULL){
# Get a list of all .RDS files in the specified path
rds_files_list <- list.files(previous_results_path, pattern = "\\.rds$", full.names = TRUE)
# Loop through the list of RDS files and load them into variables
for (rds_file in rds_files_list) {
# Extract the variable name from the file name
var_name <- tools::file_path_sans_ext(basename(rds_file))
if(!(var_name %in% c( # input and output
#'input.data.dirs',
#'project.names',
#'output.dir',
#'pythonPath',
# quality control and preprocessing
'gene.column',
'min.cells',
'min.feature',
'mt.pattern',
'nFeature_RNA.limit',
'percent.mt.limit',
'scale.factor',
'nfeatures',
'ndims',
'vars.to.regress',
#'PCs',
'resolution',
'n.neighbors',
# remove doublets
'doublet.percentage',
'doublerFinderwraper.PCs',
'doublerFinderwraper.pN',
'doublerFinderwraper.pK',
# phateR
'phate.knn',
'phate.npca',
'phate.t',
'phate.ndim',
'min.pct',
'logfc.threshold',
# visualization
'marker.genes',
#'ViolinPlot.cellTypeOrders',
#'ViolinPlot.cellTypeColors',
#'Org',
'lineage.genelist',
'lineage.names',
'groups_colors',
#slingshot
'slingshot.start.clus',
'slingshot.end.clus',
'slingshot.colors',
'loom.files.path',
# cell cycle
'cellcycleCutoff',
# cell chat
'sorting',
'ncores',
# Verbose = FALSE,
# activeEachStep
'Whether_load_previous_results',
'Step1_Input_Data',
'Step1_Input_Data.type',
'Step2_Quality_Control',
#'Step2_Quality_Control.RemoveBatches',
#'Step2_Quality_Control.RemoveDoublets',
'Step3_Clustering',
'Step4_Identify_Cell_Types',
'Step4_Use_Which_Labels',
'Step4_Cluster_Labels',
'Step4_Changed_Labels',
'Step4_run_sc_CNV',
'Step5_Visualization',
'Step6_Find_DEGs',
'Step7_Assign_Cell_Cycle',
'Step8_Calculate_Heterogeneity',
'Step9_Violin_Plot_for_Marker_Genes',
'Step10_Calculate_Lineage_Scores',
'Step11_GSVA',
'Step11_GSVA.identify.cellType.features',
'Step11_GSVA.identify.diff.features',
'Step11_GSVA.comparison.design',
'Step12_Construct_Trajectories',
'Step12_Construct_Trajectories.monocle',
'Step12_Construct_Trajectories.slingshot',
'Step12_Construct_Trajectories.scVelo',
'Step13_TF_Analysis',
'Step13_TF_Analysis.cellTypes_colors',
'Step13_TF_Analysis.groups_colors',
'Step14_Cell_Cell_Interaction',
'Step15_Generate_the_Report'
))){
# Load the RDS file and assign it to the variable with the same name
rds_file.temp <- base::readRDS(rds_file)
assign(var_name, rds_file.temp, envir = .GlobalEnv)
}
}
}
# ui--------------------------------------------------------------------------------------------------------------------------------------------
step_sc_continue_fluidRow<-shiny::fluidRow(
style = "margin-left: 5px;",
shiny::column(12,align = "left",
h4("Continue Previous Analysis"),
actionButton("sc_continue_back_btn","Back to Prior Page",style = "width: 85%;",
class = "btn-primary btn-lg"),
numericInput("jobid","Enter your Job ID",value = NULL,width="95%"),
selectInput("continue_step","Choose a step to analyze",width="95%",
choices = c(
#"Step 1. Input Data",
"Step 2. Quality Control" = "step 2",
"Step 3. Clustering" = "step 3",
"Step 4. Identify Cell Types" = "step 4",
"Step 5. Visualization" = "step 5",
"Step 6. Find DEGs" = "step 6",
"Step 7. Assign Cell Cycles" = "step 7",
"Step 8. Calculate Heterogeneity" = "step 8",
"Step 9. Violin Plot for Marker Genes" = "step 9",
"Step 10. Calculate Lineage Scores" = "step 10",
"Step 11. GSVA" = "step 11",
"Step 12. Construct Trajectories" = "step 12",
"Step 13. TF Analysis" = "step 13",
"Step 14. Cell-Cell Interaction" = "step 14",
"Step 15. Generate the Report" = "step 15"
),selected = "step 2")
))
step_st_continue_fluidRow<-shiny::fluidRow(
style = "margin-left: 5px;",
shiny::column(12,align = "left",
h4("Continue Previous Analysis"),
actionButton("st_continue_back_btn","Back to Prior Page",style = "width: 85%;",
class = "btn-primary btn-lg"),
numericInput("st_jobid","Enter your Job ID",value = 0,width = "95%"),#要是数字输入不然会报错
selectInput("st_continue_step","Choose a step to analyze",width = "95%",
choices = c(
#"Step 1. Input Data",
"Step 2. Quality Control" = "step 2",
"Step3. Normalization, PCA and Clustering" = "step 3",
"Step4. Differential expressed genes" = "step 4",
"Step5. Spatially variable features" = "step 5",
"Step6. Spatial interaction" = "step 6",
"Step 7. CNV analysis" = "step 7",
"Step8. Deconvolution" = "step 8",
"Step9. Cellcycle" = "step 9",
"Step10. Niche analysis" = "step 10",
"Step11. Generate the Report" = "step 11"
),selected = "step 2")
))
ui <- fluidPage(
shinyjs::useShinyjs(),
# ui1
div(id = "ui1", style = "display: flex; flex-direction: column; align-items: center; justify-content: center; height: 70vh;",
fluidRow(),
fluidRow(
column(3, align = "center", imageOutput('logo'))
),
fluidRow(
column(12, align = "center", h1("HemaScope: a user-friendly and modular design toolkit tailored for analyzing single-cell and spatial transcriptome sequencing data of hematopoietic cells",
class = "h1-font",style = "font-family: 'arial'; font-size: 28pt;font-weight: bold;"))
),
fluidRow(div(class = "spacer")), # empty line
fluidRow(div(class = "spacer")), # empty line
div(style = "display: flex; justify-content: center; width: 100%;",
actionButton("start_button", "Start scRNA-seq pipeline",style = "font-family: 'arial'; font-size: 18pt;background-color: #dae3f5;padding: 20px 20px; margin-right: 20px;"),
actionButton("start_button_st", "Start ST-seq pipeline",style = "font-family: 'arial'; font-size: 18pt;background-color: #dae3f5;padding: 20px 20px; margin-right: 20px;")
),
uiOutput("ui_styles")
),
#ui2.1 ,zyt add this code
div(id = "ui2.1",style = "display: none;",#设置为隐藏不显示
fluidRow(
box(width = 4, status = "primary", solidHeader = TRUE,
actionButton("new_analysize_btn", "Begin New Analysis",
style = "width:100%; height:100px; font-size:20px;background-color: white; color: black;")),
box(width = 4, status = "warning", solidHeader = TRUE,
actionButton("continue_analysize_btn", "Continue Previous Analysis",
style = "width:100%; height:100px; font-size:20px;background-color: white; color: black;")),
box(width = 4, status = "danger", solidHeader = TRUE,
actionButton("sc_return_home", "Back to Home",
style = "width:100%; height:100px; font-size:20px;background-color: white; color: black;"))
)
),
div(id = "ui2.2",style = "display: none;",
uiOutput("dynamic_ui"),
uiOutput("continue_stepContent")
),
# ui2
div(id = "ui2", style = "display: none;",
dashboardPage(
skin = c("blue"),
dashboardHeader(title = "scRNA-seq pipeline"),
dashboardSidebar(
disable = FALSE,
sidebarMenu(
id="sc_step_tab",selected=TRUE,
menuItem("Step 1. Input Data", tabName = "step_1"),
menuItem("Step 2. Quality Control", tabName = "step_2"),
menuItem("Step 3. Clustering", tabName = "step_3"),
menuItem("Step 4. Identify Cell Types", tabName = "step_4"),
menuItem("Step 5. Visualization", tabName = "step_5"),
menuItem("Step 6. Find DEGs", tabName = "step_6"),
#menuItem("Step 6. Find DEGs", tabName = "Step 6"),
menuItem("Step 7. Assign Cell Cycles", tabName = "step_7"),
menuItem("Step 8. Calculate Heterogeneity", tabName = "step_8"),
menuItem("Step 9. Violin Plot for Marker Genes", tabName = "step_9"),
menuItem("Step 10. Calculate Lineage Scores", tabName = "step_10"),
menuItem("Step 11. GSVA", tabName = "step_11"),
menuItem("Step 12. Construct Trajectories", tabName = "step_12"),
menuItem("Step 13. TF Analysis" , tabName = "step_13"),
menuItem("Step 14. Cell-Cell Interaction", tabName = "step_14"),
menuItem("Step 15. Generate the Report" , tabName = "step_15"),
menuItem("Back to Prior Page",tabName = "back_button")
)
),
dashboardBody(
uiOutput("stepContent")
)
)
),
# ui3
div(id = "ui3", style = "display: none;",
dashboardPage(
skin = c("blue"),
dashboardHeader(title = "ST-seq pipeline"),
dashboardSidebar(
disable = FALSE,
sidebarMenu(
id="st_step_tab",selected=TRUE,
menuItem("Step 1. Input Data", tabName = "step1_st"),
menuItem("Step 2. Quality Control", tabName = "step2_st"),
menuItem("Step 3. Clustering", tabName = "step3_st"),
menuItem("Step 4. Find Differential Genes", tabName = "step4_st"),
menuItem("Step 5. Spatially Variable Features", tabName = "step5_st"),
menuItem("Step 6. Spatial Interaction", tabName = "step6_st"),
menuItem("Step 7. CNV Analysis", tabName = "step7_st"),
menuItem("Step 8. Deconvolution", tabName = "step8_st"),
menuItem("Step 9. Cell Cycle Analysis", tabName = "step9_st"),
menuItem("Step 10. Niche Analysis", tabName = "step10_st"),
menuItem("Step 11. Generate the Report", tabName = "step11_st"),
menuItem("Back to Prior Page",tabName = "back_button_st")
)
),
dashboardBody(
uiOutput("stepContent_st")
)
)
),
div(id = "ui3.1",style = "display: none;",
fluidRow(
box(width = 4, status = "primary", solidHeader = TRUE,
actionButton("st_new_analysize_btn", "Begin New Analysis",
style = "width:100%; height:100px; font-size:20px;background-color: white; color: black;")),
box(width = 4, status = "warning", solidHeader = TRUE,
actionButton("st_continue_analysize_btn", "Continue Previous Analysis",
style = "width:100%; height:100px; font-size:20px;background-color: white; color: black;")),
box(width = 4, status = "danger", solidHeader = TRUE,
actionButton("st_return_home", "Back to Home",
style = "width:100%; height:100px; font-size:20px;background-color: white; color: black;"))
)
),
div(id = "ui3.2",style = "display: none;",
uiOutput("dynamic_st_ui"),
uiOutput("st_continue_step")
)
)
#scRNA UI step1-15
step1_fluidRow<-fluidRow(
style = "margin-left: 10px;",
column(
6, align = "left", h3("Step 1. Input Data"),
#p("Please select the input data."),
textInput("input.data.dirs",
HTML("Enter data path and use ';' to separate files<br>(e.g. /path1/file1/data1;/path2/file2/data2)"),
value = "NULL"),
textInput("project.names", "Enter project name:", value = "project.names"),
textInput("output.dir", "Enter output path:", value = ""),
textInput("pythonPath", "Enter the path of Python:", value = "NULL"),
textInput("databasePath", "Enter the path of database:", value = "NULL"),
pickerInput("Step1_Input_Data.type", "Select Data Type:", choices = c("cellranger-count", "Seurat", "Matrix")),
numericInput("gene.column", "Gene Column (default: 2):", value = 2),
numericInput("min.cells", "Minimum Cells (default: 10):", value = 10),
numericInput("min.feature", "Minimum Features (default: 200):", value = 200),
textInput("mt.pattern", "Mt Pattern (default: '^MT-'):", value = '^MT-'),
actionBttn("load_data_button", "Load Data", style = "unite", color = "primary"),
div(class = "spacer"),
uiOutput("loadingData"),
div(class = "spacer"),
uiOutput("data_dim_output")
),
column(3,align="middle",
h3("Please record your job ID for use in future analyses"),
#h5("Please copy your jobid and you will use it in subsequent analysis"),
textOutput("jobid")
)
)
step2_fluidRow <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 2. Quality Control"),
#p("Please input the parameters for quality control and preprocessing."),
#textInput("jobid","Please Paste the token generated in step 1"), #zyt add this code
numericInput("nFeature_RNA.limit", "nFeature_RNA.limit (default: 200):", value = 200),
numericInput("percent.mt.limit", "percent.mt.limit (default: 20):", value = 20),
numericInput("scale.factor", "scale factor (default: 10,000):", value = 10000),
numericInput("nfeatures", "nfeatures (default: 3,000):", value = 3000),
numericInput("ndims", "ndims (default: 50):", value = 50),
textInput("vars.to.regress", "vars.to.regress (default: NULL):", value = 'NULL'),
textInput("PCs", "PCs (default: 1:35):", value = "1:35"),
numericInput("resolution", "resolution (default: 0.4):", value = 0.4),
numericInput("n.neighbors", "n.neighbors (default: 50):", value = 50),
numericInput("doublet.percentage", "doublet percentage (default: 0.04):", value = 0.04),
textInput("doublerFinderwraper.PCs", "doubletFinder Wrapper PCs (default: 1:20):", value = "1:20"),
numericInput("doublerFinderwraper.pN", "doubletFinder Wrapper pN (default: 0.25):", value = 0.25),
numericInput("doublerFinderwraper.pK", "doubletFinder Wrapper pK (default: 0.1):", value = 0.1),
selectInput("Step2_Quality_Control.RemoveBatches", "Step2_Quality_Control.RemoveBatches:", choices = c("FALSE" = FALSE, "TRUE" = TRUE)),
selectInput("Step2_Quality_Control.RemoveDoublets", "Step2_Quality_Control.RemoveDoublets:", choices = c("FALSE" = FALSE, "TRUE" = TRUE)),
actionBttn("RunStep2", "Run Step2",style = "unite",color = "primary"),
#actionButton("RunStep2", "Run Step2"),
div(class = "spacer"),
uiOutput("runningStep2"),
div(class = "spacer"),
uiOutput("step2_completed")),
column(
4, align = "left",
h3("Browse files in Step 2. Quality Control:"),
uiOutput("Step2.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("step2_plot", width='auto',height = "500px"),
textOutput("step2_text"))
)
step3_fluidRow <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 3. Clustering"),
#p("Please input the parameters for clustering."),
textInput("PCs.clustering", "PCs for clustering (default: 1:20):", value = "1:20"),
numericInput("n.neighbors", "n.neighbors for clustering (default: 50):", value = 50),
numericInput("resolution", "resolution for clustering (default: 0.4):", value = 0.4),
actionBttn("RunStep3", "Run Step3",style = "unite",color = "primary"),
#actionButton("RunStep3", "Run Step3"),
div(class = "spacer"),
uiOutput("runningStep3"),
div(class = "spacer"),
uiOutput("step3_completed")),
column(
4, align = "left",
h3("Browse files in Step 3. Clustering:"),
uiOutput("Step3.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("step3_plot", width='auto',height = "500px"),
textOutput("step3_text"))
)
step4_fluidRow <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 4. Identify Cell Types"),
#p("Please input the parameters for identifying cell types automatically."),
selectInput("Org", "Choose organism (e.g., 'mmu' for mouse, 'hsa' for human):", choices = c("mmu" = "mmu", "hsa" = "hsa")),
selectInput("Step4_Use_Which_Labels", "Choose Labels:", choices = c('clustering' = 'clustering',
'abcCellmap.1' = 'abcCellmap.1',
'abcCellmap.2' = 'abcCellmap.2',
'abcCellmap.3' = 'abcCellmap.3',
'abcCellmap.4' = 'abcCellmap.4',
'HematoMap' = 'HematoMap')),
selectInput("Step4_run_sc_CNV", "Run CNV:", choices = c("TRUE" = TRUE, "FALSE" = FALSE)),
numericInput("ncores", "CPU cores for parallel processing (default: 1):", value = 1),
actionBttn("RunStep4", "Run Step4",style = "unite",color = "primary"),
#actionButton("RunStep4", "Run Step4"),
div(class = "spacer"),
uiOutput("runningStep4"),
div(class = "spacer"),
uiOutput("step4_completed")),
column(
4, align = "left",
h3("Browse files in Step 4. Identify Cell Types:"),
uiOutput("Step4.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("step4_plot", width='auto',height = "500px"),
textOutput("step4_text"))
)
step5_fluidRow <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 5. Visualization"),
#p("Please input the parameters for visualization."),
numericInput("phate.knn", "Nearest neighbors for PhateR analysis (default: 50):", value = 50),
numericInput("phate.npca", "Principal components for PhateR (default: 20):", value = 20),
numericInput("phate.t", "t parameter for PhateR (default: 10):", value = 10),
numericInput("phate.ndim", "Dimensions for PhateR (default: 2):", value = 2),
actionBttn("RunStep5", "Run Step5",style = "unite",color = "primary"),
#actionButton("RunStep5", "Run Step5"),
div(class = "spacer"),
uiOutput("runningStep5"),
div(class = "spacer"),
uiOutput("step5_completed")),
column(
4, align = "left",
h3("Browse files in Step 5. Visualization:"),
uiOutput("Step5.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("step5_plot", width='auto',height = "500px"),
textOutput("step5_text"))
)
step6_fluidRow <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 6. Find Differential Genes"),
#p("Please input the parameters for finding DEGs."),
numericInput("min.pct", "Minimum gene percentage for differential detection (default: 0.25):", value = 0.25),
numericInput("logfc.threshold", "Log-fold threshold for gene analysis(Default: 0.25):", value = 0.25),
actionBttn("RunStep6", "Run Step6",style = "unite",color = "primary"),
#actionButton("RunStep6", "Run Step6"),
div(class = "spacer"),
uiOutput("runningStep6"),
div(class = "spacer"),
uiOutput("step6_completed")),
column(
4, align = "left",
h3("Browse files in Step 6. Find Differential Genes:"),
uiOutput("Step6.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("step6_plot", width='auto',height = "500px"),
textOutput("step6_text"))
)
step7_fluidRow <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 7. Assign Cell Cycles"),
#p("Please input the parameters for assigning cell cycles."),
textInput("cellcycleCutoff", "Define cell cycle cutoff (default: NULL):", value = "NULL"),
actionBttn("RunStep7", "Run Step7",style = "unite",color = "primary"),
#actionButton("RunStep7", "Run Step7"),
div(class = "spacer"),
uiOutput("runningStep7"),
div(class = "spacer"),
uiOutput("step7_completed")),
column(
4, align = "left",
h3("Browse files in Step 7. Assign Cell Cycles:"),
uiOutput("Step7.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("step7_plot", width='auto',height = "500px"),
textOutput("step7_text"))
)
step8_fluidRow <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 8. Calculate Heterogeneity"),
#p("Please set the parameter needs for calculating heterogeneity."),
textInput("ViolinPlot.cellTypeOrders", "Order cell types (seperate by ','):", value = "NULL"),
actionBttn("RunStep8", "Run Step8",style = "unite",color = "primary"),
#actionButton("RunStep8", "Run Step8"),
div(class = "spacer"),
uiOutput("runningStep8"),
div(class = "spacer"),
uiOutput("step8_completed")),
column(
4, align = "left",
h3("Browse files in Step 8. Calculate Heterogeneity:"),
uiOutput("Step8.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("step8_plot", width='auto',height = "500px"),
textOutput("step8_text"))
)
step9_fluidRow <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 9. Violin Plot for Marker Genes"),
#p("Set parameters for violin plot of marker genes."),
textInput("marker.genes", "Enter marker genes for violin plot (seperate by ','):", value = "NULL"),
textInput("ViolinPlot.cellTypeColors", "Set the hexadecimal codes of colors for cell types (seperate by ','):", value = "NULL"),
actionBttn("RunStep9", "Run Step9",style = "unite",color = "primary"),
#actionButton("RunStep9", "Run Step9"),
div(class = "spacer"),
uiOutput("runningStep9"),
div(class = "spacer"),
uiOutput("step9_completed")),
column(
4, align = "left",
h3("Browse files in Step 9. Violin Plot for Marker Genes:"),
uiOutput("Step9.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("step9_plot", width='auto',height = "500px"),
textOutput("step9_text"))
)
step10_fluidRow <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 10. Calculate Lineage Scores"),
#p("Please input the parameters for calculating lineage scores."),
textInput("lineage.genelist", HTML('The gene sets for calculating lineage scores.<br>Please enclose the gene sets with double quotation marks and seperate them by ";". <br>(e.g. "gene1,gene2,gene3";"gene4,gene5,gene6"):'), value = "NULL"),
textInput("lineage.names", HTML('The names for the lineages. Please use "," to seperate them.<br>(e.g. lineage1,lineage2):'), value = "NULL"),
textInput("groups_colors", HTML('The hexadecimal codes of colors for groups. Please use "," to seperate them.<br>(e.g. #FF0000,#0000FF):'), value = "NULL"),
actionBttn("RunStep10", "Run Step10",style = "unite",color = "primary"),
#actionButton("RunStep10", "Run Step10"),
div(class = "spacer"),
uiOutput("runningStep10"),
div(class = "spacer"),
uiOutput("step10_completed")),
column(
4, align = "left",
h3("Browse files in Step 10. Calculate Lineage Scores:"),
uiOutput("Step10.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("step10_plot", width='auto',height = "500px"),
textOutput("step10_text"))
)
step11_fluidRow <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 11. GSVA"),
#p("Please input the parameters for GSVA."),
selectInput("Step11_GSVA.identify.cellType.features", "Option to identify cell type-specific GSVA terms:", choices = c("TRUE" = TRUE, "FALSE" = FALSE)),
selectInput("Step11_GSVA.identify.diff.features", "Option to identify differential GSVA terms:", choices = c("TRUE" = TRUE, "FALSE" = FALSE)),
textInput("Step11_GSVA.comparison.design",
HTML('The comparison design for GSVA<br>
e.g. list(
list(c("sample1","sample2"),
c("sample3","sample4")),<br>
list(c("sample5","sample6"),
c("sample7","sample8")))<br>
which indicates "sample1 and sample2 vs sample 3 and sample4",<br>
and "sample5 and sample6 vs sample 7 and sample8" :'),
value = "NULL"),
actionBttn("RunStep11", "Run Step11",style = "unite",color = "primary"),
#actionButton("RunStep11", "Run Step11"),
div(class = "spacer"),
uiOutput("runningStep11"),
div(class = "spacer"),
uiOutput("step11_completed")),
column(
4, align = "left",
h3("Browse files in Step 11. GSVA:"),
uiOutput("Step11.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("step11_plot", width='auto',height = "500px"),
textOutput("step11_text"))
)
step12_fluidRow <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 12. Construct Trajectories"),
textInput("Step12_Construct_Trajectories.clusters",
"Set the cell types for constructing trajectories(seperate by ',' default is 'all'):", value = "all"),
# monocle
h4("Set the parameters for monocle2",style = "font-weight: bold; margin-top: 15px; margin-bottom: 15px;"),
selectInput("Step12_Construct_Trajectories.monocle", "Option to run monocle2:",
choices = c("TRUE" = TRUE, "FALSE" = FALSE)),
# slingshot
h4("Set the parameters for slingshot",style = "font-weight: bold; margin-top: 15px; margin-bottom: 15px;"),
selectInput("Step12_Construct_Trajectories.slingshot", "Option to run slingshot:",
choices = c("TRUE" = TRUE, "FALSE" = FALSE)),
textInput("slingshot.start.clus", "Set the root clusters:", value = "NULL"),
textInput("slingshot.end.clus", "Set the tip clusters:", value = "NULL"),
textInput("slingshot.colors", "Set the hexadecimal codes of colors for clusters (seperate by ','):",
value = "NULL"),
# scVelo
h4("Set the parameters for scVelo",style = "font-weight: bold; margin-top: 15px; margin-bottom: 15px;"),
selectInput("Step12_Construct_Trajectories.scVelo", "Option to run scVelo:",
choices = c("TRUE" = TRUE, "FALSE" = FALSE)),
textInput("loom.files.path", "Enter the paths of loom files (seperate by ';'):", value = "NULL"),
actionBttn("RunStep12", "Run Step12",style = "unite",color = "primary"),
#actionButton("RunStep12", "Run Step12"),
div(class = "spacer"),
uiOutput("runningStep12"),
div(class = "spacer"),
uiOutput("Step12_completed")),
column(
4, align = "left",
h3("Browse files in Step 12. Construct Trajectories:"),
uiOutput("Step12.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("step12_plot", width='auto',height = "500px"),
textOutput("step12_text"))
)
step13_fluidRow <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 13. Transcription Factors Analysis"),
#p("Please input the parameters for TF analysis."),
textInput("Step13_TF_Analysis.cellTypes_colors", "Set the hexadecimal codes of colors for cell types (seperate by ','):", value = "NULL"),
textInput("Step13_TF_Analysis.groups_colors", "Set the hexadecimal codes of colors for groups (seperate by ','):", value = "NULL"),
actionBttn("RunStep13", "Run Step13",style = "unite",color = "primary"),
#actionButton("RunStep13", "Run Step13"),
div(class = "spacer"),
uiOutput("runningStep13"),
div(class = "spacer"),
uiOutput("step13_completed")),
column(
4, align = "left",
h3("Browse files in Step 13. Transcription Factors Analysis:"),
uiOutput("Step13.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("step13_plot", width='auto',height = "500px"),
textOutput("step13_text"))
)
step14_fluidRow <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 14. Cell-Cell Interaction"),
#p("Please input the parameters for cell-cell interaction analysis."),
selectInput("sorting", "The cell groups were sorted?:", choices = c("TRUE" = TRUE, "FALSE" = FALSE)),
actionBttn("RunStep14", "Run Step14",style = "unite",color = "primary"),
#actionButton("RunStep14", "Run Step14"),
div(class = "spacer"),
uiOutput("runningStep14"),
div(class = "spacer"),
uiOutput("step14_completed")),
column(
4, align = "left",
h3("Browse files in Step 14. Cell-Cell Interection:"),
uiOutput("Step14.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("step14_plot", width='auto',height = "500px"),
textOutput("step14_text"))
)
step15_fluidRow <- fluidRow(
style = "margin-left: 10px;",
column(
6, align = "left", h3("Step 15. Generate the Report"),
#p("Please input the parameters for generating the report."),
actionBttn("RunStep15", "Run Step15",style = "unite",color = "primary"),
#actionButton("RunStep15", "Run Step15"),
div(class = "spacer"),
uiOutput("runningStep15"),
div(class = "spacer"),
uiOutput("step15_completed"))
)
#ST UI step1-11
step1_fluidRow_st <- fluidRow(
style = "margin-left: 10px;",
column(
6, align = "left", h3("Step 1. Input Data"),
#p("Please select the input data."),
textInput("input.data.dir", HTML("Enter data path:"), value = "NULL"),
textInput("sampleName", "Enter sample name:", value = "Hema_ST"),
textInput("output.dir", "Enter output path:", value = "NULL"),
textInput("pythonPath", "Enter the path of Python:", value = "NULL"),
actionBttn("RunStep1_st", "Load Data",style = "unite",color = "primary"),
#actionButton("load_data_button", "Load Data"),
div(class = "spacer"),
uiOutput("loadingData"),
uiOutput("step1_completed")),
column(3,align="middle",
h3("Please record your job ID for use in future analyses"),
#p("Please copy your jobid and you will use it in subsequent analysis"),
textOutput("st_jobid_1"))
)
step2_fluidRow_st <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 2. Quality Control"),
#p("Please input the parameters for quality control and preprocessing."),
numericInput("min.gene", "min.gene (default: 200):", value = 200),
numericInput("min.nUMI", "min.nUMI (default: 500):", value = 500),
numericInput("max.gene", "max.gene (default: Inf):", value = Inf),
numericInput("max.nUMI", "max.nUMI (default: Inf):", value = Inf),
numericInput("min.spot", "min.spot (default: 0):", value = 0),
selectInput("bool.remove.mito", "bool.remove.mito:", choices = c("FALSE" = FALSE, "TRUE" = TRUE)),
selectInput("species", "species:", choices = c("mouse" = "mouse", "human" = "human")),
actionBttn("RunStep2_st", "Run Step2",style = "unite",color = "primary"),
#actionButton("RunStep2", "Run Step2"),
div(class = "spacer"),
uiOutput("runningStep2"),
div(class = "spacer"),
uiOutput("step2_completed")),
column(
4, align = "left",
h3("Browse files in Step 2. Quality Control:"),
uiOutput("Step2.st.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("st_step2_plot", width='auto',height = "500px"),
textOutput("st_step2_text"))
)
step3_fluidRow_st <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 3. Clustering"),
#p("Please input the parameters for normalization, PCA and clustering."),
textInput("normalization.method", "normalization.method (default: 'SCTransform'):", value = "SCTransform"),
numericInput("npcs", "npcs (default: 50):", value = 50),
textInput("pcs.used", "pcs.used (default: 1:10):", value = "1:10"),
numericInput("resolution", "resolution (default: 0.8):", value = 0.8),
actionBttn("RunStep3_st", "Run Step3",style = "unite",color = "primary"),
#actionButton("RunStep3", "Run Step3"),
div(class = "spacer"),
uiOutput("runningStep3"),
div(class = "spacer"),
uiOutput("step3_completed")),
column(
4, align = "left",
h3("Browse files in Step 3. Clustering:"),
uiOutput("Step3.st.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("st_step3_plot", width='auto',height = "500px"),
textOutput("st_step3_text"))
)
step4_fluidRow_st <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 4. Find Differential Genes"),
#p("Please input the parameters for finding differentially expressed genes in each cluster."),
selectInput("only.pos", "only.pos:", choices = c("FALSE" = FALSE, "TRUE" = TRUE)),
numericInput("min.pct", "min.pct (default: 0.25):", value = 0.25),
numericInput("logfc.threshold", "logfc.threshold (default: 0.25):", value = 0.25),
textInput("test.use", "test.use (default: 'wilcox'):", value = 'wilcox'),
actionBttn("RunStep4_st", "Run Step4",style = "unite",color = "primary"),
#actionButton("RunStep4", "Run Step4"),
div(class = "spacer"),
uiOutput("runningStep4"),
div(class = "spacer"),
uiOutput("step4_completed")),
column(
4, align = "left",
h3("Browse files in Step 4. Find Differential Genes:"),
uiOutput("Step4.st.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("st_step4_plot", width='auto',height = "500px"),
textOutput("st_step4_text"))
)
step5_fluidRow_st <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 5. Spatially variable features"),
#p("Please input the parameters for finding spatially variable features."),
textInput("selection.method", "selection.method (default: 'moransi'):", value = 'moransi'),
numericInput("n.top.show", "n.top.show (default: 10):", value = 10),
numericInput("n.col.show", "n.col.show (default: 5):", value = 5),
actionBttn("RunStep5_st", "Run Step5",style = "unite",color = "primary"),
#actionButton("RunStep5", "Run Step5"),
div(class = "spacer"),
uiOutput("runningStep5"),
div(class = "spacer"),
uiOutput("step5_completed")),
column(
4, align = "left",
h3("Browse files in Step 5. Spatially variable features:"),
uiOutput("Step5.st.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("st_step5_plot", width='auto',height = "500px"),
textOutput("st_step5_text"))
)
step6_fluidRow_st <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 6. Spatial interaction"),
#p("Please input the parameters for analyzing spatial interaction."),
textInput("commot.signaling_type", "commot.signaling_type (default: 'Secreted Signaling'):", value = 'Secreted Signaling'),
textInput("commot.database", "commot.database (default: 'CellChat'):", value = 'CellChat'),
numericInput("commot.min_cell_pct", "commot.min_cell_pct (default: 0.05):", value = 0.05),
numericInput("commot.dis_thr", "commot.dis_thr (default: 500):", value = 500),
numericInput("commot.n_permutations", "commot.n_permutations (default: 100):", value = 100),
actionBttn("RunStep6_st", "Run Step6",style = "unite",color = "primary"),
#actionButton("RunStep6", "Run Step6"),
div(class = "spacer"),
uiOutput("runningStep6"),
div(class = "spacer"),
uiOutput("step6_completed")),
column(
4, align = "left",
h3("Browse files in Step 6. Spatial interaction:"),
uiOutput("Step6.st.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("st_step6_plot", width='auto',height = "500px"),
textOutput("st_step6_text"))
)
step7_fluidRow_st <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 7. CNV analysis"),
#p("Please input the parameters for CNV analysis."),
textInput("copykat.genome", "copykat.genome (default: 'hg20'):", value = 'hg20'),
numericInput("copykat.LOW.DR", "copykat.LOW.DR (default: 0.05):", value = 0.05),
numericInput("copykat.UP.DR", "copykat.UP.DR (default: 0.1):", value = 0.1),
numericInput("copykat.win.size", "copykat.win.size (default: 25):", value = 25),
textInput("copykat.distance", "copykat.distance (default: 'euclidean'):", value = 'euclidean'),
numericInput("copykat.n.cores", "copykat.n.cores (default: 1):", value = 1),
actionBttn("RunStep7_st", "Run Step7",style = "unite",color = "primary"),
#actionButton("RunStep7", "Run Step7"),
div(class = "spacer"),
uiOutput("runningStep7"),
div(class = "spacer"),
uiOutput("step7_completed")),
column(
4, align = "left",
h3("Browse files in Step 7. CNV analysis:"),
uiOutput("Step7.st.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("st_step7_plot", width='auto',height = "500px"),
textOutput("st_step7_text"))
)
step8_fluidRow_st <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 8. Deconvolution"),
#p("Please input the parameters for deconvolution."),
textInput("cell2loc.sc.h5ad.dir", "cell2loc.sc.h5ad.dir (default: 'NULL'):", value = 'NULL'),
numericInput("cell2loc.sc.max.epoch", "cell2loc.sc.max.epoch (default: 1000):", value = 1000),
numericInput("cell2loc.st.max.epoch", "cell2loc.st.max.epoch (default: 10000):", value = 10000),
selectInput("cell2loc.use.gpu", "cell2loc.use.gpu (default: FALSE):", choices = c("FALSE" = FALSE, "TRUE" = TRUE)),
actionBttn("RunStep8_st", "Run Step8",style = "unite",color = "primary"),
#actionButton("RunStep8", "Run Step8"),
div(class = "spacer"),
uiOutput("runningStep8"),
div(class = "spacer"),
uiOutput("step8_completed")),
column(
4, align = "left",
h3("Browse files in Step 8. Deconvolution:"),
uiOutput("Step8.st.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("st_step8_plot", width='auto',height = "500px"),
textOutput("st_step8_text"))
)
step9_fluidRow_st <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 9. Cell cycle analysis"),
#p("Please input the parameters for cell cycle analysis."),
textInput("s.features", HTML('The gene sets for calculating S phase scores(e.g. "gene1,gene2,gene3"):'), value = "NULL"),
textInput("g2m.features", HTML('The gene sets for calculating G2M phase scores(e.g. "gene1,gene2,gene3"):'), value = "NULL"),
actionBttn("RunStep9_st", "Run Step9",style = "unite",color = "primary"),
#actionButton("RunStep9", "Run Step9"),
div(class = "spacer"),
uiOutput("runningStep9"),
div(class = "spacer"),
uiOutput("step9_completed")),
column(
4, align = "left",
h3("Browse files in Step 9. Cell cycle analysis:"),
uiOutput("Step9.st.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("st_step9_plot", width='auto',height = "500px"),
textOutput("st_step9_text"))
)
step10_fluidRow_st <- fluidRow(
style = "margin-left: 10px;",
column(
4, align = "left", h3("Step 10. Niche analysis"),
#p("Please input the parameters for niche analysis (Please run step 8 deconvolution first)."),
numericInput("Nich.cluster.n", "Nich.cluster.n (default: 4):", value = 4),
actionBttn("RunStep10_st", "Run Step10",style = "unite",color = "primary"),
#actionButton("RunStep10", "Run Step10"),
div(class = "spacer"),
uiOutput("runningStep10"),
div(class = "spacer"),
uiOutput("step10_completed")),
column(
4, align = "left",
h3("Browse files in Step 10. Niche analysis:"),
uiOutput("Step10.st.file_list")),
column(4, align = "left",
h3("Important Results Figure"),
slickROutput("st_step10_plot", width='auto',height = "500px"),
textOutput("st_step10_text"))
)
step11_fluidRow_st <- fluidRow(
style = "margin-left: 10px;",
column(
6, align = "left", h3("Step 11. Generate the Report"),
actionBttn("RunStep11_st", "Run Step11",style = "unite",color = "primary"),
#actionButton("RunStep11", "Run Step11"),
div(class = "spacer"),
uiOutput("runningStep11"),
div(class = "spacer"),
uiOutput("step11_completed"))
)
# server---------------------------------------------------------------------------------------------------------------------------------
server = function(input, output, session){
output$logo <- renderImage({
list(src = '../images/HemaScope_logo.png',width="80%") #加载特定位置下的图片
}, deleteFile = FALSE) #加载后不删除
output$ui_styles <- renderUI({
tags$style(HTML("
#logo img {
max-width: 500px;
height: auto;
margin-left: -0px;
margin-bottom: -350px;
}
.h1-font {
font-size: 35px;
}
.main-panel {
margin-top: 100px; /* 调整上边距 */
margin-bottom: 100px;
}
.spacer {
margin-bottom: 10px; /* 缩小空行的间距 */
}
"))
})