84 lines
No EOL
2.7 KiB
R
84 lines
No EOL
2.7 KiB
R
function(input, output, session) {
|
|
observeEvent(
|
|
{
|
|
input$display_position_full_range #special-purpose for MSA
|
|
input$logoplot_colour_scheme
|
|
input$switch_target
|
|
},
|
|
{
|
|
# C O M P A T I B I L I T Y
|
|
#gene=input$switch_target
|
|
#drug=target_map[[gene]]
|
|
target = input$switch_target
|
|
merged_df3=cbind(get(paste0(input$switch_target, '_merged_df3')))
|
|
|
|
position_max=max(merged_df3[['position']])
|
|
position_min=min(merged_df3[['position']])
|
|
min_ligand_distance=min(merged_df3$ligand_distance)
|
|
max_ligand_distance=max(merged_df3$ligand_distance)
|
|
# FIXME: these are IMPORTANT
|
|
# # add "pos_count" position count column
|
|
# merged_df3=merged_df3 %>% dplyr::add_count(position)
|
|
# merged_df3$pos_count=merged_df3$n
|
|
# merged_df3$n=NULL
|
|
#
|
|
mutable_df3 = cbind(merged_df3)
|
|
#
|
|
# # re-sort the dataframe according to position count
|
|
sorted_df = cbind(merged_df3)
|
|
sorted_df = sorted_df %>% arrange(pos_count)
|
|
|
|
#
|
|
outdir = paste0(load_dir, "Data/", drug, '/output/')
|
|
indir = paste0(load_dir, "Data/", drug , "/input/")
|
|
#
|
|
# source("~/git/LSHTM_analysis/scripts/plotting/logo_data_msa.R") # probably unnecessary...
|
|
|
|
# source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.R")
|
|
|
|
#### nasty special-purpose merged_df3 variants ####
|
|
# FIXME: SLOW
|
|
# corr_plotdf = corr_data_extract(
|
|
# merged_df3
|
|
# , gene = gene
|
|
# , drug = drug
|
|
# , extract_scaled_cols = F
|
|
# )
|
|
|
|
#input$stability_snp_param
|
|
|
|
|
|
updateSliderInput(
|
|
session,
|
|
"display_position_full_range",
|
|
min = 1,
|
|
max = position_max #,
|
|
# value = c(position_min, position_min+150)
|
|
)
|
|
|
|
display_position_full_range = input$display_position_full_range
|
|
full_range_min=display_position_full_range[1]
|
|
full_range_max=display_position_full_range[2]
|
|
|
|
logoplot_colour_scheme = input$logoplot_colour_scheme
|
|
|
|
#### LogoPlotMSA/Logo Plot ED ####
|
|
output$LogoPlotMSA = renderPlot(
|
|
LogoPlotMSA(target=target,
|
|
plot_positions=full_range_min:full_range_max,
|
|
my_logo_col = logoplot_colour_scheme,
|
|
aa_pos_drug = get(paste0(target,"_aa_pos_drug")),
|
|
active_aa_pos = get(paste0(target,"_active_aa_pos")),
|
|
aa_pos_lig1 = get(paste0(target,"_aa_pos_lig1")),
|
|
aa_pos_lig2 = get(paste0(target,"_aa_pos_lig2")),
|
|
aa_pos_lig3 = get(paste0(target,"_aa_pos_lig3"))
|
|
)
|
|
)
|
|
}
|
|
)
|
|
|
|
#### EOF Shiny Server ####
|
|
|
|
|
|
|
|
} |