consurf tile fixes
This commit is contained in:
parent
0234a8f77b
commit
28510471f0
2 changed files with 169 additions and 163 deletions
|
@ -459,3 +459,4 @@ LogoPlotMSA <- function(unified_msa
|
||||||
return(LogoED_comb)
|
return(LogoED_comb)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#LogoPlotMSA(unified_msa)
|
||||||
|
|
|
@ -12,81 +12,79 @@
|
||||||
# wideP():
|
# wideP():
|
||||||
# input args
|
# input args
|
||||||
#==========================================================
|
#==========================================================
|
||||||
wideP_consurf <- function(plot_df
|
wideP_consurf2 <- function(plot_df
|
||||||
, xvar_colname = "position"
|
, xvar_colname = "position"
|
||||||
, yvar_colname = "consurf_score"
|
, yvar_colname = "consurf_score"
|
||||||
, yvar_colourN_colname = "consurf_colour_rev" # num from 0-1
|
, yvar_colourN_colname = "consurf_colour_rev" # num from 0-1
|
||||||
, plot_error_bars = T
|
, plot_error_bars = T
|
||||||
, upper_EB_colname = "consurf_ci_upper"
|
, upper_EB_colname = "consurf_ci_upper"
|
||||||
, lower_EB_colname = "consurf_ci_lower"
|
, lower_EB_colname = "consurf_ci_lower"
|
||||||
|
|
||||||
, plot_type = "point" # default is point
|
, plot_type = "point" # default is point
|
||||||
, point_colours
|
, point_colours
|
||||||
, p_size = 2
|
, p_size = 2
|
||||||
, leg_title1 = ""
|
, leg_title1 = ""
|
||||||
, leg_labels = c("0": "Insufficient Data"
|
, leg_labels = c("0": "Insufficient Data"
|
||||||
, "1": "Variable"
|
, "1": "Variable"
|
||||||
, "2", "3", "4", "5", "6", "7", "8"
|
, "2", "3", "4", "5", "6", "7", "8"
|
||||||
, "9": "Conserved")
|
, "9": "Conserved")
|
||||||
, panel_col = "white"
|
, panel_col = "white"
|
||||||
, panel_col_fill = "white"
|
, panel_col_fill = "white"
|
||||||
|
|
||||||
# axes title and label sizes
|
# axes title and label sizes
|
||||||
, x_axls = 12 # x-axis label size
|
, x_axls = 12 # x-axis label size
|
||||||
, y_axls = 15 # y-axis label size
|
, y_axls = 15 # y-axis label size
|
||||||
, x_axts = 12 # x-axis text size
|
, x_axts = 12 # x-axis text size
|
||||||
, y_axts = 12 # y-axis text size
|
, y_axts = 12 # y-axis text size
|
||||||
, default_xtc = "black" # x-axis text colour
|
, default_xtc = "black" # x-axis text colour
|
||||||
, ptitle = ""
|
, ptitle = ""
|
||||||
, xlab = ""
|
, xlab = ""
|
||||||
, ylab = ""
|
, ylab = ""
|
||||||
, pts = 20
|
, pts = 20
|
||||||
|
|
||||||
# plot margins
|
# plot margins
|
||||||
, t_margin = 0.5
|
, t_margin = 0.5
|
||||||
, r_margin = 0.5
|
, r_margin = 0.5
|
||||||
, b_margin = 1
|
, b_margin = 1
|
||||||
, l_margin = 1
|
, l_margin = 1
|
||||||
, unit_margin = "cm"
|
, unit_margin = "cm"
|
||||||
|
|
||||||
# Custom 1: x-axis: text colour
|
# Custom 1: x-axis: text colour
|
||||||
, xtext_colour_aa = F
|
, xtext_colour_aa = F
|
||||||
, xtext_colour_aa1 = active_aa_pos
|
, xtext_colour_aa1 = active_aa_pos
|
||||||
, xtext_colour_aa2 = aa_pos_drug
|
, xtext_colour_aa2 = aa_pos_drug
|
||||||
, xtext_colours = c("purple", "brown", "black")
|
, xtext_colours = c("purple", "brown", "black")
|
||||||
|
|
||||||
# Custom 2: x-axis: geom tiles ~ lig distance
|
# Custom 2: x-axis: geom tiles ~ lig distance
|
||||||
, A_xvar_lig = T
|
, annotate_ligand_distance = T
|
||||||
, leg_title2 = "Ligand Distance"
|
, leg_title2 = "Ligand Distance"
|
||||||
, lig_dist_colname = LigDist_colname # from globals
|
, lig_dist_colname = LigDist_colname # from globals
|
||||||
, lig_dist_colours = c("green", "yellow", "orange", "red")
|
, lig_dist_colours = c("green", "yellow", "orange", "red")
|
||||||
, tpos0 = 0 # 0 is a magic number that does my sensible default
|
, tpos0 = 0 # 0 is a magic number that does my sensible default
|
||||||
, tW0 = 1
|
, tW0 = 1
|
||||||
, tH0 = 0.3
|
, tH0 = 0.3
|
||||||
|
|
||||||
# Custom 3: x-axis: geom tiles ~ active sites and ligand
|
# Custom 3: x-axis: geom tiles ~ active sites and ligand
|
||||||
, A_xvar_aa = F
|
, annotate_active_sites = F
|
||||||
, aa_pos_drug = NULL
|
, aa_pos_drug = aa_pos_drug
|
||||||
, drug_aa_colour = "purple"
|
, drug_aa_colour = "purple"
|
||||||
, tW = 1
|
, active_aa_pos = NULL
|
||||||
, tH = 0.2
|
, active_aa_colour = "brown"
|
||||||
, active_aa_pos = NULL
|
|
||||||
, active_aa_colour = "brown"
|
|
||||||
|
|
||||||
, aa_pos_lig1 = NULL
|
, aa_pos_lig1 = NULL
|
||||||
, aa_colour_lig1 = "blue"
|
, aa_colour_lig1 = "blue"
|
||||||
, tpos1 = 0
|
, tpos1 = 0
|
||||||
|
|
||||||
, aa_pos_lig2 = NULL
|
, aa_pos_lig2 = NULL
|
||||||
, aa_colour_lig2 = "cyan"
|
, aa_colour_lig2 = "cyan"
|
||||||
, tpos2 = 0
|
, tpos2 = 0
|
||||||
|
|
||||||
, aa_pos_lig3 = NULL
|
, aa_pos_lig3 = NULL
|
||||||
, aa_colour_lig3 = "cornflowerblue"
|
, aa_colour_lig3 = "cornflowerblue"
|
||||||
, tpos3 = 0
|
, tpos3 = 0
|
||||||
|
|
||||||
, default_gt_clr = "white"
|
, default_gt_clr = "white"
|
||||||
, debug=FALSE
|
, debug=FALSE
|
||||||
){
|
){
|
||||||
|
|
||||||
if(missing(point_colours)){
|
if(missing(point_colours)){
|
||||||
|
@ -119,7 +117,7 @@ wideP_consurf <- function(plot_df
|
||||||
# Build data with colours
|
# Build data with colours
|
||||||
# ~ ligand distance
|
# ~ ligand distance
|
||||||
#=========================
|
#=========================
|
||||||
if (A_xvar_lig){
|
if (annotate_ligand_distance){
|
||||||
cat("\nAnnotating x-axis ~", lig_dist_colname, "requested...")
|
cat("\nAnnotating x-axis ~", lig_dist_colname, "requested...")
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
|
@ -159,7 +157,7 @@ wideP_consurf <- function(plot_df
|
||||||
|
|
||||||
ligDcolKey <- data.frame(ligD_colours = lig_cols
|
ligDcolKey <- data.frame(ligD_colours = lig_cols
|
||||||
, lig_distR = ligD_valsR); ligDcolKey
|
, lig_distR = ligD_valsR); ligDcolKey
|
||||||
names(ligDcolKey)
|
#names(ligDcolKey)
|
||||||
cat("\nSuccessful: Mapping b/w", lig_dist_colname, "and colours")
|
cat("\nSuccessful: Mapping b/w", lig_dist_colname, "and colours")
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
|
@ -168,11 +166,9 @@ wideP_consurf <- function(plot_df
|
||||||
plot_df = merge(plot_df, ligDcolKey, by = 'lig_distR')
|
plot_df = merge(plot_df, ligDcolKey, by = 'lig_distR')
|
||||||
|
|
||||||
plot_df_check = as.data.frame(cbind(position = plot_df[[xvar_colname]]
|
plot_df_check = as.data.frame(cbind(position = plot_df[[xvar_colname]]
|
||||||
, ligD = plot_df[[lig_dist_colname]]
|
, ligD = plot_df[[lig_dist_colname]]
|
||||||
, ligDR = plot_df$lig_distR
|
, ligDR = plot_df$lig_distR
|
||||||
, ligD_cols = plot_df$ligD_colours))
|
, ligD_cols = plot_df$ligD_colours))
|
||||||
} else{
|
|
||||||
plot_df = plot_df
|
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################
|
###############################################
|
||||||
|
@ -184,7 +180,7 @@ wideP_consurf <- function(plot_df
|
||||||
# ~ on active sites
|
# ~ on active sites
|
||||||
#==========================
|
#==========================
|
||||||
|
|
||||||
if(A_xvar_aa) {
|
if(annotate_active_sites) {
|
||||||
cat("\nAnnotation for xvar requested. Building colours for annotation...")
|
cat("\nAnnotation for xvar requested. Building colours for annotation...")
|
||||||
|
|
||||||
aa_colour_colname = "bg_all"
|
aa_colour_colname = "bg_all"
|
||||||
|
@ -196,9 +192,9 @@ wideP_consurf <- function(plot_df
|
||||||
# column colour 0: Active site + drug binding sites
|
# column colour 0: Active site + drug binding sites
|
||||||
#--------------------------------------------------
|
#--------------------------------------------------
|
||||||
plot_df[[aa_colour_colname]] = ifelse(plot_df[[xvar_colname]]%in%aa_pos_drug
|
plot_df[[aa_colour_colname]] = ifelse(plot_df[[xvar_colname]]%in%aa_pos_drug
|
||||||
, drug_aa_colour
|
, drug_aa_colour
|
||||||
, ifelse(plot_df[[xvar_colname]]%in%active_aa_pos
|
, ifelse(plot_df[[xvar_colname]]%in%active_aa_pos
|
||||||
, active_aa_colour, default_gt_clr ))
|
, active_aa_colour, default_gt_clr ))
|
||||||
plot_df[[aa_colour_colname]]
|
plot_df[[aa_colour_colname]]
|
||||||
cat("\nColumn created 'bg_all':", length(plot_df[[aa_colour_colname]]))
|
cat("\nColumn created 'bg_all':", length(plot_df[[aa_colour_colname]]))
|
||||||
|
|
||||||
|
@ -208,20 +204,20 @@ wideP_consurf <- function(plot_df
|
||||||
cat("\nAssigning colours to drug binding and ligand-1 binding residues")
|
cat("\nAssigning colours to drug binding and ligand-1 binding residues")
|
||||||
plot_df[[aa_colour_colname1]] = plot_df[[aa_colour_colname]]
|
plot_df[[aa_colour_colname1]] = plot_df[[aa_colour_colname]]
|
||||||
plot_df[[aa_colour_colname1]] = ifelse(plot_df[[xvar_colname]]%in%aa_pos_lig1
|
plot_df[[aa_colour_colname1]] = ifelse(plot_df[[xvar_colname]]%in%aa_pos_lig1
|
||||||
, aa_colour_lig1, plot_df[[aa_colour_colname]])
|
, aa_colour_lig1, plot_df[[aa_colour_colname]])
|
||||||
#------------------------------------------------
|
#------------------------------------------------
|
||||||
# column colour 2: Ligand 2
|
# column colour 2: Ligand 2
|
||||||
#------------------------------------------------
|
#------------------------------------------------
|
||||||
plot_df[[aa_colour_colname2]] = plot_df[[aa_colour_colname1]]
|
plot_df[[aa_colour_colname2]] = plot_df[[aa_colour_colname1]]
|
||||||
plot_df[[aa_colour_colname2]] = ifelse(plot_df[[xvar_colname]]%in%aa_pos_lig2
|
plot_df[[aa_colour_colname2]] = ifelse(plot_df[[xvar_colname]]%in%aa_pos_lig2
|
||||||
, aa_colour_lig2, plot_df[[aa_colour_colname1]])
|
, aa_colour_lig2, plot_df[[aa_colour_colname1]])
|
||||||
|
|
||||||
#------------------------------------------------
|
#------------------------------------------------
|
||||||
# column colour 3: Ligand 3
|
# column colour 3: Ligand 3
|
||||||
#------------------------------------------------
|
#------------------------------------------------
|
||||||
plot_df[[aa_colour_colname3]] = plot_df[[aa_colour_colname2]]
|
plot_df[[aa_colour_colname3]] = plot_df[[aa_colour_colname2]]
|
||||||
plot_df[[aa_colour_colname3]] = ifelse(plot_df[[xvar_colname]]%in%aa_pos_lig3
|
plot_df[[aa_colour_colname3]] = ifelse(plot_df[[xvar_colname]]%in%aa_pos_lig3
|
||||||
, aa_colour_lig3, plot_df[[aa_colour_colname2]])
|
, aa_colour_lig3, plot_df[[aa_colour_colname2]])
|
||||||
|
|
||||||
}
|
}
|
||||||
###################
|
###################
|
||||||
|
@ -237,12 +233,13 @@ wideP_consurf <- function(plot_df
|
||||||
ymax = max(plot_df[[yvar_colname]]); ymax
|
ymax = max(plot_df[[yvar_colname]]); ymax
|
||||||
|
|
||||||
g = ggplot(plot_df, aes_string(x = sprintf("factor(%s)", xvar_colname)
|
g = ggplot(plot_df, aes_string(x = sprintf("factor(%s)", xvar_colname)
|
||||||
, y = yvar_colname
|
, y = yvar_colname
|
||||||
, colour = sprintf("factor(%s)", yvar_colourN_colname)
|
, colour = sprintf("factor(%s)", yvar_colourN_colname)
|
||||||
))
|
))
|
||||||
|
|
||||||
#"if SPECIAL do SPECIAL THING, otherwise do NORMAL THING"
|
#"if SPECIAL do SPECIAL THING, otherwise do NORMAL THING"
|
||||||
if (plot_type == "bar"){
|
if (plot_type == "bar"){
|
||||||
|
cat('\ndoing bar plot')
|
||||||
g0 = g +
|
g0 = g +
|
||||||
geom_bar(stat = "identity")
|
geom_bar(stat = "identity")
|
||||||
}
|
}
|
||||||
|
@ -256,6 +253,7 @@ wideP_consurf <- function(plot_df
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plot_error_bars){
|
if (plot_error_bars){
|
||||||
|
cat('\nplotting error bars')
|
||||||
g0 = g0 +
|
g0 = g0 +
|
||||||
geom_errorbar(aes(ymin = eval(parse(text = lower_EB_colname))
|
geom_errorbar(aes(ymin = eval(parse(text = lower_EB_colname))
|
||||||
, ymax = eval(parse(text = upper_EB_colname))
|
, ymax = eval(parse(text = upper_EB_colname))
|
||||||
|
@ -291,7 +289,7 @@ wideP_consurf <- function(plot_df
|
||||||
, b = b_margin
|
, b = b_margin
|
||||||
, l = l_margin
|
, l = l_margin
|
||||||
, unit = unit_margin))+
|
, unit = unit_margin))+
|
||||||
guides(colour = guide_legend(title = "ConsurfXXXX")) +
|
#guides(colour = guide_legend(title = "ConsurfXXXX")) +
|
||||||
|
|
||||||
labs(title = ptitle
|
labs(title = ptitle
|
||||||
, x = xlab
|
, x = xlab
|
||||||
|
@ -302,7 +300,7 @@ wideP_consurf <- function(plot_df
|
||||||
#------------------
|
#------------------
|
||||||
# yayy
|
# yayy
|
||||||
g1_leg = ggplot(plot_df, aes_string(x = sprintf("factor(%s)"
|
g1_leg = ggplot(plot_df, aes_string(x = sprintf("factor(%s)"
|
||||||
, xvar_colname) ))
|
, xvar_colname) ))
|
||||||
g1_leg = g1_leg + geom_bar(); g1_leg
|
g1_leg = g1_leg + geom_bar(); g1_leg
|
||||||
g1_leg = g1_leg + geom_bar(aes_string(fill = sprintf("factor(%s)"
|
g1_leg = g1_leg + geom_bar(aes_string(fill = sprintf("factor(%s)"
|
||||||
, yvar_colourN_colname)))
|
, yvar_colourN_colname)))
|
||||||
|
@ -320,7 +318,7 @@ wideP_consurf <- function(plot_df
|
||||||
#-------
|
#-------
|
||||||
# plot
|
# plot
|
||||||
#-------
|
#-------
|
||||||
if(A_xvar_lig){ # 0 is a magic number that does my sensible default
|
if(annotate_ligand_distance){ # 0 is a magic number that does my sensible default
|
||||||
if (tpos0 == 0){
|
if (tpos0 == 0){
|
||||||
tpos0 = ymin-0.5
|
tpos0 = ymin-0.5
|
||||||
}
|
}
|
||||||
|
@ -339,8 +337,6 @@ wideP_consurf <- function(plot_df
|
||||||
, "\nNo. of colours:", n_colours)
|
, "\nNo. of colours:", n_colours)
|
||||||
|
|
||||||
g2 = g1 + geom_tile(aes(, tpos0
|
g2 = g1 + geom_tile(aes(, tpos0
|
||||||
# g2 = g1 + geom_tile(aes(, tpos0
|
|
||||||
|
|
||||||
, width = tW0
|
, width = tW0
|
||||||
, height = tH0)
|
, height = tH0)
|
||||||
, fill = plot_df$ligD_colours
|
, fill = plot_df$ligD_colours
|
||||||
|
@ -349,14 +345,19 @@ wideP_consurf <- function(plot_df
|
||||||
|
|
||||||
#cat("Nrows of plot df", length(plot_df$ligD_colours))
|
#cat("Nrows of plot df", length(plot_df$ligD_colours))
|
||||||
out = g2
|
out = g2
|
||||||
|
cat('\nOut is g2')
|
||||||
}else{
|
}else{
|
||||||
|
cat('\nOut is g1')
|
||||||
out = g1
|
out = g1
|
||||||
}
|
}
|
||||||
#==============================================
|
#==============================================
|
||||||
# x-axis: geom_tiles ~ active sites and others
|
# x-axis: geom_tiles ~ active sites and others
|
||||||
#==============================================
|
#==============================================
|
||||||
if(A_xvar_aa){
|
if(annotate_active_sites){
|
||||||
|
cat('\nDrug Positions: ',aa_pos_drug)
|
||||||
|
cat ('\nLig 1 Positions:', aa_pos_lig1)
|
||||||
|
cat ('\nLig 2 Positions:', aa_pos_lig2)
|
||||||
|
cat ('\nLig 2 Positions:', aa_pos_lig3)
|
||||||
#tpos = 0
|
#tpos = 0
|
||||||
#tW = 1
|
#tW = 1
|
||||||
#tH = 0.2
|
#tH = 0.2
|
||||||
|
@ -366,67 +367,70 @@ wideP_consurf <- function(plot_df
|
||||||
#---------------------
|
#---------------------
|
||||||
if (all(!is.null(active_aa_pos) &&
|
if (all(!is.null(active_aa_pos) &&
|
||||||
!is.null(aa_pos_drug) &&
|
!is.null(aa_pos_drug) &&
|
||||||
!is.null(aa_pos_lig1) && !is.null(aa_pos_lig2) && !is.null(aa_pos_lig3))) {
|
!is.null(aa_pos_lig1) &&
|
||||||
if (debug){
|
!is.null(aa_pos_lig2) &&
|
||||||
cat("\n\nAnnotating xvar with active, drug binding, and Lig 1&2&3 sites")
|
!is.null(aa_pos_lig3))) {
|
||||||
cat("\nCreating column colours, column name:", aa_colour_colname3)
|
#if (debug){
|
||||||
|
cat("\n\nAnnotating xvar with active, drug binding, and Lig 1 & 2 & 3 sites")
|
||||||
|
#cat("\nCreating column colours, column name:", aa_colour_colname3)
|
||||||
|
|
||||||
cat("\nDoing Plot with 3 ligands")
|
cat("\nDoing Plot with 3 ligands")
|
||||||
}
|
#}
|
||||||
#out = out + geom_tile(aes(,tpos3
|
out = out + geom_tile(aes(,tpos3
|
||||||
out = out + geom_tile(aes(,2
|
, width = tW0
|
||||||
, width = tW
|
, height = tH0 )
|
||||||
, height = tH )
|
|
||||||
, fill = plot_df[[aa_colour_colname3]]
|
, fill = plot_df[[aa_colour_colname3]]
|
||||||
, colour = plot_df[[aa_colour_colname3]]
|
, colour = plot_df[[aa_colour_colname3]]
|
||||||
, linetype = "solid") +
|
, linetype = "solid") +
|
||||||
geom_tile(aes(, tpos2
|
geom_tile(aes(, tpos2
|
||||||
, width = tW
|
, width = tW0
|
||||||
, height = tH )
|
, height = tH0 )
|
||||||
, fill = plot_df[[aa_colour_colname2]]
|
, fill = plot_df[[aa_colour_colname2]]
|
||||||
, colour = plot_df[[aa_colour_colname2]]
|
, colour = plot_df[[aa_colour_colname2]]
|
||||||
, linetype = "solid")+
|
, linetype = "solid")+
|
||||||
|
|
||||||
geom_tile(aes(, tpos1
|
geom_tile(aes(, tpos1
|
||||||
, width = tW
|
, width = tW0
|
||||||
, height = tH)
|
, height = tH0)
|
||||||
, fill = plot_df[[aa_colour_colname1]]
|
, fill = plot_df[[aa_colour_colname1]]
|
||||||
, colour = plot_df[[aa_colour_colname1]]
|
, colour = plot_df[[aa_colour_colname1]]
|
||||||
, linetype = "solid")
|
, linetype = "solid")
|
||||||
if (debug){
|
#if (debug){
|
||||||
cat("\nDone Plot with 3 ligands")
|
cat("\nDone Plot with 3 ligands")
|
||||||
}
|
#}
|
||||||
}
|
} else {cat("\n3 Lig Plot condition FAIL")}
|
||||||
#---------------------
|
#---------------------
|
||||||
# Add2plot: 2 ligands
|
# Add2plot: 2 ligands
|
||||||
#---------------------
|
#---------------------
|
||||||
|
|
||||||
if (all(!is.null(active_aa_pos) &&
|
if (all(!is.null(active_aa_pos) &&
|
||||||
!is.null(aa_pos_drug) &&
|
!is.null(aa_pos_drug) &&
|
||||||
!is.null(aa_pos_lig1) && !is.null(aa_pos_lig2) && is.null(aa_pos_lig3))) {
|
!is.null(aa_pos_lig1) &&
|
||||||
if (debug){
|
!is.null(aa_pos_lig2) &&
|
||||||
cat("\n\nAnnotating xvar with active, drug binding, and Lig 1&2 sites")
|
is.null(aa_pos_lig3))) {
|
||||||
cat("\nCreating column colours, column name:", aa_colour_colname2)
|
#if (debug){
|
||||||
|
cat("\n\nAnnotating xvar with active, drug binding, and Lig 1&2 sites")
|
||||||
|
cat("\nCreating column colours, column name:", aa_colour_colname2)
|
||||||
|
|
||||||
cat("\nDoing Plot with 2 ligands")
|
cat("\nDoing Plot with 2 ligands")
|
||||||
}
|
#}
|
||||||
out = out +
|
out = out +
|
||||||
geom_tile(aes(, tpos2
|
geom_tile(aes(, tpos2
|
||||||
, width = tW
|
, width = tW0
|
||||||
, height = tH)
|
, height = tH0)
|
||||||
, fill = plot_df[[aa_colour_colname2]]
|
, fill = plot_df[[aa_colour_colname2]]
|
||||||
, colour = plot_df[[aa_colour_colname2]]
|
, colour = plot_df[[aa_colour_colname2]]
|
||||||
, linetype = "solid")+
|
, linetype = "solid")+
|
||||||
geom_tile(aes(, tpos1
|
geom_tile(aes(, tpos1
|
||||||
, width = tW
|
, width = tW0
|
||||||
, height = tH)
|
, height = tH0)
|
||||||
, fill = plot_df[[aa_colour_colname1]]
|
, fill = plot_df[[aa_colour_colname1]]
|
||||||
, colour = plot_df[[aa_colour_colname1]]
|
, colour = plot_df[[aa_colour_colname1]]
|
||||||
, linetype = "solid")
|
, linetype = "solid")
|
||||||
if (debug){
|
#if (debug){
|
||||||
cat("\nDone Plot with 2 ligands")
|
cat("\nDone Plot with 2 ligands")
|
||||||
}
|
#}
|
||||||
}
|
} else {cat("\n2 Lig Plot condition FAIL")}
|
||||||
|
|
||||||
#---------------------
|
#---------------------
|
||||||
# Add2plot: 1 ligand
|
# Add2plot: 1 ligand
|
||||||
|
@ -434,53 +438,54 @@ wideP_consurf <- function(plot_df
|
||||||
if (all(!is.null(active_aa_pos) &&
|
if (all(!is.null(active_aa_pos) &&
|
||||||
!is.null(aa_pos_drug) &&
|
!is.null(aa_pos_drug) &&
|
||||||
!is.null(aa_pos_lig1) && is.null(aa_pos_lig2) && is.null(aa_pos_lig3))) {
|
!is.null(aa_pos_lig1) && is.null(aa_pos_lig2) && is.null(aa_pos_lig3))) {
|
||||||
if (debug){
|
#if (debug){
|
||||||
cat("\n\nAnnotating xvar with active, drug binding, and Lig 1 sites")
|
cat("\n\nAnnotating xvar with active, drug binding, and Lig 1 sites")
|
||||||
cat("\nCreating column colours, column name:", aa_colour_colname1)
|
cat("\nCreating column colours, column name:", aa_colour_colname1)
|
||||||
|
|
||||||
cat("\nDoing Plot with 1 ligands")
|
cat("\nDoing Plot with 1 ligands")
|
||||||
}
|
#}
|
||||||
out = out +
|
out = out +
|
||||||
geom_tile(aes(, tpos1
|
geom_tile(aes(, tpos1
|
||||||
, width = tW
|
, width = tW0
|
||||||
, height = tH)
|
, height = tH0)
|
||||||
, fill = plot_df[[aa_colour_colname1]]
|
, fill = plot_df[[aa_colour_colname1]]
|
||||||
, colour = plot_df[[aa_colour_colname1]]
|
, colour = plot_df[[aa_colour_colname1]]
|
||||||
, linetype = "solid")
|
, linetype = "solid")
|
||||||
|
|
||||||
cat("\nDone Plot with 1 ligand")
|
cat("\nDone Plot with 1 ligand")
|
||||||
|
|
||||||
}
|
} else {cat("\n3 Lig Plot condition FAIL")}
|
||||||
|
|
||||||
#-----------------------------------
|
#-----------------------------------
|
||||||
# Add2plot:NO ligands
|
# Add2plot:NO ligands
|
||||||
# No Ligs: Just drug and active site
|
# No Ligs: Just drug and active site
|
||||||
# DEFAULT: A_xvar_aa == TRUE
|
# DEFAULT: annotate_active_sites == TRUE
|
||||||
#----------------------------------
|
#----------------------------------
|
||||||
if (all(!is.null(active_aa_pos) &&
|
if (all(!is.null(active_aa_pos) &&
|
||||||
!is.null(aa_pos_drug) &&
|
!is.null(aa_pos_drug) &&
|
||||||
is.null(aa_pos_lig1) &&
|
is.null(aa_pos_lig1) &&
|
||||||
is.null(aa_pos_lig2) &&
|
is.null(aa_pos_lig2) &&
|
||||||
is.null(aa_pos_lig3))) {
|
is.null(aa_pos_lig3))) {
|
||||||
if (debug){
|
#if (debug){
|
||||||
cat("\n\nAnnotating xvar with active and drug binding sites")
|
cat("\n\nAnnotating xvar with active and drug binding sites")
|
||||||
cat("\nCreating column colours, column name:", aa_colour_colname)
|
cat("\nCreating column colours, column name:", aa_colour_colname)
|
||||||
cat("\nDoing Plot with 0 ligands: active and drug site only")
|
cat("\nDoing Plot with 0 ligands: active and drug site only")
|
||||||
}
|
#}
|
||||||
out = out + geom_tile(aes(, tpos3
|
out = out + geom_tile(aes(, tpos3
|
||||||
, width = tW
|
, width = tW0
|
||||||
, height = tH)
|
, height = tH0)
|
||||||
, fill = plot_df[[aa_colour_colname]]
|
, fill = plot_df[[aa_colour_colname]]
|
||||||
, colour = plot_df[[aa_colour_colname]]
|
, colour = plot_df[[aa_colour_colname]]
|
||||||
, linetype = "solid")
|
, linetype = "solid")
|
||||||
if (debug){
|
#if (debug){
|
||||||
cat("\nDone Plot with: Active and Drug sites")
|
cat("\nDone Plot with: Active and Drug sites")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}else{
|
#}
|
||||||
|
} else {
|
||||||
cat("\nNo annotation for additional ligands on xvar requested")
|
cat("\nNo annotation for additional ligands on xvar requested")
|
||||||
}
|
}
|
||||||
if (A_xvar_lig){
|
if (annotate_ligand_distance){
|
||||||
|
cat('\nOutput: Plot + distance heat-bar + other stuff')
|
||||||
legs = cowplot::plot_grid(legend1
|
legs = cowplot::plot_grid(legend1
|
||||||
, generate_distance_legend(plot_df, yvar_colname = yvar_colname)
|
, generate_distance_legend(plot_df, yvar_colname = yvar_colname)
|
||||||
, ncol = 1
|
, ncol = 1
|
||||||
|
@ -505,12 +510,12 @@ wideP_consurf <- function(plot_df
|
||||||
#return(out2)
|
#return(out2)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#
|
||||||
|
# wideP_consurf2(
|
||||||
# wideP_consurf(
|
|
||||||
# merged_df3,
|
# merged_df3,
|
||||||
# A_xvar_aa = T,
|
# annotate_active_sites = TRUE,
|
||||||
# active_aa_pos = active_aa_pos,
|
# active_aa_pos = active_aa_pos,
|
||||||
|
# aa_pos_drug = aa_pos_drug,
|
||||||
# aa_pos_lig1 = aa_pos_lig1,
|
# aa_pos_lig1 = aa_pos_lig1,
|
||||||
# aa_pos_lig2 = aa_pos_lig2,
|
# aa_pos_lig2 = aa_pos_lig2,
|
||||||
# aa_pos_lig3 = aa_pos_lig3,
|
# aa_pos_lig3 = aa_pos_lig3,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue