LSHTM_analysis/scripts/functions/tests/test_consurfP.R

149 lines
5.5 KiB
R

## ...opt args
library(ggplot2)
library(tidyverse)
library(cowplot)
library(gridExtra)
source("~/git/LSHTM_analysis/scripts/functions/consurfP.R")
############################################################################
# merged_df3 = read.csv("~/git/Data/cycloserine/output/alr_all_params.csv"); source("~/git/LSHTM_analysis/config/alr.R")
# if ( tolower(gene) == "alr") {
# aa_pos_lig1 = NULL
# aa_pos_lig2 = NULL
# aa_pos_lig3 = NULL
# p_title = gene
# }
###########################################################################
merged_df3 = read.csv("~/git/Data/ethambutol/output/embb_all_params.csv"); source("~/git/LSHTM_analysis/config/embb.R")
if ( tolower(gene) == "embb") {
aa_pos_lig1 = aa_pos_ca
aa_pos_lig2 = aa_pos_cdl
aa_pos_lig3 = aa_pos_dsl
p_title = gene
}
###########################################################################
# merged_df3 = read.csv("~/git/Data/streptomycin/output/gid_all_params.csv"); source("~/git/LSHTM_analysis/config/gid.R")
# if ( tolower(gene) == "gid") {
# aa_pos_lig1 = aa_pos_rna
# aa_pos_lig2 = aa_pos_sam
# aa_pos_lig3 = aa_pos_amp
# p_title = gene
# }
###########################################################################
# merged_df3 = read.csv("~/git/Data/isoniazid/output/katg_all_params.csv"); source("~/git/LSHTM_analysis/config/katg.R")
# if ( tolower(gene) == "katg") {
# aa_pos_lig1 = aa_pos_hem
# aa_pos_lig2 = NULL
# aa_pos_lig3 = NULL
# p_title = gene
# }
###########################################################################
# merged_df3 = read.csv("~/git/Data/pyrazinamide/output/pnca_all_params.csv"); source("~/git/LSHTM_analysis/config/pnca.R")
# if ( tolower(gene) == "pnca") {
# aa_pos_lig1 = aa_pos_fe
# aa_pos_lig2 = NULL
# aa_pos_lig3 = NULL
# p_title = gene
# }
###########################################################################
# merged_df3 = read.csv("~/git/Data/rifampicin/output/rpob_all_params.csv"); source("~/git/LSHTM_analysis/config/rpob.R")
# if ( tolower(gene) == "rpob") {
# aa_pos_lig1 = NULL
# aa_pos_lig2 = NULL
# aa_pos_lig3 = NULL
# p_title = gene
# }
#########################################################################
consurf_palette1 = c("0" = "yellow2"
, "1" = "cyan1"
, "2" = "steelblue2"
, "3" = "cadetblue2"
, "4" = "paleturquoise2"
, "5" = "thistle3"
, "6" = "thistle2"
, "7" = "plum2"
, "8" = "maroon"
, "9" = "violetred2")
consurf_palette2 = c("0" = "yellow2"
, "1" = "forestgreen"
, "2" = "seagreen3"
, "3" = "palegreen1"
, "4" = "darkseagreen2"
, "5" = "thistle3"
, "6" = "lightpink1"
, "7" = "orchid3"
, "8" = "orchid4"
, "9" = "darkorchid4")
#################################################
#active_aa_pos = c(2, 4)
#aa_pos_drug = c(3, 4, 14, 10)
aa_pos_hbond = c(2, 4)
aa_pos_other = c(3, 4, 14, 10)
wideP_consurf(plotdf = merged_df3
, xvar_colname = "position"
, yvar_colname = "consurf_score"
, yvar_colourN_colname = "consurf_colour_rev"
, ylab = "Consurf score"
, plot_error_bars = T
, upper_EB_colname = "consurf_ci_upper"
, lower_EB_colname = "consurf_ci_lower"
, plot_type = "point"
, point_colours = consurf_palette2
, leg_title1 = "Consurf"
, leg_labels = c("0"="Insufficient Data"
, "1" = "Variable"
, "2", "3", "4", "5", "6", "7", "8"
, "9" = "Conserved")
# axes title and label sizes
, x_axts = 8
, y_axts = 12
, x_axls = 12
, y_axls = 15
, default_xtc = "black"
, ptitle = p_title
, xlab = ""
# x-axis: text colour
, xtext_colour_aa = F
, xtext_colour_aa1 = active_aa_pos
, xtext_colour_aa2 = aa_pos_drug
, xtext_colours = c("purple", "brown", "black")
# x-axis: geom tiles ~ lig distance
, A_xvar_lig = T
, leg_title2 = "Ligand\nDistance"
, lig_dist_colname = "ligand_distance"
, lig_dist_colours = c("green", "yellow", "orange", "red")
#, tpos0 = 0 #-1.9 #-1.7
#, tpos0 = 2.5
#, tW0 = 1
#, tH0 = 0.2 #0.3
# x-axis: geom tiles ~ active sites and ligand
, A_xvar_aa = T
, active_aa_pos = active_aa_pos
, active_aa_colour = "brown"
, aa_pos_drug = aa_pos_drug
, drug_aa_colour = "purple"
, aa_pos_lig1 = aa_pos_lig1
, aa_colour_lig1 = "blue"
#, tpos1 = 2 #-0.4-1.7 #-0.3-1.65
, aa_pos_lig2 = aa_pos_lig2
, aa_colour_lig2 = "cyan"
#, tpos2 = 1.5#-0.3-1.7 #-0.2-1.65
, aa_pos_lig3 = aa_pos_lig3
, aa_colour_lig3 = "cornflowerblue"
#, tpos3 = 1 #-0.2-1.7#-0.1-1.65
, default_gt_clr = "white"
)