isolating observeevent()s
This commit is contained in:
parent
4cdcebb0b2
commit
615aa57d42
1 changed files with 421 additions and 421 deletions
|
@ -651,425 +651,425 @@ if (interactive()){
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
server <- function(input, output, session) {
|
# server <- function(input, output, session) {
|
||||||
|
#
|
||||||
#output$LogoPlotSnps = renderPlot(LogoPlotSnps(mutable_df3))
|
# #output$LogoPlotSnps = renderPlot(LogoPlotSnps(mutable_df3))
|
||||||
output$lin_sc = renderPlot(
|
# output$lin_sc = renderPlot(
|
||||||
lin_sc(
|
# lin_sc(
|
||||||
input$switch_target,
|
# input$switch_target,
|
||||||
all_lineages = input$all_lineages,
|
# all_lineages = input$all_lineages,
|
||||||
my_xats = 12, # x axis text size
|
# my_xats = 12, # x axis text size
|
||||||
my_yats = 12, # y axis text size
|
# my_yats = 12, # y axis text size
|
||||||
my_xals = 12, # x axis label size
|
# my_xals = 12, # x axis label size
|
||||||
my_yals = 12, # y axis label size
|
# my_yals = 12, # y axis label size
|
||||||
my_lls = 12, # legend label size
|
# my_lls = 12, # legend label size
|
||||||
d_lab_size = 4
|
# d_lab_size = 4
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
#### lineage_distP ####
|
# #### lineage_distP ####
|
||||||
output$lineage_distP = renderPlot(
|
# output$lineage_distP = renderPlot(
|
||||||
lineage_distP(
|
# lineage_distP(
|
||||||
get(paste0(input$switch_target, '_merged_df2')),
|
# get(paste0(input$switch_target, '_merged_df2')),
|
||||||
all_lineages = input$all_lineages,
|
# all_lineages = input$all_lineages,
|
||||||
x_lab = "Average Stability",
|
# x_lab = "Average Stability",
|
||||||
x_axis = "avg_stability_scaled",
|
# x_axis = "avg_stability_scaled",
|
||||||
fill_categ_cols = c("red", "blue")
|
# fill_categ_cols = c("red", "blue")
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
|
#
|
||||||
|
#
|
||||||
#### observeEvent() Fun(tm) ####
|
# #### observeEvent() Fun(tm) ####
|
||||||
observeEvent(input$clear_ngl, {
|
# observeEvent(input$clear_ngl, {
|
||||||
NGLVieweR_proxy("structure") %>%
|
# NGLVieweR_proxy("structure") %>%
|
||||||
removeSelection("Pos")
|
# removeSelection("Pos")
|
||||||
})
|
# })
|
||||||
# Button to test adding a position
|
# # Button to test adding a position
|
||||||
observeEvent(input$test_ngl, {
|
# observeEvent(input$test_ngl, {
|
||||||
NGLVieweR_proxy("structure") %>%
|
# NGLVieweR_proxy("structure") %>%
|
||||||
addSelection('ball+stick'
|
# addSelection('ball+stick'
|
||||||
, param = list(
|
# , param = list(
|
||||||
name = "Pos"
|
# name = "Pos"
|
||||||
, sele = "35"
|
# , sele = "35"
|
||||||
, color = "green")
|
# , color = "green")
|
||||||
)
|
# )
|
||||||
})
|
# })
|
||||||
|
#
|
||||||
observeEvent(
|
# observeEvent(
|
||||||
{
|
# {
|
||||||
input$display_position_range
|
# input$display_position_range
|
||||||
input$stability_snp_param
|
# input$stability_snp_param
|
||||||
input$logoplot_colour_scheme
|
# input$logoplot_colour_scheme
|
||||||
input$omit_snp_count
|
# input$omit_snp_count
|
||||||
input$switch_target
|
# input$switch_target
|
||||||
input$snp_ligand_dist
|
# input$snp_ligand_dist
|
||||||
input$snp_nca_dist
|
# input$snp_nca_dist
|
||||||
input$snp_interface_dist
|
# input$snp_interface_dist
|
||||||
},
|
# },
|
||||||
{
|
# {
|
||||||
print("entering main observeEvent()")
|
# print("entering main observeEvent()")
|
||||||
# C O M P A T I B I L I T Y
|
# # C O M P A T I B I L I T Y
|
||||||
#gene=input$switch_target
|
# #gene=input$switch_target
|
||||||
#drug=target_map[[gene]]
|
# #drug=target_map[[gene]]
|
||||||
target_gene = input$switch_target
|
# target_gene = input$switch_target
|
||||||
merged_df3 = cbind(get(paste0(input$switch_target, '_merged_df3')))
|
# merged_df3 = cbind(get(paste0(input$switch_target, '_merged_df3')))
|
||||||
|
#
|
||||||
position_max=max(merged_df3[['position']])
|
# position_max=max(merged_df3[['position']])
|
||||||
position_min=min(merged_df3[['position']])
|
# position_min=min(merged_df3[['position']])
|
||||||
min_ligand_distance=min(merged_df3$ligand_distance)
|
# min_ligand_distance=min(merged_df3$ligand_distance)
|
||||||
max_ligand_distance=max(merged_df3$ligand_distance)
|
# max_ligand_distance=max(merged_df3$ligand_distance)
|
||||||
# FIXME: these are IMPORTANT
|
# # FIXME: these are IMPORTANT
|
||||||
# # add "pos_count" position count column
|
# # # add "pos_count" position count column
|
||||||
# merged_df3=merged_df3 %>% dplyr::add_count(position)
|
# # merged_df3=merged_df3 %>% dplyr::add_count(position)
|
||||||
# merged_df3$pos_count=merged_df3$n
|
# # merged_df3$pos_count=merged_df3$n
|
||||||
# merged_df3$n=NULL
|
# # merged_df3$n=NULL
|
||||||
#
|
# #
|
||||||
mutable_df3 = cbind(merged_df3)
|
# mutable_df3 = cbind(merged_df3)
|
||||||
#
|
# #
|
||||||
# # re-sort the dataframe according to position count
|
# # # re-sort the dataframe according to position count
|
||||||
sorted_df = cbind(merged_df3)
|
# sorted_df = cbind(merged_df3)
|
||||||
sorted_df = sorted_df %>% arrange(pos_count)
|
# sorted_df = sorted_df %>% arrange(pos_count)
|
||||||
|
#
|
||||||
#
|
# #
|
||||||
outdir = paste0(load_dir, "Data/", drug, '/output/')
|
# outdir = paste0(load_dir, "Data/", drug, '/output/')
|
||||||
indir = paste0(load_dir, "Data/", drug , "/input/")
|
# indir = paste0(load_dir, "Data/", drug , "/input/")
|
||||||
|
#
|
||||||
|
#
|
||||||
#### nasty special-purpose merged_df3 variants ####
|
# #### nasty special-purpose merged_df3 variants ####
|
||||||
# FIXME: SLOW
|
# # FIXME: SLOW
|
||||||
# corr_plotdf = corr_data_extract(
|
# # corr_plotdf = corr_data_extract(
|
||||||
# merged_df3
|
# # merged_df3
|
||||||
# , gene = gene
|
# # , gene = gene
|
||||||
# , drug = drug
|
# # , drug = drug
|
||||||
# , extract_scaled_cols = F
|
# # , extract_scaled_cols = F
|
||||||
# )
|
# # )
|
||||||
|
#
|
||||||
#input$stability_snp_param
|
# #input$stability_snp_param
|
||||||
|
#
|
||||||
updateCheckboxGroupInput(
|
# updateCheckboxGroupInput(
|
||||||
session,
|
# session,
|
||||||
"corr_selected",
|
# "corr_selected",
|
||||||
choiceNames = colnames(get(paste0(input$switch_target,"_corr_df_m3_f"))),
|
# choiceNames = colnames(get(paste0(input$switch_target,"_corr_df_m3_f"))),
|
||||||
choiceValues = colnames(get(paste0(input$switch_target,"_corr_df_m3_f"))),
|
# choiceValues = colnames(get(paste0(input$switch_target,"_corr_df_m3_f"))),
|
||||||
selected = c("FoldX", "DeepDDG", "mCSM.DUET")
|
# selected = c("FoldX", "DeepDDG", "mCSM.DUET")
|
||||||
)
|
# )
|
||||||
|
#
|
||||||
updateSliderInput(
|
# updateSliderInput(
|
||||||
session,
|
# session,
|
||||||
"display_position_range",
|
# "display_position_range",
|
||||||
min = position_min,
|
# min = position_min,
|
||||||
max = position_max
|
# max = position_max
|
||||||
#, value = c(position_min, position_min+150)
|
# #, value = c(position_min, position_min+150)
|
||||||
)
|
# )
|
||||||
|
#
|
||||||
updateNumericInput(session, "selected_logop_snp_position", min = position_min, max = position_max, value = position_min)
|
# updateNumericInput(session, "selected_logop_snp_position", min = position_min, max = position_max, value = position_min)
|
||||||
updateNumericInput(session, "selected_logop_ed_position", min = position_min, max = position_max, value = position_min)
|
# updateNumericInput(session, "selected_logop_ed_position", min = position_min, max = position_max, value = position_min)
|
||||||
updateNumericInput(session, "corr_lig_dist", min = min_ligand_distance, max = max_ligand_distance, value = min_ligand_distance)
|
# updateNumericInput(session, "corr_lig_dist", min = min_ligand_distance, max = max_ligand_distance, value = min_ligand_distance)
|
||||||
|
#
|
||||||
updateNumericInput(session, "snp_ligand_dist", min = min(merged_df3$ligand_distance), max = max(merged_df3$ligand_distance))
|
# updateNumericInput(session, "snp_ligand_dist", min = min(merged_df3$ligand_distance), max = max(merged_df3$ligand_distance))
|
||||||
updateNumericInput(session, "snp_interface_dist", min = min(merged_df3$interface_dist), max = max(merged_df3$interface_dist))
|
# updateNumericInput(session, "snp_interface_dist", min = min(merged_df3$interface_dist), max = max(merged_df3$interface_dist))
|
||||||
updateNumericInput(session, "snp_nca_dist", min = min(merged_df3$nca_distance), max = max(merged_df3$nca_distance))
|
# updateNumericInput(session, "snp_nca_dist", min = min(merged_df3$nca_distance), max = max(merged_df3$nca_distance))
|
||||||
|
#
|
||||||
|
#
|
||||||
# different data ranges required for SNP distances
|
# # different data ranges required for SNP distances
|
||||||
snp_ligand_dist_df3 = merged_df3[merged_df3[['ligand_distance']]<input$snp_ligand_dist,]
|
# snp_ligand_dist_df3 = merged_df3[merged_df3[['ligand_distance']]<input$snp_ligand_dist,]
|
||||||
if ("interface_dist" %in% colnames(merged_df3)){
|
# if ("interface_dist" %in% colnames(merged_df3)){
|
||||||
snp_interface_dist_df3 = merged_df3[merged_df3[['interface_dist']]<input$snp_interface_dist,]
|
# snp_interface_dist_df3 = merged_df3[merged_df3[['interface_dist']]<input$snp_interface_dist,]
|
||||||
} else {
|
# } else {
|
||||||
snp_interface_dist_df3 = NULL
|
# snp_interface_dist_df3 = NULL
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
if ("nca_distance" %in% colnames(merged_df3)){
|
# if ("nca_distance" %in% colnames(merged_df3)){
|
||||||
snp_nca_dist_df3 = merged_df3[merged_df3[['nca_distance']]<input$snp_nca_dist,]
|
# snp_nca_dist_df3 = merged_df3[merged_df3[['nca_distance']]<input$snp_nca_dist,]
|
||||||
} else {
|
# } else {
|
||||||
snp_nca_dist_df3 = NULL
|
# snp_nca_dist_df3 = NULL
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
stability_colname = stability_boxes_df[stability_boxes_df$stability_type==input$stability_snp_param,"stability_colname"]
|
# stability_colname = stability_boxes_df[stability_boxes_df$stability_type==input$stability_snp_param,"stability_colname"]
|
||||||
outcome_colname = stability_boxes_df[stability_boxes_df$stability_type==input$stability_snp_param,"outcome_colname"]
|
# outcome_colname = stability_boxes_df[stability_boxes_df$stability_type==input$stability_snp_param,"outcome_colname"]
|
||||||
|
#
|
||||||
display_position_range = input$display_position_range
|
# display_position_range = input$display_position_range
|
||||||
plot_min=display_position_range[1]
|
# plot_min=display_position_range[1]
|
||||||
plot_max=display_position_range[2]
|
# plot_max=display_position_range[2]
|
||||||
|
#
|
||||||
logoplot_colour_scheme = input$logoplot_colour_scheme
|
# logoplot_colour_scheme = input$logoplot_colour_scheme
|
||||||
omit_snp_count = input$omit_snp_count
|
# omit_snp_count = input$omit_snp_count
|
||||||
|
#
|
||||||
print(paste0('Plotting positions between: ', plot_min, ' and ', plot_max))
|
# print(paste0('Plotting positions between: ', plot_min, ' and ', plot_max))
|
||||||
|
#
|
||||||
subset_mutable_df3=mutable_df3[(mutable_df3$position>=plot_min & mutable_df3$position <=plot_max),]
|
# subset_mutable_df3=mutable_df3[(mutable_df3$position>=plot_min & mutable_df3$position <=plot_max),]
|
||||||
|
#
|
||||||
subset_mutable_df3=mutable_df3[(mutable_df3$position>=plot_min & mutable_df3$position <=plot_max),]
|
# subset_mutable_df3=mutable_df3[(mutable_df3$position>=plot_min & mutable_df3$position <=plot_max),]
|
||||||
subset_sorted_df=sorted_df[(sorted_df$position>=plot_min & sorted_df$position <=plot_max),]
|
# subset_sorted_df=sorted_df[(sorted_df$position>=plot_min & sorted_df$position <=plot_max),]
|
||||||
|
#
|
||||||
#### LogoPlotSnps ####
|
# #### LogoPlotSnps ####
|
||||||
output$LogoPlotSnps = renderPlot(
|
# output$LogoPlotSnps = renderPlot(
|
||||||
LogoPlotSnps(subset_mutable_df3,
|
# LogoPlotSnps(subset_mutable_df3,
|
||||||
aa_pos_drug = get(paste0(target_gene,"_aa_pos_drug")),
|
# aa_pos_drug = get(paste0(target_gene,"_aa_pos_drug")),
|
||||||
active_aa_pos = get(paste0(target_gene,"_active_aa_pos")),
|
# active_aa_pos = get(paste0(target_gene,"_active_aa_pos")),
|
||||||
aa_pos_lig1 = get(paste0(target_gene,"_aa_pos_lig1")),
|
# aa_pos_lig1 = get(paste0(target_gene,"_aa_pos_lig1")),
|
||||||
aa_pos_lig2 = get(paste0(target_gene,"_aa_pos_lig2")),
|
# aa_pos_lig2 = get(paste0(target_gene,"_aa_pos_lig2")),
|
||||||
aa_pos_lig3 = get(paste0(target_gene,"_aa_pos_lig3")),
|
# aa_pos_lig3 = get(paste0(target_gene,"_aa_pos_lig3")),
|
||||||
my_logo_col = logoplot_colour_scheme,
|
# my_logo_col = logoplot_colour_scheme,
|
||||||
omit_snp_count = omit_snp_count
|
# omit_snp_count = omit_snp_count
|
||||||
|
#
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
|
#
|
||||||
### NGLViewer ####
|
# ### NGLViewer ####
|
||||||
# Structure Viewer WebGL/NGLViewR window
|
# # Structure Viewer WebGL/NGLViewR window
|
||||||
output$structure <- renderNGLVieweR({
|
# output$structure <- renderNGLVieweR({
|
||||||
#ngl_gene=isolate(input$switch_target)
|
# #ngl_gene=isolate(input$switch_target)
|
||||||
ngl_gene=input$switch_target
|
# ngl_gene=input$switch_target
|
||||||
ngl_drug=target_map[[ngl_gene]]
|
# ngl_drug=target_map[[ngl_gene]]
|
||||||
ngl_pdb_file=paste0(load_dir, "Data/", ngl_drug, '/output/depth/', ngl_gene, '_complex.pdb')
|
# ngl_pdb_file=paste0(load_dir, "Data/", ngl_drug, '/output/depth/', ngl_gene, '_complex.pdb')
|
||||||
print(ngl_pdb_file)
|
# print(ngl_pdb_file)
|
||||||
NGLVieweR(ngl_pdb_file) %>%
|
# NGLVieweR(ngl_pdb_file) %>%
|
||||||
addRepresentation("cartoon",
|
# addRepresentation("cartoon",
|
||||||
param = list(name = "cartoon",
|
# param = list(name = "cartoon",
|
||||||
color="tan"
|
# color="tan"
|
||||||
#, colorScheme = "chainid"
|
# #, colorScheme = "chainid"
|
||||||
)
|
# )
|
||||||
) %>%
|
# ) %>%
|
||||||
stageParameters(backgroundColor = "lightgrey") %>%
|
# stageParameters(backgroundColor = "lightgrey") %>%
|
||||||
setQuality("high") %>%
|
# setQuality("high") %>%
|
||||||
setFocus(0) %>%
|
# setFocus(0) %>%
|
||||||
setSpin(FALSE)
|
# setSpin(FALSE)
|
||||||
})
|
# })
|
||||||
|
#
|
||||||
|
#
|
||||||
#### Shared dataTable() ####
|
# #### Shared dataTable() ####
|
||||||
output$table = DT::renderDataTable(
|
# output$table = DT::renderDataTable(
|
||||||
datatable(subset_sorted_df[,table_columns],
|
# datatable(subset_sorted_df[,table_columns],
|
||||||
filter="top",
|
# filter="top",
|
||||||
selection = "single"
|
# selection = "single"
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
|
#
|
||||||
#### bp_stability_hmap ####
|
# #### bp_stability_hmap ####
|
||||||
# red/blue tiles wala "Stability SNP by Site"
|
# # red/blue tiles wala "Stability SNP by Site"
|
||||||
output$bp_stability_hmap = renderPlot(
|
# output$bp_stability_hmap = renderPlot(
|
||||||
bp_stability_hmap(
|
# bp_stability_hmap(
|
||||||
subset_sorted_df,
|
# subset_sorted_df,
|
||||||
reorder_position = input$reorder_custom_h,
|
# reorder_position = input$reorder_custom_h,
|
||||||
p_title = NULL,
|
# p_title = NULL,
|
||||||
yvar_colname = stability_colname,
|
# yvar_colname = stability_colname,
|
||||||
stability_colname = stability_colname,
|
# stability_colname = stability_colname,
|
||||||
stability_outcome_colname = outcome_colname,
|
# stability_outcome_colname = outcome_colname,
|
||||||
my_ylab = NULL,
|
# my_ylab = NULL,
|
||||||
y_max_override = max(sorted_df$pos_count),
|
# y_max_override = max(sorted_df$pos_count),
|
||||||
aa_pos_drug = get(paste0("embb","_aa_pos_drug")),
|
# aa_pos_drug = get(paste0("embb","_aa_pos_drug")),
|
||||||
active_aa_pos = get(paste0("embb","_active_aa_pos")),
|
# active_aa_pos = get(paste0("embb","_active_aa_pos")),
|
||||||
aa_pos_lig1 = get(paste0("embb","_aa_pos_lig1")),
|
# aa_pos_lig1 = get(paste0("embb","_aa_pos_lig1")),
|
||||||
aa_pos_lig2 = get(paste0("embb","_aa_pos_lig2")),
|
# aa_pos_lig2 = get(paste0("embb","_aa_pos_lig2")),
|
||||||
aa_pos_lig3 = get(paste0("embb","_aa_pos_lig3"))
|
# aa_pos_lig3 = get(paste0("embb","_aa_pos_lig3"))
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
#### LogoPlotCustomH ####
|
# #### LogoPlotCustomH ####
|
||||||
output$LogoPlotCustomH = renderPlot(
|
# output$LogoPlotCustomH = renderPlot(
|
||||||
LogoPlotCustomH(
|
# LogoPlotCustomH(
|
||||||
subset_sorted_df,
|
# subset_sorted_df,
|
||||||
my_logo_col = logoplot_colour_scheme,
|
# my_logo_col = logoplot_colour_scheme,
|
||||||
aa_pos_drug = get(paste0(target_gene,"_aa_pos_drug")),
|
# aa_pos_drug = get(paste0(target_gene,"_aa_pos_drug")),
|
||||||
active_aa_pos = get(paste0(target_gene,"_active_aa_pos")),
|
# active_aa_pos = get(paste0(target_gene,"_active_aa_pos")),
|
||||||
aa_pos_lig1 = get(paste0(target_gene,"_aa_pos_lig1")),
|
# aa_pos_lig1 = get(paste0(target_gene,"_aa_pos_lig1")),
|
||||||
aa_pos_lig2 = get(paste0(target_gene,"_aa_pos_lig2")),
|
# aa_pos_lig2 = get(paste0(target_gene,"_aa_pos_lig2")),
|
||||||
aa_pos_lig3 = get(paste0(target_gene,"_aa_pos_lig3"))
|
# aa_pos_lig3 = get(paste0(target_gene,"_aa_pos_lig3"))
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
|
#
|
||||||
#### wideP_consurf3 ####
|
# #### wideP_consurf3 ####
|
||||||
output$wideP_consurf3 = renderPlot(
|
# output$wideP_consurf3 = renderPlot(
|
||||||
wideP_consurf3(
|
# wideP_consurf3(
|
||||||
subset_sorted_df,
|
# subset_sorted_df,
|
||||||
point_colours = consurf_colours,
|
# point_colours = consurf_colours,
|
||||||
aa_pos_drug = get(paste0(target_gene,"_aa_pos_drug")),
|
# aa_pos_drug = get(paste0(target_gene,"_aa_pos_drug")),
|
||||||
active_aa_pos = get(paste0(target_gene,"_active_aa_pos")),
|
# active_aa_pos = get(paste0(target_gene,"_active_aa_pos")),
|
||||||
aa_pos_lig1 = get(paste0(target_gene,"_aa_pos_lig1")),
|
# aa_pos_lig1 = get(paste0(target_gene,"_aa_pos_lig1")),
|
||||||
aa_pos_lig2 = get(paste0(target_gene,"_aa_pos_lig2")),
|
# aa_pos_lig2 = get(paste0(target_gene,"_aa_pos_lig2")),
|
||||||
aa_pos_lig3 = get(paste0(target_gene,"_aa_pos_lig3"))
|
# aa_pos_lig3 = get(paste0(target_gene,"_aa_pos_lig3"))
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
|
#
|
||||||
#### site_snp_count_bp ####
|
# #### site_snp_count_bp ####
|
||||||
#mutable_df3[(mutable_df3$position>=plot_min & mutable_df3$position <=plot_max),]
|
# #mutable_df3[(mutable_df3$position>=plot_min & mutable_df3$position <=plot_max),]
|
||||||
# ligand_distance
|
# # ligand_distance
|
||||||
# interface_dist
|
# # interface_dist
|
||||||
# nca_distance
|
# # nca_distance
|
||||||
# change to: multiple plots, all use site_snp_count_bp
|
# # change to: multiple plots, all use site_snp_count_bp
|
||||||
# 4 x plots side by side, one normal (no dist. filter), 2/3 filtered by distance columns above
|
# # 4 x plots side by side, one normal (no dist. filter), 2/3 filtered by distance columns above
|
||||||
# use "subtitle text" from pos_count_bp_i.R
|
# # use "subtitle text" from pos_count_bp_i.R
|
||||||
|
#
|
||||||
output$site_snp_count_bp = renderPlot(
|
# output$site_snp_count_bp = renderPlot(
|
||||||
site_snp_count_bp(
|
# site_snp_count_bp(
|
||||||
mutable_df3,
|
# mutable_df3,
|
||||||
title_colour = 'black',
|
# title_colour = 'black',
|
||||||
subtitle_colour = "black",
|
# subtitle_colour = "black",
|
||||||
leg_text_size = 12,
|
# leg_text_size = 12,
|
||||||
axis_label_size = 12,
|
# axis_label_size = 12,
|
||||||
geom_ls = 4
|
# geom_ls = 4
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
output$site_snp_count_bp_ligand = renderPlot(
|
# output$site_snp_count_bp_ligand = renderPlot(
|
||||||
site_snp_count_bp(
|
# site_snp_count_bp(
|
||||||
snp_ligand_dist_df3,
|
# snp_ligand_dist_df3,
|
||||||
title_colour = 'black',
|
# title_colour = 'black',
|
||||||
subtitle_colour = "black",
|
# subtitle_colour = "black",
|
||||||
leg_text_size = 12,
|
# leg_text_size = 12,
|
||||||
axis_label_size = 12,
|
# axis_label_size = 12,
|
||||||
geom_ls = 4
|
# geom_ls = 4
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
|
#
|
||||||
# if ("interface_dist" %in% colnames(input$switch_target)) {
|
# # if ("interface_dist" %in% colnames(input$switch_target)) {
|
||||||
output$site_snp_count_interface = renderPlot(
|
# output$site_snp_count_interface = renderPlot(
|
||||||
site_snp_count_bp(
|
# site_snp_count_bp(
|
||||||
snp_interface_dist_df3,
|
# snp_interface_dist_df3,
|
||||||
title_colour = 'black',
|
# title_colour = 'black',
|
||||||
subtitle_colour = "black",
|
# subtitle_colour = "black",
|
||||||
leg_text_size = 12,
|
# leg_text_size = 12,
|
||||||
axis_label_size = 12,
|
# axis_label_size = 12,
|
||||||
geom_ls = 4
|
# geom_ls = 4
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
# } #else {
|
# # } #else {
|
||||||
# output$site_snp_count_interface = renderPlot(
|
# # output$site_snp_count_interface = renderPlot(
|
||||||
# ggplot() + annotate(x=1,y=1,"text", label="No interface data for this target")+theme_void()
|
# # ggplot() + annotate(x=1,y=1,"text", label="No interface data for this target")+theme_void()
|
||||||
# )
|
# # )
|
||||||
# }
|
# # }
|
||||||
|
#
|
||||||
output$site_snp_count_nca = renderPlot( #{
|
# output$site_snp_count_nca = renderPlot( #{
|
||||||
#if ("nca_distance" %in% colnames(input$switch_target)) {
|
# #if ("nca_distance" %in% colnames(input$switch_target)) {
|
||||||
site_snp_count_bp(
|
# site_snp_count_bp(
|
||||||
snp_nca_dist_df3,
|
# snp_nca_dist_df3,
|
||||||
title_colour = 'black',
|
# title_colour = 'black',
|
||||||
subtitle_colour = "black",
|
# subtitle_colour = "black",
|
||||||
leg_text_size = 12,
|
# leg_text_size = 12,
|
||||||
axis_label_size = 12,
|
# axis_label_size = 12,
|
||||||
geom_ls = 4
|
# geom_ls = 4
|
||||||
)
|
# )
|
||||||
# } else {
|
# # } else {
|
||||||
# ggplot() + annotate(x=1,y=1,"text", label="No RNA data for this target")+theme_void()
|
# # ggplot() + annotate(x=1,y=1,"text", label="No RNA data for this target")+theme_void()
|
||||||
# }
|
# # }
|
||||||
# }
|
# # }
|
||||||
)
|
# )
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
#### DM OM Plots ####
|
# #### DM OM Plots ####
|
||||||
#dm_om_param
|
# #dm_om_param
|
||||||
# order needs to be:
|
# # order needs to be:
|
||||||
# embb_lf_duet, embb_lf_foldx, embb_lf_deepddg, embb_lf_dynamut2, embb_lf_dist_gen,
|
# # embb_lf_duet, embb_lf_foldx, embb_lf_deepddg, embb_lf_dynamut2, embb_lf_dist_gen,
|
||||||
# embb_lf_consurf, embb_lf_provean, embb_lf_snap2, embb_lf_mcsm_lig, embb_lf_mmcsm_lig,
|
# # embb_lf_consurf, embb_lf_provean, embb_lf_snap2, embb_lf_mcsm_lig, embb_lf_mmcsm_lig,
|
||||||
# embb_lf_mcsm_ppi2, SOMETHING NA
|
# # embb_lf_mcsm_ppi2, SOMETHING NA
|
||||||
|
#
|
||||||
# embb_lf_mmcsm_lig SOMETHING NA,
|
# # embb_lf_mmcsm_lig SOMETHING NA,
|
||||||
#dm_om_selection=input$dm_om_param
|
# #dm_om_selection=input$dm_om_param
|
||||||
#dm_om_df = dm_om_map[[dm_om_selection]]
|
# #dm_om_df = dm_om_map[[dm_om_selection]]
|
||||||
#output$lf_bp2 = renderPlot(lf_bp2(get(paste0(input$switch_target, '_', dm_om_df))))
|
# #output$lf_bp2 = renderPlot(lf_bp2(get(paste0(input$switch_target, '_', dm_om_df))))
|
||||||
|
#
|
||||||
output$lf_bp2 = renderPlot(
|
# output$lf_bp2 = renderPlot(
|
||||||
cowplot::plot_grid(
|
# cowplot::plot_grid(
|
||||||
plotlist = lapply(
|
# plotlist = lapply(
|
||||||
ls(name=.GlobalEnv,
|
# ls(name=.GlobalEnv,
|
||||||
pattern=paste0(
|
# pattern=paste0(
|
||||||
target_gene,
|
# target_gene,
|
||||||
'_lf_'
|
# '_lf_'
|
||||||
)
|
# )
|
||||||
),
|
# ),
|
||||||
function(x){
|
# function(x){
|
||||||
lf_bp2(get(x))
|
# lf_bp2(get(x))
|
||||||
}
|
# }
|
||||||
)#, nrow=3
|
# )#, nrow=3
|
||||||
), height=800
|
# ), height=800
|
||||||
)
|
# )
|
||||||
}
|
# }
|
||||||
)
|
# )
|
||||||
|
#
|
||||||
|
#
|
||||||
# FIXME: Doesn't add selected table rows correctly
|
# # FIXME: Doesn't add selected table rows correctly
|
||||||
observeEvent(
|
# observeEvent(
|
||||||
{
|
# {
|
||||||
input$table_rows_selected
|
# input$table_rows_selected
|
||||||
},
|
# },
|
||||||
{
|
# {
|
||||||
# having to duplicate this is a bit annoying :-(
|
# # having to duplicate this is a bit annoying :-(
|
||||||
ngl_merged_df3=cbind(get(paste0(input$switch_target, '_merged_df3')))
|
# ngl_merged_df3=cbind(get(paste0(input$switch_target, '_merged_df3')))
|
||||||
ngl_sorted_df = cbind(ngl_merged_df3)
|
# ngl_sorted_df = cbind(ngl_merged_df3)
|
||||||
ngl_sorted_df = ngl_sorted_df %>% arrange(pos_count)
|
# ngl_sorted_df = ngl_sorted_df %>% arrange(pos_count)
|
||||||
|
#
|
||||||
position_max=max(ngl_merged_df3[['position']])
|
# position_max=max(ngl_merged_df3[['position']])
|
||||||
position_min=min(ngl_merged_df3[['position']])
|
# position_min=min(ngl_merged_df3[['position']])
|
||||||
display_position_range = input$display_position_range
|
# display_position_range = input$display_position_range
|
||||||
plot_min=display_position_range[1]
|
# plot_min=display_position_range[1]
|
||||||
plot_max=display_position_range[2]
|
# plot_max=display_position_range[2]
|
||||||
#ngl_subset_df=ngl_merged_df3[(ngl_merged_df3$position>=plot_min & ngl_merged_df3$position <=plot_max),]
|
# #ngl_subset_df=ngl_merged_df3[(ngl_merged_df3$position>=plot_min & ngl_merged_df3$position <=plot_max),]
|
||||||
ngl_subset_df=ngl_sorted_df[(ngl_sorted_df$position>=plot_min & ngl_sorted_df$position <=plot_max),]
|
# ngl_subset_df=ngl_sorted_df[(ngl_sorted_df$position>=plot_min & ngl_sorted_df$position <=plot_max),]
|
||||||
|
#
|
||||||
|
#
|
||||||
#table_rows_selected = isolate(input$table_rows_selected)
|
# #table_rows_selected = isolate(input$table_rows_selected)
|
||||||
table_rows_selected = input$table_rows_selected
|
# table_rows_selected = input$table_rows_selected
|
||||||
class(table_rows_selected)
|
# class(table_rows_selected)
|
||||||
#cat(paste0("Target: ", as.character(input$switch_target), "\nTable Rows for NGLViewR: ", as.character(table_rows_selected)))
|
# #cat(paste0("Target: ", as.character(input$switch_target), "\nTable Rows for NGLViewR: ", as.character(table_rows_selected)))
|
||||||
|
#
|
||||||
struct_pos=(as.character(ngl_subset_df[table_rows_selected,"position"]))
|
# struct_pos=(as.character(ngl_subset_df[table_rows_selected,"position"]))
|
||||||
cat(paste0('Table Index: ', table_rows_selected, "position: ", struct_pos))
|
# cat(paste0('Table Index: ', table_rows_selected, "position: ", struct_pos))
|
||||||
|
#
|
||||||
NGLVieweR_proxy("structure") %>%
|
# NGLVieweR_proxy("structure") %>%
|
||||||
#addSelection('ball+stick'
|
# #addSelection('ball+stick'
|
||||||
addSelection('hyperball'
|
# addSelection('hyperball'
|
||||||
, param = list(
|
# , param = list(
|
||||||
name = "Pos"
|
# name = "Pos"
|
||||||
, sele = struct_pos
|
# , sele = struct_pos
|
||||||
#, color = "#00ff00"
|
# #, color = "#00ff00"
|
||||||
, colorValue="00ff00"
|
# , colorValue="00ff00"
|
||||||
, colorScheme="element"
|
# , colorScheme="element"
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
#cat(paste0('Done NGLViewR addSelection for: ', positions_to_add))
|
# #cat(paste0('Done NGLViewR addSelection for: ', positions_to_add))
|
||||||
}
|
# }
|
||||||
)
|
# )
|
||||||
#### Correlation observeEvent ####
|
# #### Correlation observeEvent ####
|
||||||
# Yet another special-case observeEvent to handle the correlation pair plot
|
# # Yet another special-case observeEvent to handle the correlation pair plot
|
||||||
|
#
|
||||||
observeEvent(
|
# observeEvent(
|
||||||
{
|
# {
|
||||||
input$corr_selected
|
# input$corr_selected
|
||||||
input$corr_method
|
# input$corr_method
|
||||||
input$corr_lig_dist
|
# input$corr_lig_dist
|
||||||
},
|
# },
|
||||||
{
|
# {
|
||||||
dist_cutoff_user = input$corr_lig_dist
|
# dist_cutoff_user = input$corr_lig_dist
|
||||||
target_gene=input$switch_target
|
# target_gene=input$switch_target
|
||||||
plot_title=paste0(target_map[[target_gene]],"/",target_gene)
|
# plot_title=paste0(target_map[[target_gene]],"/",target_gene)
|
||||||
|
#
|
||||||
corr_plot_df = get(
|
# corr_plot_df = get(
|
||||||
paste0(
|
# paste0(
|
||||||
input$switch_target,"_corr_df_m3_f"
|
# input$switch_target,"_corr_df_m3_f"
|
||||||
)
|
# )
|
||||||
)[,c(input$corr_selected, "dst_mode")]
|
# )[,c(input$corr_selected, "dst_mode")]
|
||||||
|
#
|
||||||
#if ( dist_cutoff_user >= 2) {
|
# #if ( dist_cutoff_user >= 2) {
|
||||||
#corr_plotdf_subset = corr_plot_df[corr_plot_df[['Lig.Dist']] < dist_cutoff_user,]
|
# #corr_plotdf_subset = corr_plot_df[corr_plot_df[['Lig.Dist']] < dist_cutoff_user,]
|
||||||
#}
|
# #}
|
||||||
# else {
|
# # else {
|
||||||
# corr_plotdf_subset = corr_plot_df
|
# # corr_plotdf_subset = corr_plot_df
|
||||||
# }
|
# # }
|
||||||
|
#
|
||||||
#### Correlation using ggpairs() ####
|
# #### Correlation using ggpairs() ####
|
||||||
output$my_corr_pairs = renderPlot(
|
# output$my_corr_pairs = renderPlot(
|
||||||
dashboard_ggpairs(
|
# dashboard_ggpairs(
|
||||||
corr_plot_df,
|
# corr_plot_df,
|
||||||
plot_title = plot_title,
|
# plot_title = plot_title,
|
||||||
method = input$corr_method,
|
# method = input$corr_method,
|
||||||
tt_args_size = 7,
|
# tt_args_size = 7,
|
||||||
gp_args_size = 7
|
# gp_args_size = 7
|
||||||
), height = 900
|
# ), height = 900
|
||||||
)
|
# )
|
||||||
}
|
# }
|
||||||
)
|
# )
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
|
#
|
||||||
app <- shinyApp(ui, server)
|
# app <- shinyApp(ui, server)
|
||||||
runApp(app)
|
# runApp(app)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue