@@ -20,6 +20,7 @@ app_server <- function(input, output, session) {
20
20
cav_list <- NULL
21
21
result_toml <- NULL
22
22
protein_rep_list <- c()
23
+ cav_rep_list <- c()
23
24
pdb_processed <- NULL
24
25
pdb_ligand_processed <- NULL
25
26
run_mode_list <- c()
@@ -58,17 +59,52 @@ app_server <- function(input, output, session) {
58
59
observeEvent(input $ input_pdb , {
59
60
# run process_upload of mod_server_upload module to create boxes and buttons of run mode
60
61
process_upload(input = input , output = output , session = session )
62
+ get_nonstand_check_upload <<- report_nonstand(pdb_input = input $ input_pdb $ datapath )
61
63
})
64
+
65
+ observeEvent(input $ show_preview_upload , {
66
+ print(input $ input_pdb $ datapath )
67
+ print(pdb_name_click_load )
68
+ print(get_nonstand )
69
+ showModal(modalDialog(
70
+ # title = tags$a('Structure preview', style = "text-align: right;" ),
71
+ # NGLVieweROutput("structure_prev", width = "100%", height = "75vh"),
72
+ if (! is.null(input $ input_pdb )){
73
+ # print(get_nonstand_check)
74
+ renderNGLVieweR({
75
+ # get input protein PDB with output cavities
76
+ pdb <- input $ input_pdb $ datapath
77
+ # create initial scene
78
+ NGLVieweR(pdb ) %> %
79
+ # start protein with visible cartoon representation
80
+ addRepresentation(" cartoon" ) %> %
81
+ addRepresentation(" ball+stick" , param = list (sele = paste(get_nonstand_check_upload , collapse = " or " ))) %> %
82
+ # start cavity with points
83
+ stageParameters(backgroundColor = " black" ) %> %
84
+ setQuality(" high" ) %> %
85
+ setFocus(0 )
86
+ })
87
+ }else {
88
+ " No loaded structure to preview"
89
+ },
90
+ easyClose = TRUE ,
91
+ footer = NULL ,
92
+ size = ' l'
93
+ ))
94
+ })
95
+
62
96
# -----------------------------------------------------
63
97
64
98
# -----------------------------------------------------
65
99
# Fetch PDB section
66
100
observeEvent(input $ send_pdb_id , {
101
+ print(input $ pdb_id )
67
102
# save number of clicks in load button
68
103
pdb_name_click_load <<- input $ pdb_id
69
104
# check if the PDB code is valid by using get_nonstand
70
105
showModal(modalDialog(" Loading and checking PDB..." , footer = NULL , fade = FALSE ))
71
- get_nonstand_check <- report_nonstand(pdb_input = input $ pdb_id )
106
+ get_nonstand_check <<- report_nonstand(pdb_input = input $ pdb_id )
107
+ print(get_nonstand_check )
72
108
removeModal()
73
109
if (length(which(is.na(get_nonstand_check ))) != 0 ) {
74
110
shinyWidgets :: sendSweetAlert(session = session , title = " Oops!" , text = " Please insert a valid PDB ID." , type = " error" )
@@ -80,6 +116,35 @@ app_server <- function(input, output, session) {
80
116
# process_fetch(input = input, output = output)
81
117
})
82
118
119
+ observeEvent(input $ show_preview_fetch , {
120
+ print(pdb_name_click_load )
121
+ showModal(modalDialog(
122
+ # title = tags$a('Structure preview', style = "text-align: right;" ),
123
+ # NGLVieweROutput("structure_prev", width = "100%", height = "75vh"),
124
+ if (pdb_name_click_load != ' init' ){
125
+ print(get_nonstand_check )
126
+ renderNGLVieweR({
127
+ # get input protein PDB with output cavities
128
+ pdb <- input $ pdb_id
129
+ # create initial scene
130
+ NGLVieweR(pdb ) %> %
131
+ # start protein with visible cartoon representation
132
+ addRepresentation(" cartoon" ) %> %
133
+ addRepresentation(" ball+stick" , param = list (sele = paste(get_nonstand_check , collapse = " or " ))) %> %
134
+ # start cavity with points
135
+ stageParameters(backgroundColor = " black" ) %> %
136
+ setQuality(" high" ) %> %
137
+ setFocus(0 )
138
+ })
139
+ }else {
140
+ " No loaded structure to preview"
141
+ },
142
+ easyClose = TRUE ,
143
+ footer = NULL ,
144
+ size = ' l'
145
+ ))
146
+ })
147
+
83
148
# ----------------------------------------------------
84
149
# >>>>>>>>>>>>>> Submit Job <<<<<<<<<<<<<<<<<<<<<<<
85
150
observeEvent(input $ submit_button , {
@@ -170,6 +235,14 @@ app_server <- function(input, output, session) {
170
235
id = " fullscreen_title" ,
171
236
time = 0
172
237
)
238
+ hideElement(
239
+ id = " cavity_rep" ,
240
+ time = 0
241
+ )
242
+ hideElement(
243
+ id = " cavity_deep" ,
244
+ time = 0
245
+ )
173
246
}
174
247
})
175
248
# ----------------------------------------------------
@@ -272,6 +345,14 @@ app_server <- function(input, output, session) {
272
345
id = " fullscreen_title_pg2" ,
273
346
time = 0
274
347
)
348
+ hideElement(
349
+ id = " cavity_rep_pg2" ,
350
+ time = 0
351
+ )
352
+ hideElement(
353
+ id = " cavity_deep_pg2" ,
354
+ time = 0
355
+ )
275
356
})
276
357
# ----------------------------------------------------
277
358
@@ -283,6 +364,7 @@ app_server <- function(input, output, session) {
283
364
observeEvent(input $ view_str ,
284
365
{
285
366
protein_rep_list <<- c() # always initialize an empty list of protein representations when clicking on view button
367
+ cav_rep_list <<- c()
286
368
protein_col_scheme_list <<- c() # always initialize an empty list of protein color scheme when clicking on view button
287
369
# use "residue index" as the first protein color scheme
288
370
protein_col_scheme_list <<- c(protein_col_scheme_list , " Residue index" )
@@ -337,6 +419,14 @@ app_server <- function(input, output, session) {
337
419
id = " fullscreen_title" ,
338
420
time = 0
339
421
)
422
+ showElement(
423
+ id = " cavity_rep" ,
424
+ time = 0
425
+ )
426
+ showElement(
427
+ id = " cavity_deep" ,
428
+ time = 0
429
+ )
340
430
# disable view button to avoid user to click on it multiple times
341
431
disable(" view_str" )
342
432
},
@@ -352,7 +442,7 @@ app_server <- function(input, output, session) {
352
442
# fed the protein list of representations
353
443
protein_rep_list <<- c(protein_rep_list , current_rep )
354
444
# Create the work scene
355
- create_work_scene(input = input , output = output , protein_rep_list = protein_rep_list , protein_col_list = protein_col_list , protein_col_scheme_list = protein_col_scheme_list , result_pdb_list = result_pdb , is_pg2 = FALSE , scheme_color_list = scheme_color_list )
445
+ create_work_scene(input = input , output = output , protein_rep_list = protein_rep_list , protein_col_list = protein_col_list , protein_col_scheme_list = protein_col_scheme_list , result_pdb_list = result_pdb , is_pg2 = FALSE , scheme_color_list = scheme_color_list , prot_or_cav = ' prot ' , cav_rep_list = ' ' )
356
446
# clean protein color selector
357
447
updateSelectInput(session , " input_protein_color" , # This update is made to clean the protein color selector
358
448
selected = " "
@@ -361,11 +451,38 @@ app_server <- function(input, output, session) {
361
451
ignoreNULL = TRUE ,
362
452
ignoreInit = TRUE
363
453
)
454
+
455
+ # Create a work scene every time users click on cavity representation selector and change biomolecular structure representation
456
+ observeEvent(input $ input_cavity_rep ,
457
+ {
458
+ # save the current representation
459
+ current_rep_cav <- input $ input_cavity_rep
460
+ # fed the protein list of representations
461
+ cav_rep_list <<- c(cav_rep_list , current_rep_cav )
462
+ print(cav_rep_list )
463
+ # Create the work scene
464
+ create_work_scene(input = input , output = output , protein_rep_list = protein_rep_list , protein_col_list = protein_col_list , protein_col_scheme_list = protein_col_scheme_list , result_pdb_list = result_pdb , is_pg2 = FALSE , scheme_color_list = scheme_color_list , prot_or_cav = ' cav' , cav_rep_list = cav_rep_list )
465
+ # clean protein color selector
466
+ # updateSelectInput(session, "input_protein_color", # This update is made to clean the protein color selector
467
+ # selected = ""
468
+ # )
469
+ },
470
+ ignoreNULL = TRUE ,
471
+ ignoreInit = TRUE
472
+ )
473
+
364
474
365
475
# Select cavity to be visualized from clicking on cavity selector button
366
476
observeEvent(input $ select_cavity , {
477
+ print(' exeuting select' )
367
478
select_cav(input = input , output = output , result_pdb_list = result_pdb , is_pg2 = FALSE )
368
479
})
480
+
481
+ observeEvent(input $ interface_res , {
482
+ print(' exeuting select' )
483
+ interface_cav(input = input , output = output , result_pdb_list = result_pdb , is_pg2 = FALSE )
484
+ })
485
+
369
486
370
487
# change biomolecular structure color
371
488
observeEvent(input $ input_protein_color , {
@@ -385,7 +502,7 @@ app_server <- function(input, output, session) {
385
502
386
503
# change cavity color
387
504
observeEvent(input $ input_cavity_color , {
388
- change_cav_color(input = input , output = output , is_pg2 = FALSE )
505
+ change_cav_color(input = input , output = output , is_pg2 = FALSE , cav_rep_list = cav_rep_list )
389
506
})
390
507
391
508
# change background color
@@ -397,6 +514,10 @@ app_server <- function(input, output, session) {
397
514
observeEvent(input $ input_snapshot , {
398
515
take_snapshot(input = input , output = output , is_pg2 = FALSE )
399
516
})
517
+
518
+ observeEvent(input $ input_cavity_deep , {
519
+ color_cavity_deepth(input = input , output = output , is_pg2 = FALSE , cav_rep_list = cav_rep_list ,result_pdb_list = result_pdb )
520
+ })
400
521
401
522
402
523
# #### View in Get latest results page (pg2)
@@ -463,6 +584,14 @@ app_server <- function(input, output, session) {
463
584
id = " fullscreen_title_pg2" ,
464
585
time = 0
465
586
)
587
+ showElement(
588
+ id = " cavity_rep_pg2" ,
589
+ time = 0
590
+ )
591
+ showElement(
592
+ id = " cavity_deep_pg2" ,
593
+ time = 0
594
+ )
466
595
disable(" view_str_pg2" )
467
596
})
468
597
@@ -476,7 +605,7 @@ app_server <- function(input, output, session) {
476
605
# create a list of representations
477
606
protein_rep_list <<- c(protein_rep_list , current_rep )
478
607
# Create work scene
479
- create_work_scene(input = input , output = output , protein_rep_list = protein_rep_list , protein_col_list = protein_col_list , protein_col_scheme_list = protein_col_scheme_list , result_pdb_list = result_pdb , is_pg2 = TRUE , scheme_color_list = scheme_color_list )
608
+ create_work_scene(input = input , output = output , protein_rep_list = protein_rep_list , protein_col_list = protein_col_list , protein_col_scheme_list = protein_col_scheme_list , result_pdb_list = result_pdb , is_pg2 = TRUE , scheme_color_list = scheme_color_list , prot_or_cav = ' prot ' , cav_rep_list = ' ' )
480
609
481
610
# clean protein color selector
482
611
updateSelectInput(session , " input_protein_color_pg2" , # This updation is made to clean the protein color selector
@@ -486,6 +615,28 @@ app_server <- function(input, output, session) {
486
615
ignoreNULL = TRUE ,
487
616
ignoreInit = FALSE
488
617
)
618
+
619
+
620
+ # Create a work scene every time users click on cavity representation selector and change biomolecular structure representation
621
+ observeEvent(input $ input_cavity_rep_pg2 ,
622
+ {
623
+ print(' Inside cav rep pg2' )
624
+ # save the current representation
625
+ current_rep_cav <- input $ input_cavity_rep_pg2
626
+ # fed the protein list of representations
627
+ cav_rep_list <<- c(cav_rep_list , current_rep_cav )
628
+ # print(cav_rep_list)
629
+ # Create the work scene
630
+ create_work_scene(input = input , output = output , protein_rep_list = protein_rep_list , protein_col_list = protein_col_list , protein_col_scheme_list = protein_col_scheme_list , result_pdb_list = result_pdb , is_pg2 = TRUE , scheme_color_list = scheme_color_list , prot_or_cav = ' cav' , cav_rep_list = cav_rep_list )
631
+ # clean protein color selector
632
+ # updateSelectInput(session, "input_protein_color", # This update is made to clean the protein color selector
633
+ # selected = ""
634
+ # )
635
+ },
636
+ ignoreNULL = TRUE ,
637
+ ignoreInit = TRUE
638
+ )
639
+
489
640
490
641
# Select cavity to be visualized from clicking on cavity selector button
491
642
observeEvent(input $ select_cavity_pg2 , {
@@ -508,7 +659,7 @@ app_server <- function(input, output, session) {
508
659
})
509
660
# change cavity color
510
661
observeEvent(input $ input_cavity_color_pg2 , {
511
- change_cav_color(input = input , output = output , is_pg2 = TRUE )
662
+ change_cav_color(input = input , output = output , is_pg2 = TRUE , cav_rep_list = cav_rep_list )
512
663
})
513
664
# change background color
514
665
observeEvent(input $ input_bg_color_pg2 , {
@@ -518,6 +669,10 @@ app_server <- function(input, output, session) {
518
669
observeEvent(input $ input_snapshot_pg2 , {
519
670
take_snapshot(input = input , output = output , is_pg2 = TRUE )
520
671
})
672
+
673
+ observeEvent(input $ input_cavity_deep_pg2 , {
674
+ color_cavity_deepth(input = input , output = output , is_pg2 = TRUE , cav_rep_list = cav_rep_list ,result_pdb_list = result_pdb )
675
+ })
521
676
522
677
# ----------------------------------------------------
523
678
}
0 commit comments