renamed 2 to _v2
This commit is contained in:
parent
c9d7ea9fad
commit
802d6f8495
18 changed files with 761 additions and 976 deletions
47
config/alr.R
47
config/alr.R
|
@ -26,7 +26,8 @@ aa_plip_dcs_hbond = c(66, 70, 196, 237
|
||||||
aa_plip_dcs_other = aa_plip_dcs[!aa_plip_dcs%in%aa_plip_dcs_hbond]
|
aa_plip_dcs_other = aa_plip_dcs[!aa_plip_dcs%in%aa_plip_dcs_hbond]
|
||||||
|
|
||||||
c2 = length(aa_plip_dcs_other) == length(aa_plip_dcs) - length(aa_plip_dcs_hbond)
|
c2 = length(aa_plip_dcs_other) == length(aa_plip_dcs) - length(aa_plip_dcs_hbond)
|
||||||
|
|
||||||
|
|
||||||
#==========
|
#==========
|
||||||
# Arpeggio
|
# Arpeggio
|
||||||
#===========
|
#===========
|
||||||
|
@ -40,6 +41,18 @@ aa_arpeg_dcs_other = aa_arpeg_dcs[!aa_arpeg_dcs%in%c(aa_ligplus_dcs_other
|
||||||
|
|
||||||
c3 = length(aa_arpeg_dcs_other) == length(aa_arpeg_dcs) - ( length(aa_ligplus_dcs_other) + length(aa_plip_dcs_other) )
|
c3 = length(aa_arpeg_dcs_other) == length(aa_arpeg_dcs) - ( length(aa_ligplus_dcs_other) + length(aa_plip_dcs_other) )
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
#NEW AFTER ADDING PLP to structure! huh
|
||||||
|
# ADDED: 18 Aug 2022
|
||||||
|
# PLIP server for co factor PLP (CONFUSING!)
|
||||||
|
#and 2019 lit:lys42, M319, and Y364 : OFFSET is 24
|
||||||
|
#K42: K66, Y271:Y295, M319:M343, W89: W113, W203: W227, H209:H233, Q321:Q345
|
||||||
|
aa_pos_paper = sort(unique(c(66,70,112,113,164,196,227,233,237,252,254,255,295,342,343,344,345,388)))
|
||||||
|
plp_pos_paper = sort(unique(c(66, 70, 112, 196, 227, 237, 252, 254, 255, 388)))
|
||||||
|
|
||||||
|
#active_aa_pos = sort(unique(c(aa_pos_paper, active_aa_pos)))
|
||||||
|
aa_pos_plp = sort(unique(c(plp_pos_paper, 66, 70, 112, 237, 252, 254, 255, 196)))
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
#===============
|
#===============
|
||||||
|
@ -47,7 +60,9 @@ c3 = length(aa_arpeg_dcs_other) == length(aa_arpeg_dcs) - ( length(aa_ligplus_dc
|
||||||
#===============
|
#===============
|
||||||
active_aa_pos = sort(unique(c(aa_ligplus_dcs
|
active_aa_pos = sort(unique(c(aa_ligplus_dcs
|
||||||
, aa_plip_dcs
|
, aa_plip_dcs
|
||||||
, aa_arpeg_dcs)))
|
, aa_arpeg_dcs
|
||||||
|
, aa_pos_paper
|
||||||
|
, aa_pos_plp)))
|
||||||
#=================
|
#=================
|
||||||
# Drug binding aa
|
# Drug binding aa
|
||||||
#=================
|
#=================
|
||||||
|
@ -56,6 +71,12 @@ aa_pos_dcs = sort(unique(c(aa_ligplus_dcs
|
||||||
, aa_arpeg_dcs)))
|
, aa_arpeg_dcs)))
|
||||||
aa_pos_drug = aa_pos_dcs
|
aa_pos_drug = aa_pos_dcs
|
||||||
|
|
||||||
|
|
||||||
|
#===============
|
||||||
|
# Co-factor: PLP aa
|
||||||
|
#===============
|
||||||
|
aa_pos_plp = aa_pos_plp
|
||||||
|
|
||||||
#===============
|
#===============
|
||||||
# Hbond aa
|
# Hbond aa
|
||||||
#===============
|
#===============
|
||||||
|
@ -102,11 +123,25 @@ if ( all(c1, c2, c3) ) {
|
||||||
, "\n\nNO other co-factors or ligands present\n")
|
, "\n\nNO other co-factors or ligands present\n")
|
||||||
|
|
||||||
}
|
}
|
||||||
#######################################################################
|
######################################################################
|
||||||
|
#NEW
|
||||||
|
# PLIP server for co factor PLP (CONFUSING!)
|
||||||
|
#and 2019 lit:lys42, M319, and Y364 : OFFSET is 24
|
||||||
|
#K42: K66, Y271:Y295, M319:M343, W89: W113, W203: W227, H209:H233, Q321:Q345
|
||||||
|
aa_pos_paper = sort(unique(c(66,70,112,113,164,196,227,233,237,252,254,255,295,342,343,344,345,388)))
|
||||||
|
plp_pos_paper = sort(unique(c(66, 70, 112, 196, 227, 237, 252, 254, 255, 388)))
|
||||||
|
|
||||||
|
active_aa_pos = sort(unique(c(aa_pos_paper, active_aa_pos)))
|
||||||
|
aa_pos_plp = sort(unique(c(plp_pos_paper, 66, 70, 112, 237, 252, 254, 255, 196)))
|
||||||
|
|
||||||
|
# add two key residues
|
||||||
|
#aa_pos_drug = sort(unique(c(319, 364, aa_pos_drug)))
|
||||||
|
#active_aa_pos = sort(unique(c(319, 364, active_aa_pos, aa_pos_plp)))
|
||||||
|
|
||||||
# FIXME: these should be populated!
|
# FIXME: these should be populated!
|
||||||
aa_pos_lig1 = NULL
|
aa_pos_lig1 = aa_pos_plp
|
||||||
aa_pos_lig2 = NULL
|
aa_pos_lig2 = NULL
|
||||||
aa_pos_lig3 = NULL
|
aa_pos_lig3 = NULL
|
||||||
tile_map=data.frame(tile=c("ALR","DPA","CDL","Ca"),
|
|
||||||
tile_colour=c("green","darkslategrey","navyblue","purple"))
|
|
||||||
|
|
||||||
|
tile_map=data.frame(tile=c("ALR","PLP"),
|
||||||
|
tile_colour=c("green","darkslategrey"))
|
|
@ -70,30 +70,30 @@ cat("\nNo. of active site residues for gene"
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
aa_pos_emb = sort(unique(c( aa_ligplus_emb
|
aa_pos_emb = sort(unique(c( aa_ligplus_emb
|
||||||
, aa_plip_emb
|
, aa_plip_emb
|
||||||
, aa_arpeg_emb)))
|
, aa_arpeg_emb)))
|
||||||
aa_pos_drug = aa_pos_emb
|
aa_pos_drug = aa_pos_emb
|
||||||
|
|
||||||
aa_pos_emb_hbond = sort(unique(c( aa_ligplus_emb_hbond
|
aa_pos_emb_hbond = sort(unique(c( aa_ligplus_emb_hbond
|
||||||
, aa_plip_emb_hbond)))
|
, aa_plip_emb_hbond)))
|
||||||
|
|
||||||
aa_pos_ca = sort(unique(c( aa_ligplus_ca
|
aa_pos_ca = sort(unique(c( aa_ligplus_ca
|
||||||
, aa_plip_ca
|
, aa_plip_ca
|
||||||
, aa_arpeg_ca)))
|
, aa_arpeg_ca)))
|
||||||
|
|
||||||
aa_pos_cdl = sort(unique(c( aa_ligplus_cdl
|
aa_pos_cdl = sort(unique(c( aa_ligplus_cdl
|
||||||
, aa_plip_cdl
|
, aa_plip_cdl
|
||||||
, aa_arpeg_cdl )))
|
, aa_arpeg_cdl )))
|
||||||
|
|
||||||
aa_pos_cdl_hbond = sort(unique(c( aa_ligplus_cdl_hbond )))
|
aa_pos_cdl_hbond = sort(unique(c( aa_ligplus_cdl_hbond )))
|
||||||
|
|
||||||
aa_pos_dsl = sort(unique(c( aa_ligplus_dsl
|
aa_pos_dsl = sort(unique(c( aa_ligplus_dsl
|
||||||
, aa_plip_dsl
|
, aa_plip_dsl
|
||||||
, aa_arpeg_dsl)))
|
, aa_arpeg_dsl)))
|
||||||
|
|
||||||
aa_pos_dsl_hbond = sort(unique(c( aa_ligplus_dsl_hbond
|
aa_pos_dsl_hbond = sort(unique(c( aa_ligplus_dsl_hbond
|
||||||
, aa_plip_dsl_hbond)))
|
, aa_plip_dsl_hbond)))
|
||||||
|
|
||||||
|
|
||||||
cat("\n==================================================="
|
cat("\n==================================================="
|
||||||
, "\nActive site residues for", gene, "comprise of..."
|
, "\nActive site residues for", gene, "comprise of..."
|
||||||
|
@ -120,3 +120,4 @@ aa_pos_lig3 = aa_pos_ca #purple
|
||||||
tile_map=data.frame(tile=c("EMB","DPA","CDL","Ca"),
|
tile_map=data.frame(tile=c("EMB","DPA","CDL","Ca"),
|
||||||
tile_colour=c("green","darkslategrey","navyblue","purple"))
|
tile_colour=c("green","darkslategrey","navyblue","purple"))
|
||||||
|
|
||||||
|
drug_main_res = c(299 , 302, 303 , 306 , 327 , 592 , 594, 988, 1028)
|
||||||
|
|
74
config/gid.R
74
config/gid.R
|
@ -17,7 +17,7 @@ aa_ligplus_sam = c(148, 137, 138, 139
|
||||||
, 93, 69, 119, 120
|
, 93, 69, 119, 120
|
||||||
, 220, 219, 118, 223)
|
, 220, 219, 118, 223)
|
||||||
aa_ligplus_sam_hbond = c(220, 223)
|
aa_ligplus_sam_hbond = c(220, 223)
|
||||||
|
|
||||||
aa_ligplus_amp = c(123, 125, 213, 214)
|
aa_ligplus_amp = c(123, 125, 213, 214)
|
||||||
aa_ligplus_amp_hbond = c(125, 123, 213)
|
aa_ligplus_amp_hbond = c(125, 123, 213)
|
||||||
|
|
||||||
|
@ -53,19 +53,19 @@ aa_arpeg_amp = c(123, 125, 213)
|
||||||
# Active site
|
# Active site
|
||||||
#=============
|
#=============
|
||||||
active_aa_pos = sort(unique(c(
|
active_aa_pos = sort(unique(c(
|
||||||
#rna_bind_aa_pos
|
#rna_bind_aa_pos
|
||||||
#, binding_aa_pos
|
#, binding_aa_pos
|
||||||
aa_ligplus_sry
|
aa_ligplus_sry
|
||||||
, aa_ligplus_sam
|
, aa_ligplus_sam
|
||||||
, aa_ligplus_amp
|
, aa_ligplus_amp
|
||||||
, aa_ligplus_rna
|
, aa_ligplus_rna
|
||||||
, aa_plip_sry
|
, aa_plip_sry
|
||||||
, aa_plip_sam
|
, aa_plip_sam
|
||||||
, aa_plip_amp
|
, aa_plip_amp
|
||||||
, aa_plip_rna
|
, aa_plip_rna
|
||||||
, aa_arpeg_sry
|
, aa_arpeg_sry
|
||||||
, aa_arpeg_sam
|
, aa_arpeg_sam
|
||||||
, aa_arpeg_amp
|
, aa_arpeg_amp
|
||||||
)))
|
)))
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
|
@ -77,42 +77,42 @@ cat("\nNo. of active site residues for gene"
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
aa_pos_sry = sort(unique(c(
|
aa_pos_sry = sort(unique(c(
|
||||||
aa_ligplus_sry
|
aa_ligplus_sry
|
||||||
, aa_plip_sry
|
, aa_plip_sry
|
||||||
, aa_arpeg_sry)))
|
, aa_arpeg_sry)))
|
||||||
|
|
||||||
aa_pos_drug = aa_pos_sry
|
aa_pos_drug = aa_pos_sry
|
||||||
|
|
||||||
aa_pos_sry_hbond = sort(unique(c(
|
aa_pos_sry_hbond = sort(unique(c(
|
||||||
aa_ligplus_sry_hbond
|
aa_ligplus_sry_hbond
|
||||||
, aa_plip_sry_hbond)))
|
, aa_plip_sry_hbond)))
|
||||||
|
|
||||||
|
|
||||||
aa_pos_rna = sort(unique(c(
|
aa_pos_rna = sort(unique(c(
|
||||||
aa_ligplus_rna
|
aa_ligplus_rna
|
||||||
, aa_plip_rna)))
|
, aa_plip_rna)))
|
||||||
|
|
||||||
aa_pos_rna_hbond = sort(unique(c(
|
aa_pos_rna_hbond = sort(unique(c(
|
||||||
aa_ligplus_rna_hbond
|
aa_ligplus_rna_hbond
|
||||||
, aa_plip_rna_hbond)))
|
, aa_plip_rna_hbond)))
|
||||||
|
|
||||||
aa_pos_sam = sort(unique(c(
|
aa_pos_sam = sort(unique(c(
|
||||||
aa_ligplus_sam
|
aa_ligplus_sam
|
||||||
, aa_plip_sam
|
, aa_plip_sam
|
||||||
, aa_arpeg_sam)))
|
, aa_arpeg_sam)))
|
||||||
|
|
||||||
aa_pos_sam_hbond = sort(unique(c(
|
aa_pos_sam_hbond = sort(unique(c(
|
||||||
aa_ligplus_sam_hbond
|
aa_ligplus_sam_hbond
|
||||||
, aa_plip_sam_hbond)))
|
, aa_plip_sam_hbond)))
|
||||||
|
|
||||||
aa_pos_amp = sort(unique(c(
|
aa_pos_amp = sort(unique(c(
|
||||||
aa_ligplus_amp
|
aa_ligplus_amp
|
||||||
, aa_plip_amp
|
, aa_plip_amp
|
||||||
, aa_arpeg_amp)))
|
, aa_arpeg_amp)))
|
||||||
|
|
||||||
aa_pos_amp_hbond = sort(unique(c(
|
aa_pos_amp_hbond = sort(unique(c(
|
||||||
aa_ligplus_amp_hbond
|
aa_ligplus_amp_hbond
|
||||||
, aa_plip_amp_hbond)))
|
, aa_plip_amp_hbond)))
|
||||||
|
|
||||||
|
|
||||||
cat("\n==================================================="
|
cat("\n==================================================="
|
||||||
|
@ -129,9 +129,11 @@ cat("\n==================================================="
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# var for position customisation for plots
|
# var for position customisation for plots
|
||||||
aa_pos_lig1 = aa_pos_rna
|
aa_pos_drug
|
||||||
aa_pos_lig2 = aa_pos_sam
|
aa_pos_lig1 = aa_pos_sam
|
||||||
|
aa_pos_lig2 = aa_pos_rna
|
||||||
aa_pos_lig3 = aa_pos_amp
|
aa_pos_lig3 = aa_pos_amp
|
||||||
tile_map=data.frame(tile=c("GID","DPA","CDL","Ca"),
|
|
||||||
|
tile_map=data.frame(tile=c("SRY","SAM","RNA","AMP"),
|
||||||
tile_colour=c("green","darkslategrey","navyblue","purple"))
|
tile_colour=c("green","darkslategrey","navyblue","purple"))
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,8 @@ if (!require("ggridges")) {
|
||||||
#devtools::install_github("kassambara/ggcorrplot")
|
#devtools::install_github("kassambara/ggcorrplot")
|
||||||
|
|
||||||
if (!require ("ggbeeswarm")){
|
if (!require ("ggbeeswarm")){
|
||||||
install.packages("ggbeeswarm")
|
install.packages("ggbeeswarm")
|
||||||
library(ggbeeswarm)
|
library(ggbeeswarm)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!require("plotly")) {
|
if (!require("plotly")) {
|
||||||
|
@ -128,7 +128,7 @@ if(!require("stats4")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!require("data.table")) {
|
if(!require("data.table")) {
|
||||||
install.packages("data.table")
|
install.packages("data.table")
|
||||||
library(data.table)
|
library(data.table)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,17 +237,17 @@ consurf_palette2 = c("0" = "yellow2"
|
||||||
# )
|
# )
|
||||||
|
|
||||||
consurf_colours = c(
|
consurf_colours = c(
|
||||||
"0" = rgb(1.00,1.00,0.59)
|
"0" = rgb(1.00,1.00,0.59)
|
||||||
, "1" = rgb(0.04,0.49,0.51)
|
, "1" = rgb(0.04,0.49,0.51)
|
||||||
, "2" = rgb(0.29,0.69,0.75)
|
, "2" = rgb(0.29,0.69,0.75)
|
||||||
, "3" = rgb(0.65,0.86,0.90)
|
, "3" = rgb(0.65,0.86,0.90)
|
||||||
, "4" = rgb(0.84,0.94,0.94)
|
, "4" = rgb(0.84,0.94,0.94)
|
||||||
, "5" = rgb(1.00,1.00,1.00)
|
, "5" = rgb(1.00,1.00,1.00)
|
||||||
, "6" = rgb(0.98,0.92,0.96)
|
, "6" = rgb(0.98,0.92,0.96)
|
||||||
, "7" = rgb(0.98,0.78,0.86)
|
, "7" = rgb(0.98,0.78,0.86)
|
||||||
, "8" = rgb(0.94,0.49,0.67)
|
, "8" = rgb(0.94,0.49,0.67)
|
||||||
, "9" = rgb(0.63,0.16,0.37)
|
, "9" = rgb(0.63,0.16,0.37)
|
||||||
)
|
)
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ corr_data_extract <- function(df
|
||||||
|
|
||||||
if ( missing(colnames_to_extract) || missing(colnames_display_key) ){
|
if ( missing(colnames_to_extract) || missing(colnames_display_key) ){
|
||||||
|
|
||||||
|
# log10maf
|
||||||
df$maf2 = log10(df$maf) # can't see otherwise
|
df$maf2 = log10(df$maf) # can't see otherwise
|
||||||
sum(is.na(df$maf2))
|
sum(is.na(df$maf2))
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ corr_data_extract <- function(df
|
||||||
, "consurf_score" , "snap2_score" , "provean_score"
|
, "consurf_score" , "snap2_score" , "provean_score"
|
||||||
, "ligand_affinity_change", "mmcsm_lig"
|
, "ligand_affinity_change", "mmcsm_lig"
|
||||||
#, "ddg_dynamut", "ddg_encom", "dds_encom", "ddg_mcsm", "ddg_sdm", "ddg_duet"
|
#, "ddg_dynamut", "ddg_encom", "dds_encom", "ddg_mcsm", "ddg_sdm", "ddg_duet"
|
||||||
)
|
)
|
||||||
|
|
||||||
display_common_colnames = c( drug, "dst_mode"
|
display_common_colnames = c( drug, "dst_mode"
|
||||||
, "DUET" , "FoldX" , "DeepDDG", "Dynamut2"
|
, "DUET" , "FoldX" , "DeepDDG", "Dynamut2"
|
||||||
|
@ -51,7 +52,7 @@ corr_data_extract <- function(df
|
||||||
, "ConSurf" , "SNAP2" , "PROVEAN"
|
, "ConSurf" , "SNAP2" , "PROVEAN"
|
||||||
, "mCSM-lig", "mmCSM-lig"
|
, "mCSM-lig", "mmCSM-lig"
|
||||||
# , "Dynamut" , "ENCoM-DDG" , "mCSM" , "SDM" , "DUET-d" , "ENCoM-DDS"
|
# , "Dynamut" , "ENCoM-DDG" , "mCSM" , "SDM" , "DUET-d" , "ENCoM-DDS"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (tolower(gene)%in%geneL_normal){
|
if (tolower(gene)%in%geneL_normal){
|
||||||
colnames_to_extract = c(common_colnames)
|
colnames_to_extract = c(common_colnames)
|
||||||
|
@ -59,21 +60,21 @@ corr_data_extract <- function(df
|
||||||
corr_df = df[,colnames_to_extract]
|
corr_df = df[,colnames_to_extract]
|
||||||
colnames(corr_df) = display_colnames
|
colnames(corr_df) = display_colnames
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tolower(gene)%in%geneL_ppi2){
|
if (tolower(gene)%in%geneL_ppi2){
|
||||||
colnames_to_extract = c(common_colnames ,"mcsm_ppi2_affinity", ppi2Dist_colname)
|
colnames_to_extract = c(common_colnames ,"mcsm_ppi2_affinity", ppi2Dist_colname)
|
||||||
display_colnames = c(display_common_colnames,"mCSM-PPI2" , "PPI-Dist")
|
display_colnames = c(display_common_colnames,"mCSM-PPI2" , "PPI-Dist")
|
||||||
corr_df = df[,colnames_to_extract]
|
corr_df = df[,colnames_to_extract]
|
||||||
colnames(corr_df) = display_colnames
|
colnames(corr_df) = display_colnames
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tolower(gene)%in%geneL_na){
|
if (tolower(gene)%in%geneL_na){
|
||||||
colnames_to_extract = c(common_colnames,"mcsm_na_affinity", naDist_colname)
|
colnames_to_extract = c(common_colnames,"mcsm_na_affinity", naDist_colname)
|
||||||
display_colnames = c(display_common_colnames, "mCSM-NA", "NA-Dist")
|
display_colnames = c(display_common_colnames, "mCSM-NA", "NCA-Dist")
|
||||||
corr_df = df[,colnames_to_extract]
|
corr_df = df[,colnames_to_extract]
|
||||||
colnames(corr_df) = display_colnames
|
colnames(corr_df) = display_colnames
|
||||||
}
|
}
|
||||||
|
|
||||||
# [optional] arg: extract_scaled_cols
|
# [optional] arg: extract_scaled_cols
|
||||||
if (extract_scaled_cols){
|
if (extract_scaled_cols){
|
||||||
|
@ -98,19 +99,19 @@ corr_data_extract <- function(df
|
||||||
# colnames(corr_df)[colnames(corr_df)%in%colnames_to_extract] <- display_colnames
|
# colnames(corr_df)[colnames(corr_df)%in%colnames_to_extract] <- display_colnames
|
||||||
# colnames(corr_df)
|
# colnames(corr_df)
|
||||||
|
|
||||||
cat("\nExtracted ncols:", ncol(corr_df)
|
cat("\nExtracted ncols:", ncol(corr_df)
|
||||||
,"\nRenaming successful")
|
,"\nRenaming successful")
|
||||||
|
|
||||||
cat("\nSneak peak...")
|
cat("\nSneak peak...")
|
||||||
print(head(corr_df))
|
print(head(corr_df))
|
||||||
|
|
||||||
# Move drug column to the end
|
# Move drug column to the end
|
||||||
last_col = colnames(corr_df[ncol(corr_df)])
|
last_col = colnames(corr_df[ncol(corr_df)])
|
||||||
#corr_df_f = corr_df %>% dplyr::relocate(all_of(drug), .after = last_col)
|
#corr_df_f = corr_df %>% dplyr::relocate(all_of(drug), .after = last_col)
|
||||||
|
|
||||||
#return(corr_df_f)
|
#return(corr_df_f)
|
||||||
return(corr_df)
|
return(corr_df)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,12 +222,12 @@ dm_om_wf_lf_data <- function(df
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tolower(gene)%in%geneL_na){
|
if (tolower(gene)%in%geneL_na){
|
||||||
colnames_to_extract = c(common_colnames,"mcsm_na_affinity" , "mcsm_na_scaled" , "mcsm_na_outcome" , naDist_colname)
|
colnames_to_extract = c(common_colnames ,"mcsm_na_affinity" , "mcsm_na_scaled" , "mcsm_na_outcome" , naDist_colname)
|
||||||
display_colnames = c(display_common_colnames, "mcsm_na_affinity" , mcsm_na_dn , "mcsm_na_outcome" , na_dist_dn)
|
display_colnames = c(display_common_colnames, "mcsm_na_affinity" , mcsm_na_dn , "mcsm_na_outcome" , na_dist_dn)
|
||||||
comb_df_sl = df[, colnames_to_extract]
|
comb_df_sl = df[, colnames_to_extract]
|
||||||
|
|
||||||
# Rename cols: display names
|
# Rename cols: display names
|
||||||
colnames(comb_df) = display_colnames
|
colnames(comb_df_sl) = display_colnames
|
||||||
# Affinity filtered data: mcsm-na --> naDist_colname
|
# Affinity filtered data: mcsm-na --> naDist_colname
|
||||||
comb_df_sl_na = comb_df_sl[comb_df_sl[[na_dist_dn]]<DistCutOff,]
|
comb_df_sl_na = comb_df_sl[comb_df_sl[[na_dist_dn]]<DistCutOff,]
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ LigDist_cutoff <<- 10
|
||||||
|
|
||||||
DistCutOff <<- 10
|
DistCutOff <<- 10
|
||||||
ppi2Dist_colname <<- "interface_dist"
|
ppi2Dist_colname <<- "interface_dist"
|
||||||
naDist_colname <<- "TBC"
|
naDist_colname <<- "nca_distance" # added it
|
||||||
|
|
||||||
#==================
|
#==================
|
||||||
# Angstroms symbol
|
# Angstroms symbol
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# working dir and loading libraries
|
# working dir and loading libraries
|
||||||
getwd()
|
getwd()
|
||||||
source("~/git/LSHTM_analysis/scripts/Header_TT.R")
|
source("~/git/LSHTM_analysis/scripts/Header_TT.R")
|
||||||
|
source("~/git/LSHTM_analysis/scripts/plotting/plotting_colnames.R")
|
||||||
# cmd args passed
|
# cmd args passed
|
||||||
# in from other scripts
|
# in from other scripts
|
||||||
# to call this
|
# to call this
|
||||||
|
@ -43,7 +43,7 @@ import_dirs(drug, gene)
|
||||||
# call: plotting_data()
|
# call: plotting_data()
|
||||||
#---------------------------
|
#---------------------------
|
||||||
if (!exists("infile_params") && exists("gene")){
|
if (!exists("infile_params") && exists("gene")){
|
||||||
#if (!is.character(infile_params) && exists("gene")){ # when running as cmd
|
#if (!is.character(infile_params) && exists("gene")){ # when running as cmd
|
||||||
in_filename_params = paste0(tolower(gene), "_all_params.csv")
|
in_filename_params = paste0(tolower(gene), "_all_params.csv")
|
||||||
infile_params = paste0(outdir, "/", in_filename_params)
|
infile_params = paste0(outdir, "/", in_filename_params)
|
||||||
cat("\nInput file for mcsm comb data not specified, assuming filename: ", infile_params, "\n")
|
cat("\nInput file for mcsm comb data not specified, assuming filename: ", infile_params, "\n")
|
||||||
|
@ -70,7 +70,7 @@ cat("\nLigand distance colname:", LigDist_colname
|
||||||
# call: combining_dfs_plotting()
|
# call: combining_dfs_plotting()
|
||||||
#--------------------------------
|
#--------------------------------
|
||||||
if (!exists("infile_metadata") && exists("gene")){
|
if (!exists("infile_metadata") && exists("gene")){
|
||||||
#if (!is.character(infile_metadata) && exists("gene")){ # when running as cmd
|
#if (!is.character(infile_metadata) && exists("gene")){ # when running as cmd
|
||||||
in_filename_metadata = paste0(tolower(gene), "_metadata.csv") # part combined for gid
|
in_filename_metadata = paste0(tolower(gene), "_metadata.csv") # part combined for gid
|
||||||
infile_metadata = paste0(outdir, "/", in_filename_metadata)
|
infile_metadata = paste0(outdir, "/", in_filename_metadata)
|
||||||
cat("\nInput file for gene metadata not specified, assuming filename: ", infile_metadata, "\n")
|
cat("\nInput file for gene metadata not specified, assuming filename: ", infile_metadata, "\n")
|
||||||
|
@ -109,137 +109,137 @@ merged_df3 = all_plot_dfs[[2]]
|
||||||
####################################################################
|
####################################################################
|
||||||
# Data for logoplots
|
# Data for logoplots
|
||||||
####################################################################
|
####################################################################
|
||||||
#
|
#
|
||||||
# source(paste0(plot_script_path, "logo_data_msa.R"))
|
# source(paste0(plot_script_path, "logo_data_msa.R"))
|
||||||
# s1 = c("\nSuccessfully sourced logo_data_msa.R")
|
# s1 = c("\nSuccessfully sourced logo_data_msa.R")
|
||||||
# cat(s1)
|
# cat(s1)
|
||||||
#
|
#
|
||||||
# ####################################################################
|
# ####################################################################
|
||||||
# # Data for DM OM Plots: WF and LF dfs
|
# # Data for DM OM Plots: WF and LF dfs
|
||||||
# # My function: dm_om_wf_lf_data()
|
# # My function: dm_om_wf_lf_data()
|
||||||
# # location: scripts/functions/dm_om_data.R
|
# # location: scripts/functions/dm_om_data.R
|
||||||
# #source("other_plots_data.R")
|
# #source("other_plots_data.R")
|
||||||
# ####################################################################
|
# ####################################################################
|
||||||
#
|
#
|
||||||
# #source(paste0(plot_script_path, "dm_om_data.R")) # calling the function directly instead
|
# #source(paste0(plot_script_path, "dm_om_data.R")) # calling the function directly instead
|
||||||
# geneL_normal = c("pnca")
|
geneL_normal = c("pnca")
|
||||||
# geneL_na = c("gid", "rpob")
|
geneL_na = c("gid", "rpob")
|
||||||
# geneL_ppi2 = c("alr", "embb", "katg", "rpob")
|
geneL_ppi2 = c("alr", "embb", "katg", "rpob")
|
||||||
#
|
|
||||||
# all_dm_om_df = dm_om_wf_lf_data(df = merged_df3, gene = gene)
|
all_dm_om_df = dm_om_wf_lf_data(df = merged_df3, gene = gene)
|
||||||
#
|
|
||||||
# wf_duet = all_dm_om_df[['wf_duet']]
|
wf_duet = all_dm_om_df[['wf_duet']]
|
||||||
# lf_duet = all_dm_om_df[['lf_duet']]
|
lf_duet = all_dm_om_df[['lf_duet']]
|
||||||
#
|
|
||||||
# wf_mcsm_lig = all_dm_om_df[['wf_mcsm_lig']]
|
wf_mcsm_lig = all_dm_om_df[['wf_mcsm_lig']]
|
||||||
# lf_mcsm_lig = all_dm_om_df[['lf_mcsm_lig']]
|
lf_mcsm_lig = all_dm_om_df[['lf_mcsm_lig']]
|
||||||
#
|
|
||||||
# wf_foldx = all_dm_om_df[['wf_foldx']]
|
wf_foldx = all_dm_om_df[['wf_foldx']]
|
||||||
# lf_foldx = all_dm_om_df[['lf_foldx']]
|
lf_foldx = all_dm_om_df[['lf_foldx']]
|
||||||
#
|
|
||||||
# wf_deepddg = all_dm_om_df[['wf_deepddg']]
|
wf_deepddg = all_dm_om_df[['wf_deepddg']]
|
||||||
# lf_deepddg = all_dm_om_df[['lf_deepddg']]
|
lf_deepddg = all_dm_om_df[['lf_deepddg']]
|
||||||
#
|
|
||||||
# wf_dynamut2 = all_dm_om_df[['wf_dynamut2']]
|
wf_dynamut2 = all_dm_om_df[['wf_dynamut2']]
|
||||||
# lf_dynamut2 = all_dm_om_df[['lf_dynamut2']]
|
lf_dynamut2 = all_dm_om_df[['lf_dynamut2']]
|
||||||
#
|
|
||||||
# wf_consurf = all_dm_om_df[['wf_consurf']]
|
wf_consurf = all_dm_om_df[['wf_consurf']]
|
||||||
# lf_consurf = all_dm_om_df[['lf_consurf']]
|
lf_consurf = all_dm_om_df[['lf_consurf']]
|
||||||
#
|
|
||||||
# wf_snap2 = all_dm_om_df[['wf_snap2']]
|
wf_snap2 = all_dm_om_df[['wf_snap2']]
|
||||||
# lf_snap2 = all_dm_om_df[['lf_snap2']]
|
lf_snap2 = all_dm_om_df[['lf_snap2']]
|
||||||
#
|
|
||||||
# wf_provean = all_dm_om_df[['wf_provean']]
|
wf_provean = all_dm_om_df[['wf_provean']]
|
||||||
# lf_provean = all_dm_om_df[['lf_provean']]
|
lf_provean = all_dm_om_df[['lf_provean']]
|
||||||
#
|
|
||||||
# # NEW
|
# NEW
|
||||||
# wf_dist_gen = all_dm_om_df[['wf_dist_gen']]
|
wf_dist_gen = all_dm_om_df[['wf_dist_gen']]
|
||||||
# lf_dist_gen = all_dm_om_df[['lf_dist_gen']]
|
lf_dist_gen = all_dm_om_df[['lf_dist_gen']]
|
||||||
#
|
|
||||||
# if (tolower(gene)%in%geneL_na){
|
if (tolower(gene)%in%geneL_na){
|
||||||
# wf_mcsm_na = all_dm_om_df[['wf_mcsm_na']]
|
wf_mcsm_na = all_dm_om_df[['wf_mcsm_na']]
|
||||||
# lf_mcsm_na = all_dm_om_df[['lf_mcsm_na']]
|
lf_mcsm_na = all_dm_om_df[['lf_mcsm_na']]
|
||||||
# }
|
}
|
||||||
#
|
|
||||||
# if (tolower(gene)%in%geneL_ppi2){
|
if (tolower(gene)%in%geneL_ppi2){
|
||||||
# wf_mcsm_ppi2 = all_dm_om_df[['wf_mcsm_ppi2']]
|
wf_mcsm_ppi2 = all_dm_om_df[['wf_mcsm_ppi2']]
|
||||||
# lf_mcsm_ppi2 = all_dm_om_df[['lf_mcsm_ppi2']]
|
lf_mcsm_ppi2 = all_dm_om_df[['lf_mcsm_ppi2']]
|
||||||
# }
|
}
|
||||||
#
|
|
||||||
# s2 = c("\nSuccessfully sourced other_plots_data.R")
|
s2 = c("\nSuccessfully sourced other_plots_data.R")
|
||||||
# cat(s2)
|
cat(s2)
|
||||||
#
|
#
|
||||||
# ####################################################################
|
# ####################################################################
|
||||||
# # Data for Lineage barplots: WF and LF dfs
|
# # Data for Lineage barplots: WF and LF dfs
|
||||||
# # My function: lineage_plot_data()
|
# # My function: lineage_plot_data()
|
||||||
# # location: scripts/functions/lineage_plot_data.R
|
# # location: scripts/functions/lineage_plot_data.R
|
||||||
# ####################################################################
|
# ####################################################################
|
||||||
#
|
#
|
||||||
# #source(paste0(plot_script_path, "lineage_data.R"))
|
source(paste0(plot_script_path, "lineage_data.R"))
|
||||||
# # converted to a function. Moved lineage_data.R to redundant/
|
# # converted to a function. Moved lineage_data.R to redundant/
|
||||||
# lineage_dfL = lineage_plot_data(merged_df2
|
lineage_dfL = lineage_plot_data(merged_df2
|
||||||
# , lineage_column_name = "lineage"
|
, lineage_column_name = "lineage"
|
||||||
# , remove_empty_lineage = F
|
, remove_empty_lineage = F
|
||||||
# , lineage_label_col_name = "lineage_labels"
|
, lineage_label_col_name = "lineage_labels"
|
||||||
# , id_colname = "id"
|
, id_colname = "id"
|
||||||
# , snp_colname = "mutationinformation"
|
, snp_colname = "mutationinformation"
|
||||||
# )
|
)
|
||||||
#
|
|
||||||
# lin_wf = lineage_dfL[['lin_wf']]
|
lin_wf = lineage_dfL[['lin_wf']]
|
||||||
# lin_lf = lineage_dfL[['lin_lf']]
|
lin_lf = lineage_dfL[['lin_lf']]
|
||||||
#
|
|
||||||
# s3 = c("\nSuccessfully sourced lineage_data.R")
|
s3 = c("\nSuccessfully sourced lineage_data.R")
|
||||||
# cat(s3)
|
cat(s3)
|
||||||
#
|
|
||||||
# ####################################################################
|
####################################################################
|
||||||
# # Data for corr plots:
|
# Data for corr plots:
|
||||||
# # My function: corr_data_extract()
|
# My function: corr_data_extract()
|
||||||
# # location: scripts/functions/corr_plot_data.R
|
# location: scripts/functions/corr_plot_data.R
|
||||||
# ####################################################################
|
####################################################################
|
||||||
# # make sure the above script works because merged_df2_combined is needed
|
# make sure the above script works because merged_df2_combined is needed
|
||||||
# merged_df3 = as.data.frame(merged_df3)
|
merged_df3 = as.data.frame(merged_df3)
|
||||||
#
|
|
||||||
# corr_df_m3_f = corr_data_extract(merged_df3
|
corr_df_m3_f = corr_data_extract(merged_df3
|
||||||
|
, gene = gene
|
||||||
|
, drug = drug
|
||||||
|
, extract_scaled_cols = F)
|
||||||
|
head(corr_df_m3_f)
|
||||||
|
|
||||||
|
# corr_df_m2_f = corr_data_extract(merged_df2
|
||||||
# , gene = gene
|
# , gene = gene
|
||||||
# , drug = drug
|
# , drug = drug
|
||||||
# , extract_scaled_cols = F)
|
# , extract_scaled_cols = F)
|
||||||
# head(corr_df_m3_f)
|
# head(corr_df_m2_f)
|
||||||
#
|
|
||||||
# # corr_df_m2_f = corr_data_extract(merged_df2
|
s4 = c("\nSuccessfully sourced Corr_data.R")
|
||||||
# # , gene = gene
|
cat(s4)
|
||||||
# # , drug = drug
|
|
||||||
# # , extract_scaled_cols = F)
|
########################################################################
|
||||||
# # head(corr_df_m2_f)
|
# End of script
|
||||||
#
|
########################################################################
|
||||||
# s4 = c("\nSuccessfully sourced Corr_data.R")
|
|
||||||
# cat(s4)
|
|
||||||
#
|
|
||||||
# ########################################################################
|
|
||||||
# # End of script
|
|
||||||
# ########################################################################
|
|
||||||
# if ( all( length(s1), length(s2), length(s3), length(s4) ) > 0 ){
|
# if ( all( length(s1), length(s2), length(s3), length(s4) ) > 0 ){
|
||||||
# cat(
|
# cat(
|
||||||
# "\n##################################################"
|
# "\n##################################################"
|
||||||
# , "\nSuccessful: get_plotting_dfs.R worked!"
|
# , "\nSuccessful: get_plotting_dfs.R worked!"
|
||||||
# , "\n###################################################\n")
|
# , "\n###################################################\n")
|
||||||
# } else {
|
# } else {
|
||||||
# cat(
|
# cat(
|
||||||
# "\n#################################################"
|
# "\n#################################################"
|
||||||
# , "\nFAIL: get_plotting_dfs.R didn't complete fully!Please check"
|
# , "\nFAIL: get_plotting_dfs.R didn't complete fully!Please check"
|
||||||
# , "\n###################################################\n" )
|
# , "\n###################################################\n" )
|
||||||
# }
|
# }
|
||||||
#
|
|
||||||
# ########################################################################
|
|
||||||
# # clear excess variables: from the global enviornment
|
|
||||||
#
|
#
|
||||||
# vars0 = ls(envir = .GlobalEnv)[grepl("curr_*", ls(envir = .GlobalEnv))]
|
########################################################################
|
||||||
# vars1 = ls(envir = .GlobalEnv)[grepl("^cols_to*", ls(envir = .GlobalEnv))]
|
# clear excess variables: from the global enviornment
|
||||||
# vars2 = ls(envir = .GlobalEnv)[grepl("pivot_cols_*", ls(envir = .GlobalEnv))]
|
|
||||||
# vars3 = ls(envir = .GlobalEnv)[grepl("expected_*", ls(envir = .GlobalEnv))]
|
vars0 = ls(envir = .GlobalEnv)[grepl("curr_*", ls(envir = .GlobalEnv))]
|
||||||
#
|
vars1 = ls(envir = .GlobalEnv)[grepl("^cols_to*", ls(envir = .GlobalEnv))]
|
||||||
# rm( infile_metadata
|
vars2 = ls(envir = .GlobalEnv)[grepl("pivot_cols_*", ls(envir = .GlobalEnv))]
|
||||||
# , infile_params
|
vars3 = ls(envir = .GlobalEnv)[grepl("expected_*", ls(envir = .GlobalEnv))]
|
||||||
# , vars0
|
|
||||||
# , vars1
|
rm( infile_metadata
|
||||||
# , vars2
|
, infile_params
|
||||||
# , vars3)
|
, vars0
|
||||||
|
, vars1
|
||||||
|
, vars2
|
||||||
|
, vars3)
|
||||||
|
|
|
@ -38,18 +38,18 @@ angstroms_symbol
|
||||||
df3 = merged_df3
|
df3 = merged_df3
|
||||||
|
|
||||||
cols_to_output = c("mutationinformation"
|
cols_to_output = c("mutationinformation"
|
||||||
, "position"
|
, "position"
|
||||||
, affinity_dist_colnames[1]
|
, affinity_dist_colnames[1]
|
||||||
, "ligand_affinity_change"
|
, "ligand_affinity_change"
|
||||||
, "ligand_outcome"
|
, "ligand_outcome"
|
||||||
, "mmcsm_lig"
|
, "mmcsm_lig"
|
||||||
, "mmcsm_lig_outcome"
|
, "mmcsm_lig_outcome"
|
||||||
, affinity_dist_colnames[2]
|
, affinity_dist_colnames[2]
|
||||||
, "mcsm_ppi2_affinity"
|
, "mcsm_ppi2_affinity"
|
||||||
, "mcsm_ppi2_outcome"
|
, "mcsm_ppi2_outcome"
|
||||||
, "maf"
|
, "maf"
|
||||||
, "or_mychisq"
|
, "or_mychisq"
|
||||||
, "pval_fisher")
|
, "pval_fisher")
|
||||||
|
|
||||||
cols_to_output
|
cols_to_output
|
||||||
df3_output = df3[, cols_to_output]
|
df3_output = df3[, cols_to_output]
|
||||||
|
@ -65,12 +65,12 @@ colnames(df3_output)
|
||||||
df3_output$p_adj_fdr = p.adjust(df3_output$pval_fisher, method = "fdr")
|
df3_output$p_adj_fdr = p.adjust(df3_output$pval_fisher, method = "fdr")
|
||||||
df3_output$signif_fdr = df3_output$p_adj_fdr
|
df3_output$signif_fdr = df3_output$p_adj_fdr
|
||||||
df3_output = dplyr::mutate(df3_output
|
df3_output = dplyr::mutate(df3_output
|
||||||
, signif_fdr = case_when(signif_fdr == 0.05 ~ "."
|
, signif_fdr = case_when(signif_fdr == 0.05 ~ "."
|
||||||
, signif_fdr <=0.0001 ~ '****'
|
, signif_fdr <=0.0001 ~ '****'
|
||||||
, signif_fdr <=0.001 ~ '***'
|
, signif_fdr <=0.001 ~ '***'
|
||||||
, signif_fdr <=0.01 ~ '**'
|
, signif_fdr <=0.01 ~ '**'
|
||||||
, signif_fdr <0.05 ~ '*'
|
, signif_fdr <0.05 ~ '*'
|
||||||
, TRUE ~ 'ns'))
|
, TRUE ~ 'ns'))
|
||||||
# rounding
|
# rounding
|
||||||
df3_output$or_mychisq = round(df3_output$or_mychisq,2)
|
df3_output$or_mychisq = round(df3_output$or_mychisq,2)
|
||||||
df3_output$p_adj_fdr = round(df3_output$p_adj_fdr,2)
|
df3_output$p_adj_fdr = round(df3_output$p_adj_fdr,2)
|
||||||
|
@ -101,17 +101,17 @@ head(df3_output)
|
||||||
df_lig = df3_output[df3_output[[LigDist_colname]]<DistCutOff,]
|
df_lig = df3_output[df3_output[[LigDist_colname]]<DistCutOff,]
|
||||||
|
|
||||||
cols_to_output_lig = c("mutationinformation"
|
cols_to_output_lig = c("mutationinformation"
|
||||||
, "position"
|
, "position"
|
||||||
, LigDist_colname
|
, LigDist_colname
|
||||||
, "ligand_affinity_change"
|
, "ligand_affinity_change"
|
||||||
, "ligand_outcome"
|
, "ligand_outcome"
|
||||||
, "mmcsm_lig"
|
, "mmcsm_lig"
|
||||||
, "mmcsm_lig_outcome"
|
, "mmcsm_lig_outcome"
|
||||||
, "maf_percent"
|
, "maf_percent"
|
||||||
, "or_mychisq"
|
, "or_mychisq"
|
||||||
, "pval_fisher"
|
, "pval_fisher"
|
||||||
, "p_adj_fdr"
|
, "p_adj_fdr"
|
||||||
, "signif_fdr")
|
, "signif_fdr")
|
||||||
# select cols
|
# select cols
|
||||||
Out_df_lig = df_lig[, cols_to_output_lig]
|
Out_df_lig = df_lig[, cols_to_output_lig]
|
||||||
|
|
||||||
|
@ -123,17 +123,17 @@ Out_df_ligS = Out_df_lig[order(-Out_df_lig$or_mychisq, Out_df_lig$maf_percent),
|
||||||
head(Out_df_ligS); tail(Out_df_ligS)
|
head(Out_df_ligS); tail(Out_df_ligS)
|
||||||
|
|
||||||
colsNames_to_output_lig = c("Mutation"
|
colsNames_to_output_lig = c("Mutation"
|
||||||
, "position"
|
, "position"
|
||||||
, paste0("Lig-Dist (", angstroms_symbol, ")")
|
, paste0("Lig-Dist (", angstroms_symbol, ")")
|
||||||
, "mCSM-ligand affinity"
|
, "mCSM-ligand affinity"
|
||||||
, "mCSM ligand_outcome"
|
, "mCSM ligand_outcome"
|
||||||
, "mmCSM-ligand affinity"
|
, "mmCSM-ligand affinity"
|
||||||
, "mmCSM ligand_outcome"
|
, "mmCSM ligand_outcome"
|
||||||
, paste0("MAF ","(%)")
|
, paste0("MAF ","(%)")
|
||||||
, "Odds Ratio"
|
, "Odds Ratio"
|
||||||
, "P-value"
|
, "P-value"
|
||||||
, "Adjusted P-value"
|
, "Adjusted P-value"
|
||||||
, "P-value significance")
|
, "Adjusted P-value significance")
|
||||||
|
|
||||||
colnames(Out_df_ligS) = colsNames_to_output_lig
|
colnames(Out_df_ligS) = colsNames_to_output_lig
|
||||||
head(Out_df_ligS)
|
head(Out_df_ligS)
|
||||||
|
@ -142,8 +142,8 @@ head(Out_df_ligS)
|
||||||
# write output file: KS test within grpup
|
# write output file: KS test within grpup
|
||||||
#----------------------
|
#----------------------
|
||||||
Out_ligT = paste0(outdir_stats
|
Out_ligT = paste0(outdir_stats
|
||||||
, tolower(gene)
|
, tolower(gene)
|
||||||
, "_lig_muts.csv")
|
, "_lig_muts.csv")
|
||||||
|
|
||||||
cat("Output of Ligand muts:", Out_ligT )
|
cat("Output of Ligand muts:", Out_ligT )
|
||||||
write.csv(Out_df_ligS, Out_ligT, row.names = FALSE)
|
write.csv(Out_df_ligS, Out_ligT, row.names = FALSE)
|
||||||
|
@ -179,12 +179,13 @@ Out_df_ppi2S = Out_df_ppi2[order(-Out_df_ppi2$or_mychisq, Out_df_ppi2$maf_percen
|
||||||
colsNames_to_output_ppi2 = c("Mutation"
|
colsNames_to_output_ppi2 = c("Mutation"
|
||||||
, "position"
|
, "position"
|
||||||
, paste0("PPI2-Dist (", angstroms_symbol, ")")
|
, paste0("PPI2-Dist (", angstroms_symbol, ")")
|
||||||
, paste0("mCSM-PPI2 (", delta_symbol, ")")
|
, paste0("mCSM-PPI2 (", delta_symbol,delta_symbol,"G)")
|
||||||
, "mCSM-PPI2 outcome"
|
, "mCSM-PPI2 outcome"
|
||||||
|
, paste0("MAF ","(%)")
|
||||||
, "Odds Ratio"
|
, "Odds Ratio"
|
||||||
, "P-value"
|
, "P-value"
|
||||||
, "Adjusted P-value"
|
, "Adjusted P-value"
|
||||||
, "P-value significance")
|
, "Adjusted P-value significance")
|
||||||
|
|
||||||
colnames(Out_df_ppi2S) = colsNames_to_output_ppi2
|
colnames(Out_df_ppi2S) = colsNames_to_output_ppi2
|
||||||
Out_df_ppi2S
|
Out_df_ppi2S
|
||||||
|
|
753
scripts/plotting/plotting_thesis/basic_barplots.R
Executable file → Normal file
753
scripts/plotting/plotting_thesis/basic_barplots.R
Executable file → Normal file
|
@ -25,23 +25,28 @@
|
||||||
#=============
|
#=============
|
||||||
# Data: Input
|
# Data: Input
|
||||||
#==============
|
#==============
|
||||||
#source("~/git/LSHTM_analysis/config/alr.R")
|
|
||||||
source("~/git/LSHTM_analysis/config/embb.R")
|
|
||||||
#source("~/git/LSHTM_analysis/config/katg.R")
|
|
||||||
#source("~/git/LSHTM_analysis/config/gid.R")
|
|
||||||
#source("~/git/LSHTM_analysis/config/pnca.R")
|
#source("~/git/LSHTM_analysis/config/pnca.R")
|
||||||
|
#source("~/git/LSHTM_analysis/config/embb.R")
|
||||||
|
#source("~/git/LSHTM_analysis/config/gid.R")
|
||||||
|
|
||||||
|
#source("~/git/LSHTM_analysis/config/alr.R")
|
||||||
|
source("~/git/LSHTM_analysis/config/katg.R")
|
||||||
#source("~/git/LSHTM_analysis/config/rpob.R")
|
#source("~/git/LSHTM_analysis/config/rpob.R")
|
||||||
|
|
||||||
source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.R")
|
source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.R")
|
||||||
source("~/git/LSHTM_analysis/scripts/plotting/plotting_colnames.R")
|
#source("~/git/LSHTM_analysis/scripts/plotting/plotting_colnames.R") sourced by above
|
||||||
|
# sanity check
|
||||||
|
|
||||||
|
cat("\nSourced plotting cols as well:", length(plotting_cols))
|
||||||
|
|
||||||
|
####################################################
|
||||||
class(merged_df3)
|
class(merged_df3)
|
||||||
merged_df3 = as.data.frame(merged_df3)
|
merged_df3 = as.data.frame(merged_df3)
|
||||||
|
|
||||||
class(df3)
|
class(merged_df3)
|
||||||
head(merged_df3$pos_count)
|
head(merged_df3$pos_count)
|
||||||
|
|
||||||
nc_pc_CHANGE = which(colnames(merged_df3)== "pos_count")
|
nc_pc_CHANGE = which(colnames(merged_df3)== "pos_count"); nc_pc_CHANGE
|
||||||
colnames(merged_df3)[nc_pc_CHANGE] = "df2_pos_count_all"
|
colnames(merged_df3)[nc_pc_CHANGE] = "df2_pos_count_all"
|
||||||
head(merged_df3$pos_count)
|
head(merged_df3$pos_count)
|
||||||
head(merged_df3$df2_pos_count_all)
|
head(merged_df3$df2_pos_count_all)
|
||||||
|
@ -52,8 +57,7 @@ merged_df3 = merged_df3[, !colnames(merged_df3)%in%c("pos_count")]
|
||||||
head(merged_df3$pos_count)
|
head(merged_df3$pos_count)
|
||||||
|
|
||||||
df3 = merged_df3[, colnames(merged_df3)%in%plotting_cols]
|
df3 = merged_df3[, colnames(merged_df3)%in%plotting_cols]
|
||||||
|
#"nca_distance"%in%colnames(df3)
|
||||||
|
|
||||||
|
|
||||||
#=======
|
#=======
|
||||||
# output
|
# output
|
||||||
|
@ -62,192 +66,9 @@ outdir_images = paste0("~/git/Writing/thesis/images/results/", tolower(gene), "/
|
||||||
cat("plots will output to:", outdir_images)
|
cat("plots will output to:", outdir_images)
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
# ConSurf labels
|
|
||||||
|
|
||||||
|
|
||||||
#------------------------------
|
#------------------------------
|
||||||
# plot default sizes
|
# plot default sizes
|
||||||
#------------------------------
|
#------------------------------
|
||||||
sts = 22
|
|
||||||
subtitle_colour = "black"
|
|
||||||
geom_ls = 10
|
|
||||||
##############################################################
|
|
||||||
#------------------------------
|
|
||||||
# stability barplots:
|
|
||||||
outcome_stability_cols
|
|
||||||
# label_categories should be = levels(as.factor(plot_df[[df_colname]]))
|
|
||||||
#-------------------------
|
|
||||||
|
|
||||||
# duetP
|
|
||||||
duetP = stability_count_bp(plotdf = df3
|
|
||||||
, df_colname = "duet_outcome"
|
|
||||||
, leg_title = "mCSM-DUET"
|
|
||||||
#, label_categories = labels_duet
|
|
||||||
, yaxis_title = "Number of nsSNPs"
|
|
||||||
, leg_position = "none"
|
|
||||||
, subtitle_text = "mCSM-DUET"
|
|
||||||
, geom_ls = geom_ls
|
|
||||||
, bar_fill_values = c("#F8766D", "#00BFC4")
|
|
||||||
, sts = sts
|
|
||||||
, subtitle_colour= subtitle_colour)
|
|
||||||
|
|
||||||
# foldx
|
|
||||||
foldxP = stability_count_bp(plotdf = df3
|
|
||||||
, df_colname = "foldx_outcome"
|
|
||||||
#, leg_title = "FoldX"
|
|
||||||
#, label_categories = labels_foldx
|
|
||||||
, yaxis_title = ""
|
|
||||||
, leg_position = "none"
|
|
||||||
, subtitle_text = "FoldX"
|
|
||||||
, geom_ls = geom_ls
|
|
||||||
, bar_fill_values = c("#F8766D", "#00BFC4")
|
|
||||||
, sts = sts
|
|
||||||
, subtitle_colour= subtitle_colour)
|
|
||||||
|
|
||||||
|
|
||||||
# deepddg
|
|
||||||
deepddgP = stability_count_bp(plotdf = df3
|
|
||||||
, df_colname = "deepddg_outcome"
|
|
||||||
#, leg_title = "DeepDDG"
|
|
||||||
#, label_categories = labels_deepddg
|
|
||||||
, yaxis_title = "Number of nsSNPs"
|
|
||||||
, leg_position = "none"
|
|
||||||
, subtitle_text = "DeepDDG"
|
|
||||||
, geom_ls = geom_ls
|
|
||||||
, bar_fill_values = c("#F8766D", "#00BFC4")
|
|
||||||
, sts = sts
|
|
||||||
, subtitle_colour= subtitle_colour)
|
|
||||||
|
|
||||||
|
|
||||||
# deepddg
|
|
||||||
dynamut2P = stability_count_bp(plotdf = df3
|
|
||||||
, df_colname = "ddg_dynamut2_outcome"
|
|
||||||
#, leg_title = "Dynamut2"
|
|
||||||
#, label_categories = labels_ddg_dynamut2_outcome
|
|
||||||
, yaxis_title = ""
|
|
||||||
, leg_position = "none"
|
|
||||||
, subtitle_text = "Dynamut2"
|
|
||||||
, geom_ls = geom_ls
|
|
||||||
, bar_fill_values = c("#F8766D", "#00BFC4")
|
|
||||||
, sts = sts
|
|
||||||
, subtitle_colour= subtitle_colour)
|
|
||||||
|
|
||||||
dynamut2P
|
|
||||||
|
|
||||||
# # extract common legend
|
|
||||||
# common_legend = get_legend(duetP +
|
|
||||||
# guides(color = guide_legend(nrow = 1)) +
|
|
||||||
# theme(legend.position = "top"))
|
|
||||||
#
|
|
||||||
# #==========================
|
|
||||||
# #output: STABILITY PLOTS
|
|
||||||
# #===========================
|
|
||||||
# bp_stability_CLP = paste0(outdir_images
|
|
||||||
# , tolower(gene)
|
|
||||||
# ,"_bp_stability_CL.svg")
|
|
||||||
#
|
|
||||||
# svg(bp_stability_CLP, width = 15, height = 12)
|
|
||||||
# print(paste0("plot filename:", bp_stability_CLP))
|
|
||||||
#
|
|
||||||
# cowplot::plot_grid(
|
|
||||||
# common_legend,
|
|
||||||
# cowplot::plot_grid(duetP, foldxP
|
|
||||||
# , deepddgP, dynamut2P
|
|
||||||
# , nrow = 2
|
|
||||||
# , ncol = 2
|
|
||||||
# #, labels = c("(a)", "(b)", "(c)", "(d)")
|
|
||||||
# , labels = "AUTO"
|
|
||||||
# , label_size = 25)
|
|
||||||
# , ncol = 1
|
|
||||||
# , nrow = 2
|
|
||||||
# , rel_heights = c(0.4/10,9/10))
|
|
||||||
#
|
|
||||||
# dev.off()
|
|
||||||
###########################################################
|
|
||||||
#=========================
|
|
||||||
# Conservation outcome
|
|
||||||
# check this var:
|
|
||||||
outcome_conservation_cols
|
|
||||||
all(df3$consurf_colour_rev == df3$consurf_outcome)
|
|
||||||
#df3["consurf_outcome"] = as.factor(df3["consurf_outcome"])
|
|
||||||
levels(df3[["consurf_outcome"]])
|
|
||||||
|
|
||||||
#==========================
|
|
||||||
table(df3$consurf_outcome)
|
|
||||||
ggplot(df3, aes_string(x = "consurf_outcome")) +
|
|
||||||
geom_bar(aes(fill = eval(parse(text = "consurf_outcome")))
|
|
||||||
, show.legend = TRUE) +
|
|
||||||
scale_fill_manual(name = ""
|
|
||||||
, values = consurf_colours
|
|
||||||
#, labels = levels(df3[["snap2_outcome"]])
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# consurf# had to turn label categories off for consurf
|
|
||||||
consurfP = stability_count_bp(plotdf = df3
|
|
||||||
, df_colname = "consurf_outcome"
|
|
||||||
#, leg_title = "ConSurf"
|
|
||||||
#, label_categories = labels_consurf
|
|
||||||
, yaxis_title = "Number of nsSNPs"
|
|
||||||
, leg_position = "top"
|
|
||||||
, subtitle_text = "ConSurf"
|
|
||||||
, geom_ls = 5
|
|
||||||
, bar_fill_values = consurf_colours # from globals
|
|
||||||
, sts = sts
|
|
||||||
, subtitle_colour= subtitle_colour)
|
|
||||||
|
|
||||||
consurfP
|
|
||||||
|
|
||||||
# provean
|
|
||||||
proveanP = stability_count_bp(plotdf = df3
|
|
||||||
, df_colname = "provean_outcome"
|
|
||||||
#, leg_title = "PROVEAN"
|
|
||||||
#, label_categories = labels_provean
|
|
||||||
, yaxis_title = ""
|
|
||||||
, leg_position = "top"
|
|
||||||
, subtitle_text = "PROVEAN"
|
|
||||||
, geom_ls = geom_ls
|
|
||||||
, bar_fill_values = c("#D01C8B", "#F1B6DA") # light pink and deep
|
|
||||||
, sts = sts
|
|
||||||
, subtitle_colour= subtitle_colour)
|
|
||||||
|
|
||||||
# snap2
|
|
||||||
snap2P = stability_count_bp(plotdf = df3
|
|
||||||
, df_colname = "snap2_outcome"
|
|
||||||
#, leg_title = "SNAP2"
|
|
||||||
#, label_categories = labels_snap2
|
|
||||||
, yaxis_title = ""
|
|
||||||
, leg_position = "top"
|
|
||||||
, subtitle_text = "SNAP2"
|
|
||||||
, geom_ls = geom_ls
|
|
||||||
, bar_fill_values = c("#D01C8B", "#F1B6DA") # light pink and deep
|
|
||||||
, sts = sts
|
|
||||||
, subtitle_colour= subtitle_colour)
|
|
||||||
|
|
||||||
|
|
||||||
#============================
|
|
||||||
# output: CONSERVATION PLOTS
|
|
||||||
#============================
|
|
||||||
# bp_conservation_CLP = paste0(outdir_images
|
|
||||||
# ,tolower(gene)
|
|
||||||
# ,"_bp_conservation_CL.svg" )
|
|
||||||
#
|
|
||||||
# print(paste0("plot filename:", bp_conservation_CLP))
|
|
||||||
# svg(bp_conservation_CLP, width = 15, height = 6.5)
|
|
||||||
#
|
|
||||||
# cowplot::plot_grid(proveanP, snap2P, consurfP
|
|
||||||
# , nrow = 1
|
|
||||||
# , ncol = 3
|
|
||||||
# #, labels = c("(a)", "(b)", "(c)", "(d)")
|
|
||||||
# , labels = "AUTO"
|
|
||||||
# , label_size = 25
|
|
||||||
# #, rel_heights = c(0.4/10,9/10))
|
|
||||||
# , rel_widths = c(0.9, 0.9, 1.1))
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# dev.off()
|
|
||||||
|
|
||||||
###########################################################
|
|
||||||
#=========================
|
#=========================
|
||||||
# Affinity outcome
|
# Affinity outcome
|
||||||
# check this var: outcome_cols_affinity
|
# check this var: outcome_cols_affinity
|
||||||
|
@ -272,17 +93,19 @@ common_bp_title = paste0("Sites <", DistCutOff, angstroms_symbol)
|
||||||
mLigP = stability_count_bp(plotdf = df3_lig
|
mLigP = stability_count_bp(plotdf = df3_lig
|
||||||
, df_colname = "ligand_outcome"
|
, df_colname = "ligand_outcome"
|
||||||
#, leg_title = "mCSM-lig"
|
#, leg_title = "mCSM-lig"
|
||||||
#, label_categories = labels_lig
|
#, bp_plot_title = paste(common_bp_title, "ligand")
|
||||||
, yaxis_title = "Number of nsSNPs"
|
, yaxis_title = "Number of nsSNPs"
|
||||||
, leg_position = "none"
|
, leg_position = "none"
|
||||||
, subtitle_text = "mCSM-lig"
|
, subtitle_text = "mCSM-lig"
|
||||||
, geom_ls = geom_ls
|
|
||||||
, bar_fill_values = c("#F8766D", "#00BFC4")
|
, bar_fill_values = c("#F8766D", "#00BFC4")
|
||||||
, sts = sts
|
, subtitle_colour= "black"
|
||||||
, subtitle_colour= subtitle_colour
|
, sts = 10
|
||||||
#, bp_plot_title = paste(common_bp_title, "ligand")
|
, lts = 8
|
||||||
)
|
, ats = 12
|
||||||
|
, als = 11
|
||||||
|
, ltis = 11
|
||||||
|
, geom_ls = 2.5)
|
||||||
|
mLigP
|
||||||
#------------------------------
|
#------------------------------
|
||||||
# barplot for ligand affinity:
|
# barplot for ligand affinity:
|
||||||
# <10 Ang of ligand
|
# <10 Ang of ligand
|
||||||
|
@ -292,236 +115,74 @@ mmLigP = stability_count_bp(plotdf = df3_lig
|
||||||
, df_colname = "mmcsm_lig_outcome"
|
, df_colname = "mmcsm_lig_outcome"
|
||||||
#, leg_title = "mmCSM-lig"
|
#, leg_title = "mmCSM-lig"
|
||||||
#, label_categories = labels_mmlig
|
#, label_categories = labels_mmlig
|
||||||
|
#, bp_plot_title = paste(common_bp_title, "ligand")
|
||||||
|
|
||||||
, yaxis_title = ""
|
, yaxis_title = ""
|
||||||
, leg_position = "none"
|
, leg_position = "none"
|
||||||
, subtitle_text = "mmCSM-lig"
|
, subtitle_text = "mmCSM-lig"
|
||||||
, geom_ls = geom_ls
|
|
||||||
, bar_fill_values = c("#F8766D", "#00BFC4")
|
, bar_fill_values = c("#F8766D", "#00BFC4")
|
||||||
, sts = sts
|
, subtitle_colour= "black"
|
||||||
, subtitle_colour= subtitle_colour
|
, sts = 10
|
||||||
#, bp_plot_title = paste(common_bp_title, "ligand")
|
, lts = 8
|
||||||
|
, ats = 12
|
||||||
|
, als = 11
|
||||||
|
, ltis = 11
|
||||||
|
, geom_ls = 2.5
|
||||||
)
|
)
|
||||||
|
mmLigP
|
||||||
#------------------------------
|
#------------------------------
|
||||||
# barplot for ppi2 affinity
|
# barplot for ppi2 affinity
|
||||||
# <10 Ang of interface
|
# <10 Ang of interface
|
||||||
#------------------------------
|
#------------------------------
|
||||||
ppi2P = stability_count_bp(plotdf = df3_ppi2
|
if (tolower(gene)%in%geneL_ppi2){
|
||||||
, df_colname = "mcsm_ppi2_outcome"
|
ppi2P = stability_count_bp(plotdf = df3_ppi2
|
||||||
#, leg_title = "mCSM-ppi2"
|
, df_colname = "mcsm_ppi2_outcome"
|
||||||
#, label_categories = labels_ppi2
|
#, leg_title = "mCSM-ppi2"
|
||||||
, yaxis_title = ""
|
#, label_categories = labels_ppi2
|
||||||
, leg_position = "none"
|
#, bp_plot_title = paste(common_bp_title, "PP-interface")
|
||||||
, subtitle_text = "mCSM-ppi2"
|
|
||||||
, geom_ls = geom_ls
|
, yaxis_title = "Number of nsSNPs"
|
||||||
, bar_fill_values = c("#F8766D", "#00BFC4")
|
, leg_position = "none"
|
||||||
, sts = sts
|
, subtitle_text = "mCSM-ppi2"
|
||||||
, subtitle_colour= subtitle_colour
|
, bar_fill_values = c("#F8766D", "#00BFC4")
|
||||||
, bp_plot_title = paste(common_bp_title, "interface")
|
, subtitle_colour= "black"
|
||||||
)
|
, sts = 10
|
||||||
|
, lts = 8
|
||||||
# # extract common legend
|
, ats = 12
|
||||||
# common_legend_aff = get_legend(mLigP +
|
, als = 11
|
||||||
# guides(color = guide_legend(nrow = 1)) +
|
, ltis = 11
|
||||||
# theme(legend.position = "top"))
|
, geom_ls = 2.5
|
||||||
#
|
)
|
||||||
# #==========================
|
ppi2P
|
||||||
# # output: AFFINITY PLOTS
|
}
|
||||||
# #==========================
|
#----------------------------
|
||||||
# bp_affinity_CLP = paste0(outdir_images
|
# barplot for ppi2 affinity
|
||||||
# ,tolower(gene)
|
# <10 Ang of interface
|
||||||
# ,"_bp_affinity_CL.svg" )
|
#------------------------------
|
||||||
#
|
if (tolower(gene)%in%geneL_na){
|
||||||
# print(paste0("plot filename:", bp_stability_CLP))
|
|
||||||
# svg(bp_affinity_CLP, width = 15, height = 6.5)
|
nca_distP = stability_count_bp(plotdf = df3_na
|
||||||
#
|
, df_colname = "mcsm_na_outcome"
|
||||||
# cowplot::plot_grid(
|
#, leg_title = "mCSM-NA"
|
||||||
# common_legend,
|
#, label_categories =
|
||||||
# cowplot::plot_grid(mLigP, mmLigP
|
#, bp_plot_title = paste(common_bp_title, "Dist to NA")
|
||||||
# , ppi2P
|
|
||||||
# , nrow = 1
|
, yaxis_title = "Number of nsSNPs"
|
||||||
# , ncol = 3
|
, leg_position = "none"
|
||||||
# #, labels = c("(a)", "(b)", "(c)", "(d)")
|
, subtitle_text = "mCSM-NA"
|
||||||
# , labels = "AUTO"
|
, bar_fill_values = c("#F8766D", "#00BFC4")
|
||||||
# , label_size = 25)
|
, subtitle_colour= "black"
|
||||||
# , ncol = 1
|
, sts = 10
|
||||||
# , nrow = 2
|
, lts = 8
|
||||||
# , rel_heights = c(0.4/10,9/10))
|
, ats = 12
|
||||||
# #, rel_widths = c(1,1,1))
|
, als = 11
|
||||||
#
|
, ltis = 11
|
||||||
#
|
, geom_ls = 2.5
|
||||||
# dev.off()
|
)
|
||||||
|
nca_distP
|
||||||
################################################################
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
#============
|
|
||||||
# Plot labels
|
|
||||||
#============
|
|
||||||
tit1 = "Stability outcome"
|
|
||||||
tit2 = "Affinity outcome"
|
|
||||||
tit3 = "Conservation outcome"
|
|
||||||
pt_size = 30
|
|
||||||
|
|
||||||
|
|
||||||
theme_georgia <- function(...) {
|
|
||||||
theme_gray(base_family = "sans", ...) +
|
|
||||||
theme(plot.title = element_text(face = "bold"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
title_theme <- calc_element("plot.title", theme_georgia())
|
|
||||||
|
|
||||||
pt1 = ggdraw() +
|
|
||||||
draw_label(
|
|
||||||
tit1,
|
|
||||||
fontfamily = title_theme$family,
|
|
||||||
fontface = title_theme$face,
|
|
||||||
#size = title_theme$size
|
|
||||||
size = pt_size
|
|
||||||
)
|
|
||||||
|
|
||||||
pt2 = ggdraw() +
|
|
||||||
draw_label(
|
|
||||||
tit2,
|
|
||||||
fontfamily = title_theme$family,
|
|
||||||
fontface = title_theme$face,
|
|
||||||
size = pt_size
|
|
||||||
)
|
|
||||||
|
|
||||||
pt3 = ggdraw() +
|
|
||||||
draw_label(
|
|
||||||
tit3,
|
|
||||||
fontfamily = title_theme$family,
|
|
||||||
fontface = title_theme$face,
|
|
||||||
size = pt_size
|
|
||||||
)
|
|
||||||
|
|
||||||
# extract common legend
|
|
||||||
common_legend_outcome = get_legend(mLigP +
|
|
||||||
guides(color = guide_legend(nrow = 1)) +
|
|
||||||
theme(legend.position = "top"))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
my_label_size = 25
|
|
||||||
#======================
|
|
||||||
# Output plot function
|
|
||||||
#======================
|
|
||||||
OutPlotBP = function(x){
|
|
||||||
cowplot::plot_grid(
|
|
||||||
cowplot::plot_grid(pt1,
|
|
||||||
common_legend_outcome,
|
|
||||||
cowplot::plot_grid( duetP, foldxP
|
|
||||||
, deepddgP, dynamut2P
|
|
||||||
, nrow = 2
|
|
||||||
, ncol = 2
|
|
||||||
, labels = c("A", "B", "C","D")
|
|
||||||
, label_size = my_label_size
|
|
||||||
)
|
|
||||||
, ncol = 1
|
|
||||||
, rel_heights = c(7, 3, 90)),
|
|
||||||
|
|
||||||
cowplot::plot_grid(pt2,
|
|
||||||
cowplot::plot_grid(mLigP, mmLigP, ppi2P
|
|
||||||
, nrow = 1
|
|
||||||
, ncol = 3
|
|
||||||
, labels = c("E","F", "G")
|
|
||||||
, label_size = my_label_size
|
|
||||||
)
|
|
||||||
, ncol = 1
|
|
||||||
, rel_heights = c(1, 9)),
|
|
||||||
|
|
||||||
cowplot::plot_grid(pt3,
|
|
||||||
cowplot::plot_grid(consurfP, proveanP, snap2P
|
|
||||||
, nrow = 1
|
|
||||||
, ncol = 3
|
|
||||||
, labels = c("H", "I", "J")
|
|
||||||
, labels_x = 0.2
|
|
||||||
, label_size = my_label_size
|
|
||||||
, rel_widths = c(0.2, 0.2, 0.2)
|
|
||||||
)
|
|
||||||
, ncol = 1
|
|
||||||
, rel_heights = c(0.07, 0.93)
|
|
||||||
),
|
|
||||||
|
|
||||||
nrow = 3,
|
|
||||||
rel_heights = c(0.58, 0.25, 0.27),
|
|
||||||
align = "hv"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
#=====================
|
|
||||||
# OutPlot: svg and png
|
|
||||||
#======================
|
|
||||||
#ratio 11.69 by 8.27
|
|
||||||
w = 8.27*2
|
|
||||||
h = 11.69*2
|
|
||||||
|
|
||||||
#svg
|
|
||||||
bp_all_CLP = paste0(outdir_images
|
|
||||||
,tolower(gene)
|
|
||||||
,"_bp_all_CL.svg")
|
|
||||||
cat(paste0("plot filename:", bp_all_CLP))
|
|
||||||
|
|
||||||
svg(bp_all_CLP, width = w, height = h)
|
|
||||||
OutPlotBP()
|
|
||||||
dev.off()
|
|
||||||
|
|
||||||
#png
|
|
||||||
bp_all_CLP_png = paste0(outdir_images
|
|
||||||
,tolower(gene)
|
|
||||||
,"_bp_all_CL.png")
|
|
||||||
cat(paste0("plot filename:", bp_all_CLP_png))
|
|
||||||
|
|
||||||
png(bp_all_CLP_png, width = w, height = h, units = "in", res = 300 )
|
|
||||||
OutPlotBP()
|
|
||||||
dev.off()
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# test
|
|
||||||
#
|
|
||||||
# setDT(df3)[, pos_count2 := .N, by = .(eval(parse(text = "position")))]
|
|
||||||
# foo = df3[, c("mutationinformation", "position")]
|
|
||||||
# df4 = foo[, c("mutationinformation", "position")]
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# var_pos = "position"
|
|
||||||
# df4 =
|
|
||||||
# df4 %>%
|
|
||||||
# dplyr::add_count(eval(parse(text = var_pos)))
|
|
||||||
#
|
|
||||||
# class(df4)
|
|
||||||
# df4 = as.data.frame(df4)
|
|
||||||
# class(df4)
|
|
||||||
# nc_change = which(colnames(df4) == "n")
|
|
||||||
# colnames(df4)[nc_change] <- "pos_count"
|
|
||||||
# class(df4)
|
|
||||||
#
|
|
||||||
# setDT(df4)[, pos_count2 := .N, by = .(eval(parse(text = "position")))]
|
|
||||||
# class(df4)
|
|
||||||
#
|
|
||||||
# all(df4$pos_count==df4$pos_count2)
|
|
||||||
#
|
|
||||||
# # %>%
|
|
||||||
# #group_by(pos_count = position)
|
|
||||||
#
|
|
||||||
# # df4 =
|
|
||||||
# # df4 %>%
|
|
||||||
# # dplyr::group_by(position) %>%
|
|
||||||
# # count(position)
|
|
||||||
#foo2 = df4[, c("mutationinformation", "position", "pos_count")]
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
# ------------------------------
|
|
||||||
# bp site site count: ALL
|
|
||||||
# <10 Ang ligand
|
|
||||||
# ------------------------------
|
|
||||||
posC_all = site_snp_count_bp(plotdf = df3
|
|
||||||
, df_colname = "position"
|
|
||||||
, xaxis_title = "Number of nsSNPs"
|
|
||||||
, yaxis_title = "Number of Sites"
|
|
||||||
, subtitle_size = 20)
|
|
||||||
|
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
# bp site site count: mCSM-lig
|
# bp site site count: mCSM-lig
|
||||||
|
@ -532,55 +193,233 @@ common_bp_title = paste0("Sites <", DistCutOff, angstroms_symbol)
|
||||||
posC_lig = site_snp_count_bp(plotdf = df3_lig
|
posC_lig = site_snp_count_bp(plotdf = df3_lig
|
||||||
, df_colname = "position"
|
, df_colname = "position"
|
||||||
, xaxis_title = "Number of nsSNPs"
|
, xaxis_title = "Number of nsSNPs"
|
||||||
, yaxis_title = "Number of Sites"#+ annotate("text", x = 1.5, y = 2.2, label = "Text No. 1")
|
, yaxis_title = "Number of Sites"
|
||||||
#, subtitle_text = paste0(common_bp_title, " ligand")
|
, subtitle_colour = "chocolate4"
|
||||||
|
, subtitle_text = ""
|
||||||
, subtitle_size = 8
|
, subtitle_size = 8
|
||||||
, subtitle_colour = subtitle_colour)
|
, geom_ls = 2.6
|
||||||
|
, leg_text_size = 10
|
||||||
|
, axis_text_size = 10
|
||||||
|
, axis_label_size = 10)
|
||||||
|
|
||||||
posC_lig
|
posC_lig
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
# bp site site count: ppi2
|
# bp site site count: ppi2
|
||||||
# < 10 Ang interface
|
# < 10 Ang interface
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
|
if (tolower(gene)%in%geneL_ppi2){
|
||||||
|
|
||||||
|
posC_ppi2 = site_snp_count_bp(plotdf = df3_ppi2
|
||||||
|
, df_colname = "position"
|
||||||
|
, xaxis_title = "Number of nsSNPs"
|
||||||
|
, yaxis_title = "Number of Sites"
|
||||||
|
, subtitle_colour = "chocolate4"
|
||||||
|
, subtitle_text = ""
|
||||||
|
, subtitle_size = 8
|
||||||
|
, geom_ls = 2.6
|
||||||
|
, leg_text_size = 10
|
||||||
|
, axis_text_size = 10
|
||||||
|
, axis_label_size = 10)
|
||||||
|
posC_ppi2
|
||||||
|
}
|
||||||
|
|
||||||
posC_ppi2 = site_snp_count_bp(plotdf = df3_ppi2
|
|
||||||
, df_colname = "position"
|
|
||||||
, xaxis_title = "Number of nsSNPs"
|
|
||||||
, yaxis_title = "Number of Sites"
|
|
||||||
, subtitle_text = paste0(common_bp_title, " interface")
|
|
||||||
, subtitle_size = 20
|
|
||||||
, subtitle_colour = subtitle_colour)
|
|
||||||
posC_ppi2
|
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
#FIXME: bp site site count: na
|
# bp site site count: NCA dist
|
||||||
# < 10 Ang TBC
|
# < 10 Ang nca
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
# posC_na = site_snp_count_bp(plotdf = df3_na
|
if (tolower(gene)%in%geneL_na){
|
||||||
# , df_colname = "position"
|
|
||||||
# , xaxis_title = ""
|
posC_nca = site_snp_count_bp(plotdf = df3_na
|
||||||
# , yaxis_title = "")
|
, df_colname = "position"
|
||||||
|
, xaxis_title = "Number of nsSNPs"
|
||||||
|
, yaxis_title = "Number of Sites"
|
||||||
#===========================
|
, subtitle_colour = "chocolate4"
|
||||||
# output: SITE SNP count:
|
, subtitle_text = ""
|
||||||
# all + affinity
|
, subtitle_size = 8
|
||||||
#==========================
|
, geom_ls = 2.6
|
||||||
# my_label_size = 25
|
, leg_text_size = 10
|
||||||
# pos_count_combined_CLP = paste0(outdir_images
|
, axis_text_size = 10
|
||||||
# ,tolower(gene)
|
, axis_label_size = 10)
|
||||||
# ,"_pos_count_PS_AFF.svg")
|
posC_nca
|
||||||
#
|
}
|
||||||
#
|
|
||||||
# svg(pos_count_combined_CLP, width = 20, height = 5.5)
|
|
||||||
# print(paste0("plot filename:", pos_count_combined_CLP))
|
|
||||||
#
|
|
||||||
# cowplot::plot_grid(posC_all, posC_lig, posC_ppi2
|
|
||||||
# #, posC_na
|
|
||||||
# , nrow = 1
|
|
||||||
# , ncol = 3
|
|
||||||
# , labels = "AUTO"
|
|
||||||
# , label_size = my_label_size)
|
|
||||||
#
|
|
||||||
# dev.off()
|
|
||||||
|
|
||||||
|
|
||||||
#===============================================================
|
#===============================================================
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------------------
|
||||||
|
# bp site site count: ALL
|
||||||
|
# <10 Ang ligand
|
||||||
|
# ------------------------------
|
||||||
|
posC_all = site_snp_count_bp(plotdf = df3
|
||||||
|
, df_colname = "position"
|
||||||
|
, xaxis_title = "Number of nsSNPs"
|
||||||
|
, yaxis_title = "Number of Sites"
|
||||||
|
, subtitle_colour = "chocolate4"
|
||||||
|
, subtitle_text = "All mutations sites"
|
||||||
|
, subtitle_size = 8
|
||||||
|
, geom_ls = 2.6
|
||||||
|
, leg_text_size = 10
|
||||||
|
, axis_text_size = 10
|
||||||
|
, axis_label_size = 10)
|
||||||
|
posC_all
|
||||||
|
##################################################################
|
||||||
|
consurfP = stability_count_bp(plotdf = df3
|
||||||
|
, df_colname = "consurf_outcome"
|
||||||
|
#, leg_title = "ConSurf"
|
||||||
|
#, label_categories = labels_consurf
|
||||||
|
, yaxis_title = "Number of nsSNPs"
|
||||||
|
, leg_position = "top"
|
||||||
|
, subtitle_text = "ConSurf"
|
||||||
|
, bar_fill_values = consurf_colours # from globals
|
||||||
|
, subtitle_colour= "black"
|
||||||
|
, sts = 10
|
||||||
|
, lts = 8
|
||||||
|
, ats = 8
|
||||||
|
, als = 8
|
||||||
|
, ltis = 11
|
||||||
|
, geom_ls = 2)
|
||||||
|
|
||||||
|
consurfP
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Sensitivity count: Mutations
|
||||||
|
####################
|
||||||
|
table(df3$sensitivity)
|
||||||
|
|
||||||
|
rect_sens=data.frame(mutation_class=c("Resistant","Sensitive")
|
||||||
|
, tile_colour =c("red","blue")
|
||||||
|
, numbers = c(table(df3$sensitivity)[[1]], table(df3$sensitivity)[[2]]))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sensP = ggplot(rect_sens, aes(mutation_class, y = 0
|
||||||
|
, fill = tile_colour
|
||||||
|
, label = paste0("n=", numbers)
|
||||||
|
)) +
|
||||||
|
geom_tile(width = 1, height = 1) + # make square tiles
|
||||||
|
geom_label(color = "black", size = 1.7,fill = "white", alpha=0.7) + # add white text in the middle
|
||||||
|
scale_fill_identity(guide = "none") + # color the tiles with the colors in the data frame
|
||||||
|
coord_fixed() + # make sure tiles are square
|
||||||
|
#coord_flip()+ scale_x_reverse() +
|
||||||
|
# theme_void() # remove any axis markings
|
||||||
|
theme_nothing() # remove any axis markings
|
||||||
|
sensP
|
||||||
|
|
||||||
|
# sensP2 = sensP +
|
||||||
|
# coord_flip() + scale_x_reverse()
|
||||||
|
# sensP2
|
||||||
|
|
||||||
|
##############################################################
|
||||||
|
#===================
|
||||||
|
# Stability
|
||||||
|
#===================
|
||||||
|
# duetP
|
||||||
|
duetP = stability_count_bp(plotdf = df3
|
||||||
|
, df_colname = "duet_outcome"
|
||||||
|
, leg_title = "mCSM-DUET"
|
||||||
|
#, label_categories = labels_duet
|
||||||
|
, yaxis_title = "Number of nsSNPs"
|
||||||
|
, leg_position = "none"
|
||||||
|
, subtitle_text = "mCSM-DUET"
|
||||||
|
, bar_fill_values = c("#F8766D", "#00BFC4")
|
||||||
|
, subtitle_colour= "black"
|
||||||
|
, sts = 10
|
||||||
|
, lts = 8
|
||||||
|
, ats = 12
|
||||||
|
, als = 11
|
||||||
|
, ltis = 11
|
||||||
|
, geom_ls = 2.5
|
||||||
|
)
|
||||||
|
duetP
|
||||||
|
|
||||||
|
# foldx
|
||||||
|
foldxP = stability_count_bp(plotdf = df3
|
||||||
|
, df_colname = "foldx_outcome"
|
||||||
|
#, leg_title = "FoldX"
|
||||||
|
#, label_categories = labels_foldx
|
||||||
|
, yaxis_title = ""
|
||||||
|
, leg_position = "none"
|
||||||
|
, subtitle_text = "FoldX"
|
||||||
|
, bar_fill_values = c("#F8766D", "#00BFC4")
|
||||||
|
, sts = 10
|
||||||
|
, lts = 8
|
||||||
|
, ats = 12
|
||||||
|
, als = 11
|
||||||
|
, ltis = 11
|
||||||
|
, geom_ls = 2.5
|
||||||
|
)
|
||||||
|
foldxP
|
||||||
|
|
||||||
|
# deepddg
|
||||||
|
deepddgP = stability_count_bp(plotdf = df3
|
||||||
|
, df_colname = "deepddg_outcome"
|
||||||
|
#, leg_title = "DeepDDG"
|
||||||
|
#, label_categories = labels_deepddg
|
||||||
|
, yaxis_title = ""
|
||||||
|
, leg_position = "none"
|
||||||
|
, subtitle_text = "DeepDDG"
|
||||||
|
, bar_fill_values = c("#F8766D", "#00BFC4")
|
||||||
|
, sts = 10
|
||||||
|
, lts = 8
|
||||||
|
, ats = 12
|
||||||
|
, als = 11
|
||||||
|
, ltis = 11
|
||||||
|
, geom_ls = 2.5
|
||||||
|
)
|
||||||
|
deepddgP
|
||||||
|
|
||||||
|
# deepddg
|
||||||
|
dynamut2P = stability_count_bp(plotdf = df3
|
||||||
|
, df_colname = "ddg_dynamut2_outcome"
|
||||||
|
#, leg_title = "Dynamut2"
|
||||||
|
#, label_categories = labels_ddg_dynamut2_outcome
|
||||||
|
, yaxis_title = ""
|
||||||
|
, leg_position = "none"
|
||||||
|
, subtitle_text = "Dynamut2"
|
||||||
|
, bar_fill_values = c("#F8766D", "#00BFC4")
|
||||||
|
, sts = 10
|
||||||
|
, lts = 8
|
||||||
|
, ats = 12
|
||||||
|
, als = 11
|
||||||
|
, ltis = 11
|
||||||
|
, geom_ls = 2.5
|
||||||
|
)
|
||||||
|
dynamut2P
|
||||||
|
|
||||||
|
# provean
|
||||||
|
proveanP = stability_count_bp(plotdf = df3
|
||||||
|
, df_colname = "provean_outcome"
|
||||||
|
#, leg_title = "PROVEAN"
|
||||||
|
#, label_categories = labels_provean
|
||||||
|
, yaxis_title = "Number of nsSNPs"
|
||||||
|
, leg_position = "none" # top
|
||||||
|
, subtitle_text = "PROVEAN"
|
||||||
|
, bar_fill_values = c("#D01C8B", "#F1B6DA") # light pink and deep
|
||||||
|
, sts = 10
|
||||||
|
, lts = 8
|
||||||
|
, ats = 12
|
||||||
|
, als = 11
|
||||||
|
, ltis = 11
|
||||||
|
, geom_ls = 2.5
|
||||||
|
)
|
||||||
|
proveanP
|
||||||
|
|
||||||
|
# snap2
|
||||||
|
snap2P = stability_count_bp(plotdf = df3
|
||||||
|
, df_colname = "snap2_outcome"
|
||||||
|
#, leg_title = "SNAP2"
|
||||||
|
#, label_categories = labels_snap2
|
||||||
|
, yaxis_title = ""
|
||||||
|
, leg_position = "none" # top
|
||||||
|
, subtitle_text = "SNAP2"
|
||||||
|
, bar_fill_values = c("#D01C8B", "#F1B6DA") # light pink and deep
|
||||||
|
, sts = 10
|
||||||
|
, lts = 8
|
||||||
|
, ats = 12
|
||||||
|
, als = 11
|
||||||
|
, ltis = 11
|
||||||
|
, geom_ls = 2.5)
|
||||||
|
snap2P
|
||||||
|
|
||||||
|
#####################################################################################
|
||||||
|
|
|
@ -1,198 +0,0 @@
|
||||||
# source basic_barplots.R
|
|
||||||
|
|
||||||
#============
|
|
||||||
# Plot labels
|
|
||||||
#============
|
|
||||||
tit1 = "Stability outcome"
|
|
||||||
tit2 = "Affinity outcome"
|
|
||||||
tit3 = "Conservation outcome"
|
|
||||||
pt_size = 30
|
|
||||||
|
|
||||||
|
|
||||||
theme_georgia <- function(...) {
|
|
||||||
theme_gray(base_family = "sans", ...) +
|
|
||||||
theme(plot.title = element_text(face = "bold"))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
title_theme <- calc_element("plot.title", theme_georgia())
|
|
||||||
|
|
||||||
pt1 = ggdraw() +
|
|
||||||
draw_label(
|
|
||||||
tit1,
|
|
||||||
fontfamily = title_theme$family,
|
|
||||||
fontface = title_theme$face,
|
|
||||||
#size = title_theme$size
|
|
||||||
size = pt_size
|
|
||||||
)
|
|
||||||
|
|
||||||
pt2 = ggdraw() +
|
|
||||||
draw_label(
|
|
||||||
tit2,
|
|
||||||
fontfamily = title_theme$family,
|
|
||||||
fontface = title_theme$face,
|
|
||||||
size = pt_size
|
|
||||||
)
|
|
||||||
|
|
||||||
pt3 = ggdraw() +
|
|
||||||
draw_label(
|
|
||||||
tit3,
|
|
||||||
fontfamily = title_theme$family,
|
|
||||||
fontface = title_theme$face,
|
|
||||||
size = pt_size
|
|
||||||
)
|
|
||||||
|
|
||||||
# extract common legend
|
|
||||||
common_legend_outcome = get_legend(mLigP +
|
|
||||||
guides(color = guide_legend(nrow = 1)) +
|
|
||||||
theme(legend.position = "top"))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
my_label_size = 25
|
|
||||||
#======================
|
|
||||||
# Output plot function
|
|
||||||
#======================
|
|
||||||
OutPlotBP = function(x){
|
|
||||||
cowplot::plot_grid(
|
|
||||||
cowplot::plot_grid(pt1,
|
|
||||||
common_legend_outcome,
|
|
||||||
cowplot::plot_grid( duetP, foldxP
|
|
||||||
, deepddgP, dynamut2P
|
|
||||||
, nrow = 2
|
|
||||||
, ncol = 2
|
|
||||||
, labels = c("A", "B", "C","D")
|
|
||||||
, label_size = my_label_size
|
|
||||||
)
|
|
||||||
, ncol = 1
|
|
||||||
, rel_heights = c(7, 3, 90)),
|
|
||||||
|
|
||||||
cowplot::plot_grid(pt2,
|
|
||||||
cowplot::plot_grid(mLigP, mmLigP, ppi2P
|
|
||||||
, nrow = 1
|
|
||||||
, ncol = 3
|
|
||||||
, labels = c("E","F", "G")
|
|
||||||
, label_size = my_label_size
|
|
||||||
)
|
|
||||||
, ncol = 1
|
|
||||||
, rel_heights = c(1, 9)),
|
|
||||||
|
|
||||||
cowplot::plot_grid(pt3,
|
|
||||||
cowplot::plot_grid(consurfP, proveanP, snap2P
|
|
||||||
, nrow = 1
|
|
||||||
, ncol = 3
|
|
||||||
, labels = c("H", "I", "J")
|
|
||||||
, labels_x = 0.2
|
|
||||||
, label_size = my_label_size
|
|
||||||
, rel_widths = c(0.2, 0.2, 0.2)
|
|
||||||
)
|
|
||||||
, ncol = 1
|
|
||||||
, rel_heights = c(0.07, 0.93)
|
|
||||||
),
|
|
||||||
|
|
||||||
nrow = 3,
|
|
||||||
rel_heights = c(0.58, 0.25, 0.27),
|
|
||||||
align = "hv"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
#=====================
|
|
||||||
# OutPlot: svg and png
|
|
||||||
#======================
|
|
||||||
#ratio 11.69 by 8.27
|
|
||||||
w = 8.27*2
|
|
||||||
h = 11.69*2
|
|
||||||
|
|
||||||
#svg
|
|
||||||
bp_all_CLP = paste0(outdir_images
|
|
||||||
,tolower(gene)
|
|
||||||
,"_bp_all_CL.svg")
|
|
||||||
cat(paste0("plot filename:", bp_all_CLP))
|
|
||||||
|
|
||||||
svg(bp_all_CLP, width = w, height = h)
|
|
||||||
OutPlotBP()
|
|
||||||
dev.off()
|
|
||||||
|
|
||||||
#png
|
|
||||||
bp_all_CLP_png = paste0(outdir_images
|
|
||||||
,tolower(gene)
|
|
||||||
,"_bp_all_CL.png")
|
|
||||||
cat(paste0("plot filename:", bp_all_CLP_png))
|
|
||||||
|
|
||||||
png(bp_all_CLP_png, width = w, height = h, units = "in", res = 300 )
|
|
||||||
OutPlotBP()
|
|
||||||
dev.off()
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
#####################################################################
|
|
||||||
# ------------------------------
|
|
||||||
# bp site site count: ALL
|
|
||||||
# <10 Ang ligand
|
|
||||||
# ------------------------------
|
|
||||||
|
|
||||||
posC_all = site_snp_count_bp(plotdf = df3
|
|
||||||
, df_colname = "position"
|
|
||||||
, xaxis_title = "Number of nsSNPs"
|
|
||||||
, yaxis_title = "Number of Sites"
|
|
||||||
, subtitle_size = 20)
|
|
||||||
|
|
||||||
# ------------------------------
|
|
||||||
# bp site site count: mCSM-lig
|
|
||||||
# < 10 Ang ligand
|
|
||||||
# ------------------------------
|
|
||||||
common_bp_title = paste0("Sites <", DistCutOff, angstroms_symbol)
|
|
||||||
|
|
||||||
posC_lig = site_snp_count_bp(plotdf = df3_lig
|
|
||||||
, df_colname = "position"
|
|
||||||
, xaxis_title = "Number of nsSNPs"
|
|
||||||
, yaxis_title = "Number of Sites"#+ annotate("text", x = 1.5, y = 2.2, label = "Text No. 1")
|
|
||||||
, subtitle_text = paste0(common_bp_title, " ligand")
|
|
||||||
, subtitle_size = 20
|
|
||||||
, subtitle_colour = subtitle_colour)
|
|
||||||
# ------------------------------
|
|
||||||
# bp site site count: ppi2
|
|
||||||
# < 10 Ang interface
|
|
||||||
# ------------------------------
|
|
||||||
|
|
||||||
posC_ppi2 = site_snp_count_bp(plotdf = df3_ppi2
|
|
||||||
, df_colname = "position"
|
|
||||||
, xaxis_title = "Number of nsSNPs"
|
|
||||||
, yaxis_title = "Number of Sites"
|
|
||||||
, subtitle_text = paste0(common_bp_title, " interface")
|
|
||||||
, subtitle_size = 20
|
|
||||||
, subtitle_colour = subtitle_colour)
|
|
||||||
|
|
||||||
# ------------------------------
|
|
||||||
#FIXME: bp site site count: na
|
|
||||||
# < 10 Ang TBC
|
|
||||||
# ------------------------------
|
|
||||||
# posC_na = site_snp_count_bp(plotdf = df3_na
|
|
||||||
# , df_colname = "position"
|
|
||||||
# , xaxis_title = ""
|
|
||||||
# , yaxis_title = "")
|
|
||||||
|
|
||||||
|
|
||||||
#===========================
|
|
||||||
# output: SITE SNP count:
|
|
||||||
# all + affinity
|
|
||||||
#==========================
|
|
||||||
my_label_size = 25
|
|
||||||
pos_count_combined_CLP = paste0(outdir_images
|
|
||||||
,tolower(gene)
|
|
||||||
,"_pos_count_PS_AFF.svg")
|
|
||||||
|
|
||||||
|
|
||||||
svg(pos_count_combined_CLP, width = 20, height = 5.5)
|
|
||||||
print(paste0("plot filename:", pos_count_combined_CLP))
|
|
||||||
|
|
||||||
cowplot::plot_grid(posC_all, posC_lig, posC_ppi2
|
|
||||||
#, posC_na
|
|
||||||
, nrow = 1
|
|
||||||
, ncol = 3
|
|
||||||
, labels = "AUTO"
|
|
||||||
, label_size = my_label_size)
|
|
||||||
|
|
||||||
dev.off()
|
|
||||||
|
|
||||||
|
|
||||||
#===============================================================
|
|
|
@ -10,8 +10,9 @@ mmLigP
|
||||||
posC_lig
|
posC_lig
|
||||||
ppi2P
|
ppi2P
|
||||||
posC_ppi2
|
posC_ppi2
|
||||||
peP
|
|
||||||
sensP
|
sensP
|
||||||
|
peP
|
||||||
|
|
||||||
#========================
|
#========================
|
||||||
# Common title settings
|
# Common title settings
|
||||||
#=========================
|
#=========================
|
||||||
|
@ -157,9 +158,9 @@ ppi2_affT = ggdraw() +
|
||||||
###########################################################
|
###########################################################
|
||||||
p2 = cowplot::plot_grid(cowplot::plot_grid(ppi2_affT, common_legend_outcome, nrow=2),
|
p2 = cowplot::plot_grid(cowplot::plot_grid(ppi2_affT, common_legend_outcome, nrow=2),
|
||||||
cowplot::plot_grid(ppi2P, posC_ppi2
|
cowplot::plot_grid(ppi2P, posC_ppi2
|
||||||
, nrow = 1
|
, nrow = 1
|
||||||
, rel_widths = c(1.2,1.8)
|
, rel_widths = c(1.2,1.8)
|
||||||
, align = "h"),
|
, align = "h"),
|
||||||
nrow = 2,
|
nrow = 2,
|
||||||
rel_heights = c(1,8)
|
rel_heights = c(1,8)
|
||||||
)
|
)
|
||||||
|
@ -184,7 +185,7 @@ p3 = cowplot::plot_grid(cowplot::plot_grid(peT_allT, nrow = 2
|
||||||
align = "v",
|
align = "v",
|
||||||
axis = "lr",
|
axis = "lr",
|
||||||
rel_heights = c(1,8)
|
rel_heights = c(1,8)
|
||||||
),
|
),
|
||||||
rel_heights = c(1,18),
|
rel_heights = c(1,18),
|
||||||
nrow = 2,axis = "lr")
|
nrow = 2,axis = "lr")
|
||||||
p3
|
p3
|
||||||
|
@ -207,7 +208,7 @@ cowplot::plot_grid(p1, p2, p3
|
||||||
, label_size = 12
|
, label_size = 12
|
||||||
, rel_widths = c(3,2,2)
|
, rel_widths = c(3,2,2)
|
||||||
#, rel_heights = c(1)
|
#, rel_heights = c(1)
|
||||||
)
|
)
|
||||||
|
|
||||||
dev.off()
|
dev.off()
|
||||||
##################################################
|
##################################################
|
||||||
|
@ -234,8 +235,8 @@ h = 3
|
||||||
# dev.off()
|
# dev.off()
|
||||||
|
|
||||||
conCLP = paste0(outdir_images
|
conCLP = paste0(outdir_images
|
||||||
,tolower(gene)
|
,tolower(gene)
|
||||||
,"_consurf_BP.png")
|
,"_consurf_BP.png")
|
||||||
|
|
||||||
print(paste0("plot filename:", conCLP))
|
print(paste0("plot filename:", conCLP))
|
||||||
png(conCLP, units = "in", width = w, height = h, res = 300 )
|
png(conCLP, units = "in", width = w, height = h, res = 300 )
|
||||||
|
@ -243,15 +244,27 @@ consurfP
|
||||||
|
|
||||||
dev.off()
|
dev.off()
|
||||||
#================================
|
#================================
|
||||||
# Sensitivity numbers: geom_tile
|
# Sensitivity mutation numbers: geom_tile
|
||||||
#================================
|
#================================
|
||||||
sensCLP = paste0(outdir_images
|
sensCLP = paste0(outdir_images
|
||||||
,tolower(gene)
|
,tolower(gene)
|
||||||
,"_sensN_tile.png")
|
,"_sensN_tile.png")
|
||||||
|
|
||||||
print(paste0("plot filename:", sensCLP))
|
print(paste0("plot filename:", sensCLP))
|
||||||
png(sensCLP, units = "in", width = 1, height = 1, res = 300 )
|
png(sensCLP, units = "in", width = 1, height = 1, res = 300 )
|
||||||
sensP
|
sensP
|
||||||
dev.off()
|
dev.off()
|
||||||
|
#================================
|
||||||
|
# Sensitivity SITE numbers: geom_tile
|
||||||
|
#================================
|
||||||
|
sens_siteCLP = paste0(outdir_images
|
||||||
|
,tolower(gene)
|
||||||
|
,"_sens_siteC_tile.png")
|
||||||
|
|
||||||
|
print(paste0("plot filename:", sens_siteCLP))
|
||||||
|
png(sens_siteCLP, units = "in", width = 1, height = 1, res = 300 )
|
||||||
|
sens_siteP
|
||||||
|
dev.off()
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
|
|
|
@ -25,16 +25,21 @@
|
||||||
#=============
|
#=============
|
||||||
# Data: Input
|
# Data: Input
|
||||||
#==============
|
#==============
|
||||||
#source("~/git/LSHTM_analysis/config/alr.R")
|
|
||||||
source("~/git/LSHTM_analysis/config/embb.R")
|
|
||||||
#source("~/git/LSHTM_analysis/config/katg.R")
|
|
||||||
#source("~/git/LSHTM_analysis/config/gid.R")
|
|
||||||
#source("~/git/LSHTM_analysis/config/pnca.R")
|
#source("~/git/LSHTM_analysis/config/pnca.R")
|
||||||
|
#source("~/git/LSHTM_analysis/config/embb.R")
|
||||||
|
#source("~/git/LSHTM_analysis/config/gid.R")
|
||||||
|
|
||||||
|
source("~/git/LSHTM_analysis/config/alr.R")
|
||||||
|
#source("~/git/LSHTM_analysis/config/katg.R")
|
||||||
#source("~/git/LSHTM_analysis/config/rpob.R")
|
#source("~/git/LSHTM_analysis/config/rpob.R")
|
||||||
|
|
||||||
source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.R")
|
source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.R")
|
||||||
source("~/git/LSHTM_analysis/scripts/plotting/plotting_colnames.R")
|
#source("~/git/LSHTM_analysis/scripts/plotting/plotting_colnames.R") sourced by above
|
||||||
|
# sanity check
|
||||||
|
|
||||||
|
cat("\nSourced plotting cols as well:", length(plotting_cols))
|
||||||
|
|
||||||
|
####################################################
|
||||||
class(merged_df3)
|
class(merged_df3)
|
||||||
merged_df3 = as.data.frame(merged_df3)
|
merged_df3 = as.data.frame(merged_df3)
|
||||||
|
|
||||||
|
@ -52,7 +57,7 @@ merged_df3 = merged_df3[, !colnames(merged_df3)%in%c("pos_count")]
|
||||||
head(merged_df3$pos_count)
|
head(merged_df3$pos_count)
|
||||||
|
|
||||||
df3 = merged_df3[, colnames(merged_df3)%in%plotting_cols]
|
df3 = merged_df3[, colnames(merged_df3)%in%plotting_cols]
|
||||||
|
"nca_distance"%in%colnames(df3)
|
||||||
|
|
||||||
#=======
|
#=======
|
||||||
# output
|
# output
|
||||||
|
@ -129,25 +134,54 @@ mmLigP
|
||||||
# barplot for ppi2 affinity
|
# barplot for ppi2 affinity
|
||||||
# <10 Ang of interface
|
# <10 Ang of interface
|
||||||
#------------------------------
|
#------------------------------
|
||||||
ppi2P = stability_count_bp(plotdf = df3_ppi2
|
if (tolower(gene)%in%geneL_ppi2){
|
||||||
, df_colname = "mcsm_ppi2_outcome"
|
ppi2P = stability_count_bp(plotdf = df3_ppi2
|
||||||
#, leg_title = "mCSM-ppi2"
|
, df_colname = "mcsm_ppi2_outcome"
|
||||||
#, label_categories = labels_ppi2
|
#, leg_title = "mCSM-ppi2"
|
||||||
#, bp_plot_title = paste(common_bp_title, "PP-interface")
|
#, label_categories = labels_ppi2
|
||||||
|
#, bp_plot_title = paste(common_bp_title, "PP-interface")
|
||||||
, yaxis_title = "Number of nsSNPs"
|
|
||||||
, leg_position = "none"
|
, yaxis_title = "Number of nsSNPs"
|
||||||
, subtitle_text = "mCSM-ppi2"
|
, leg_position = "none"
|
||||||
, bar_fill_values = c("#F8766D", "#00BFC4")
|
, subtitle_text = "mCSM-ppi2"
|
||||||
, subtitle_colour= "black"
|
, bar_fill_values = c("#F8766D", "#00BFC4")
|
||||||
, sts = 10
|
, subtitle_colour= "black"
|
||||||
, lts = 8
|
, sts = 10
|
||||||
, ats = 12
|
, lts = 8
|
||||||
, als = 11
|
, ats = 12
|
||||||
, ltis = 11
|
, als = 11
|
||||||
, geom_ls = 2.5
|
, ltis = 11
|
||||||
)
|
, geom_ls = 2.5
|
||||||
ppi2P
|
)
|
||||||
|
ppi2P
|
||||||
|
}
|
||||||
|
#----------------------------
|
||||||
|
# barplot for ppi2 affinity
|
||||||
|
# <10 Ang of interface
|
||||||
|
#------------------------------
|
||||||
|
if (tolower(gene)%in%geneL_na){
|
||||||
|
|
||||||
|
nca_distP = stability_count_bp(plotdf = df3_na
|
||||||
|
, df_colname = "mcsm_na_outcome"
|
||||||
|
#, leg_title = "mCSM-NA"
|
||||||
|
#, label_categories =
|
||||||
|
#, bp_plot_title = paste(common_bp_title, "Dist to NA")
|
||||||
|
|
||||||
|
, yaxis_title = "Number of nsSNPs"
|
||||||
|
, leg_position = "none"
|
||||||
|
, subtitle_text = "mCSM-NA"
|
||||||
|
, bar_fill_values = c("#F8766D", "#00BFC4")
|
||||||
|
, subtitle_colour= "black"
|
||||||
|
, sts = 10
|
||||||
|
, lts = 8
|
||||||
|
, ats = 12
|
||||||
|
, als = 11
|
||||||
|
, ltis = 11
|
||||||
|
, geom_ls = 2.5
|
||||||
|
)
|
||||||
|
nca_distP
|
||||||
|
}
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
|
@ -173,19 +207,43 @@ posC_lig
|
||||||
# bp site site count: ppi2
|
# bp site site count: ppi2
|
||||||
# < 10 Ang interface
|
# < 10 Ang interface
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
|
if (tolower(gene)%in%geneL_ppi2){
|
||||||
|
|
||||||
|
posC_ppi2 = site_snp_count_bp(plotdf = df3_ppi2
|
||||||
|
, df_colname = "position"
|
||||||
|
, xaxis_title = "Number of nsSNPs"
|
||||||
|
, yaxis_title = "Number of Sites"
|
||||||
|
, subtitle_colour = "chocolate4"
|
||||||
|
, subtitle_text = ""
|
||||||
|
, subtitle_size = 8
|
||||||
|
, geom_ls = 2.6
|
||||||
|
, leg_text_size = 10
|
||||||
|
, axis_text_size = 10
|
||||||
|
, axis_label_size = 10)
|
||||||
|
posC_ppi2
|
||||||
|
}
|
||||||
|
|
||||||
|
# ------------------------------
|
||||||
|
# bp site site count: NCA dist
|
||||||
|
# < 10 Ang nca
|
||||||
|
# ------------------------------
|
||||||
|
if (tolower(gene)%in%geneL_na){
|
||||||
|
|
||||||
|
posC_nca = site_snp_count_bp(plotdf = df3_na
|
||||||
|
, df_colname = "position"
|
||||||
|
, xaxis_title = "Number of nsSNPs"
|
||||||
|
, yaxis_title = "Number of Sites"
|
||||||
|
, subtitle_colour = "chocolate4"
|
||||||
|
, subtitle_text = ""
|
||||||
|
, subtitle_size = 8
|
||||||
|
, geom_ls = 2.6
|
||||||
|
, leg_text_size = 10
|
||||||
|
, axis_text_size = 10
|
||||||
|
, axis_label_size = 10)
|
||||||
|
posC_nca
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
posC_ppi2 = site_snp_count_bp(plotdf = df3_ppi2
|
|
||||||
, df_colname = "position"
|
|
||||||
, xaxis_title = "Number of nsSNPs"
|
|
||||||
, yaxis_title = "Number of Sites"
|
|
||||||
, subtitle_colour = "chocolate4"
|
|
||||||
, subtitle_text = ""
|
|
||||||
, subtitle_size = 8
|
|
||||||
, geom_ls = 2.6
|
|
||||||
, leg_text_size = 10
|
|
||||||
, axis_text_size = 10
|
|
||||||
, axis_label_size = 10)
|
|
||||||
posC_ppi2
|
|
||||||
#===============================================================
|
#===============================================================
|
||||||
# PE count
|
# PE count
|
||||||
rects <- data.frame(x = 1:6,
|
rects <- data.frame(x = 1:6,
|
||||||
|
@ -246,7 +304,7 @@ posC_all = site_snp_count_bp(plotdf = df3
|
||||||
, leg_text_size = 10
|
, leg_text_size = 10
|
||||||
, axis_text_size = 10
|
, axis_text_size = 10
|
||||||
, axis_label_size = 10)
|
, axis_label_size = 10)
|
||||||
|
posC_all
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
#------------------------------
|
#------------------------------
|
||||||
|
@ -290,10 +348,8 @@ consurfP = stability_count_bp(plotdf = df3
|
||||||
|
|
||||||
consurfP
|
consurfP
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Sensitivity count
|
# Sensitivity count: Mutations
|
||||||
####################
|
####################
|
||||||
table(df3$sensitivity)
|
table(df3$sensitivity)
|
||||||
|
|
||||||
|
@ -320,6 +376,36 @@ sensP
|
||||||
# sensP2 = sensP +
|
# sensP2 = sensP +
|
||||||
# coord_flip() + scale_x_reverse()
|
# coord_flip() + scale_x_reverse()
|
||||||
# sensP2
|
# sensP2
|
||||||
|
#===============================
|
||||||
|
# Sensitivity count: Site
|
||||||
|
#==============================
|
||||||
|
table(df3$sensitivity)
|
||||||
|
#--------
|
||||||
|
# embb
|
||||||
|
#--------
|
||||||
|
#rsc = 54
|
||||||
|
#ccc = 46
|
||||||
|
#ssc = 470
|
||||||
|
|
||||||
|
|
||||||
|
rect_rs_siteC =data.frame(mutation_class=c("A_Resistant sites"
|
||||||
|
, "B_Common sites"
|
||||||
|
, "C_Sensitive sites"),
|
||||||
|
tile_colour =c("red",
|
||||||
|
"purple",
|
||||||
|
"blue"),
|
||||||
|
numbers = c(rsc, ccc, ssc),
|
||||||
|
order = c(1, 2, 3))
|
||||||
|
|
||||||
|
rect_rs_siteC$labels = paste0(rect_rs_siteC$mutation_class, "\nn=", rect_rs_siteC$ numbers)
|
||||||
|
|
||||||
|
sens_siteP = ggplot(rect_rs_siteC, aes(mutation_class, y = 0,
|
||||||
|
fill = tile_colour,
|
||||||
|
label = paste0("n=", numbers))) +
|
||||||
|
geom_tile(width = 1, height = 1) +
|
||||||
|
geom_label(color = "black", size = 1.7,fill = "white", alpha=0.7) +
|
||||||
|
theme_nothing()
|
||||||
|
sens_siteP
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
#===================
|
#===================
|
||||||
|
@ -360,7 +446,7 @@ foldxP = stability_count_bp(plotdf = df3
|
||||||
, ltis = 11
|
, ltis = 11
|
||||||
, geom_ls = 2.5
|
, geom_ls = 2.5
|
||||||
)
|
)
|
||||||
|
foldxP
|
||||||
|
|
||||||
# deepddg
|
# deepddg
|
||||||
deepddgP = stability_count_bp(plotdf = df3
|
deepddgP = stability_count_bp(plotdf = df3
|
||||||
|
@ -378,7 +464,7 @@ deepddgP = stability_count_bp(plotdf = df3
|
||||||
, ltis = 11
|
, ltis = 11
|
||||||
, geom_ls = 2.5
|
, geom_ls = 2.5
|
||||||
)
|
)
|
||||||
|
deepddgP
|
||||||
|
|
||||||
# deepddg
|
# deepddg
|
||||||
dynamut2P = stability_count_bp(plotdf = df3
|
dynamut2P = stability_count_bp(plotdf = df3
|
||||||
|
@ -398,7 +484,6 @@ dynamut2P = stability_count_bp(plotdf = df3
|
||||||
)
|
)
|
||||||
dynamut2P
|
dynamut2P
|
||||||
|
|
||||||
|
|
||||||
# provean
|
# provean
|
||||||
proveanP = stability_count_bp(plotdf = df3
|
proveanP = stability_count_bp(plotdf = df3
|
||||||
, df_colname = "provean_outcome"
|
, df_colname = "provean_outcome"
|
||||||
|
@ -415,6 +500,7 @@ proveanP = stability_count_bp(plotdf = df3
|
||||||
, ltis = 11
|
, ltis = 11
|
||||||
, geom_ls = 2.5
|
, geom_ls = 2.5
|
||||||
)
|
)
|
||||||
|
proveanP
|
||||||
|
|
||||||
# snap2
|
# snap2
|
||||||
snap2P = stability_count_bp(plotdf = df3
|
snap2P = stability_count_bp(plotdf = df3
|
||||||
|
@ -431,7 +517,7 @@ snap2P = stability_count_bp(plotdf = df3
|
||||||
, als = 11
|
, als = 11
|
||||||
, ltis = 11
|
, ltis = 11
|
||||||
, geom_ls = 2.5)
|
, geom_ls = 2.5)
|
||||||
|
snap2P
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
|
|
|
@ -263,7 +263,7 @@ if (tolower(gene)%in%geneL_ppi2){
|
||||||
# NA affinity
|
# NA affinity
|
||||||
#================
|
#================
|
||||||
if (tolower(gene)%in%geneL_na){
|
if (tolower(gene)%in%geneL_na){
|
||||||
corr_df_na = corr_df_na[corr_df_na["NA-Dist"]<DistCutOff,]
|
corr_df_na = corr_df_na[corr_df_na["NCA-Dist"]<DistCutOff,]
|
||||||
|
|
||||||
corr_na_colnames = c(static_cols
|
corr_na_colnames = c(static_cols
|
||||||
, "mCSM-NA"
|
, "mCSM-NA"
|
||||||
|
|
|
@ -63,7 +63,7 @@ distanceP
|
||||||
|
|
||||||
# check
|
# check
|
||||||
wilcox.test(wf_dist_genP$`PPI Dist(Å)`[wf_dist_genP$mutation_info_labels=="R"]
|
wilcox.test(wf_dist_genP$`PPI Dist(Å)`[wf_dist_genP$mutation_info_labels=="R"]
|
||||||
, wf_dist_genP$`PPI Dist(Å)`[wf_dist_genP$mutation_info_labels=="S"], paired = FALSE)
|
, wf_dist_genP$`PPI Dist(Å)`[wf_dist_genP$mutation_info_labels=="S"], paired = FALSE)
|
||||||
|
|
||||||
wilcox.test(wf_dist_genP$`Lig Dist(Å)`[wf_dist_genP$mutation_info_labels=="R"]
|
wilcox.test(wf_dist_genP$`Lig Dist(Å)`[wf_dist_genP$mutation_info_labels=="R"]
|
||||||
, wf_dist_genP$`Lig Dist(Å)`[wf_dist_genP$mutation_info_labels=="S"], paired = FALSE)
|
, wf_dist_genP$`Lig Dist(Å)`[wf_dist_genP$mutation_info_labels=="S"], paired = FALSE)
|
||||||
|
@ -83,8 +83,8 @@ dist_data_lig$param_type = factor(dist_data_lig$param_type)
|
||||||
table(dist_data_lig$param_type)
|
table(dist_data_lig$param_type)
|
||||||
levels(dist_data_lig$param_type)
|
levels(dist_data_lig$param_type)
|
||||||
distanceP_lig = lf_bp2(dist_data_lig
|
distanceP_lig = lf_bp2(dist_data_lig
|
||||||
#, p_title = ""
|
#, p_title = ""
|
||||||
, violin_quantiles = c(0.5), monochrome = F)
|
, violin_quantiles = c(0.5), monochrome = F)
|
||||||
|
|
||||||
distanceP_lig
|
distanceP_lig
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ if (tolower(gene)%in%geneL_na){
|
||||||
, violin_quantiles = c(0.5), monochrome = F)
|
, violin_quantiles = c(0.5), monochrome = F)
|
||||||
|
|
||||||
distanceP_na
|
distanceP_na
|
||||||
}
|
}
|
||||||
#==============
|
#==============
|
||||||
# Plot:DUET
|
# Plot:DUET
|
||||||
#==============
|
#==============
|
||||||
|
|
|
@ -92,8 +92,9 @@ OutPlot_dm_om = function(x){
|
||||||
NULL,
|
NULL,
|
||||||
cowplot::plot_grid(pt3,
|
cowplot::plot_grid(pt3,
|
||||||
cowplot::plot_grid( #distanceP
|
cowplot::plot_grid( #distanceP
|
||||||
distanceP_lig, distanceP_ppi2
|
distanceP_lig
|
||||||
#, distanceP_na
|
#, distanceP_ppi2
|
||||||
|
, distanceP_na
|
||||||
, nrow = 1
|
, nrow = 1
|
||||||
, labels = c("F", "G")
|
, labels = c("F", "G")
|
||||||
, label_size = my_label_size)
|
, label_size = my_label_size)
|
||||||
|
@ -118,8 +119,8 @@ OutPlot_dm_om = function(x){
|
||||||
),NULL,
|
),NULL,
|
||||||
cowplot::plot_grid(pt5,
|
cowplot::plot_grid(pt5,
|
||||||
cowplot::plot_grid(mcsmligP, mcsmlig2P
|
cowplot::plot_grid(mcsmligP, mcsmlig2P
|
||||||
, mcsmppi2P
|
#, mcsmppi2P
|
||||||
#, mcsmnaP
|
, mcsmnaP
|
||||||
, nrow = 1
|
, nrow = 1
|
||||||
, labels = c("K", "L", "M")
|
, labels = c("K", "L", "M")
|
||||||
, label_size = my_label_size)
|
, label_size = my_label_size)
|
||||||
|
|
|
@ -52,13 +52,15 @@ corr_plotdf = corr_data_extract(merged_df3
|
||||||
, extract_scaled_cols = F)
|
, extract_scaled_cols = F)
|
||||||
|
|
||||||
aff_dist_cols = colnames(corr_plotdf)[grep("Dist", colnames(corr_plotdf))]
|
aff_dist_cols = colnames(corr_plotdf)[grep("Dist", colnames(corr_plotdf))]
|
||||||
static_cols = c("Log10(MAF)")
|
static_cols = c("Log10(MAF)"
|
||||||
#, "Log10(OR)")
|
, "Log10(OR)"
|
||||||
|
)
|
||||||
############################################################
|
############################################################
|
||||||
#=============================================
|
#=============================================
|
||||||
# Creating masked df for affinity data
|
# Creating masked df for affinity data
|
||||||
#=============================================
|
#=============================================
|
||||||
corr_affinity_df = corr_plotdf
|
corr_affinity_df = corr_plotdf
|
||||||
|
|
||||||
#----------------------
|
#----------------------
|
||||||
# Mask affinity columns
|
# Mask affinity columns
|
||||||
#-----------------------
|
#-----------------------
|
||||||
|
@ -70,7 +72,7 @@ if (tolower(gene)%in%geneL_ppi2){
|
||||||
}
|
}
|
||||||
|
|
||||||
# if (tolower(gene)%in%geneL_na){
|
# if (tolower(gene)%in%geneL_na){
|
||||||
# corr_affinity_df[corr_affinity_df["NA-Dist"]>DistCutOff,"mCSM-NA"]=0
|
# corr_affinity_df[corr_affinity_df["NCA-Dist"]>DistCutOff,"mCSM-NA"]=0
|
||||||
# }
|
# }
|
||||||
|
|
||||||
# count 0
|
# count 0
|
||||||
|
@ -89,10 +91,12 @@ corr_ps_colnames = c(static_cols
|
||||||
, "Dynamut2"
|
, "Dynamut2"
|
||||||
, aff_dist_cols
|
, aff_dist_cols
|
||||||
, "dst_mode")
|
, "dst_mode")
|
||||||
|
|
||||||
corr_df_ps = corr_plotdf[, corr_ps_colnames]
|
corr_df_ps = corr_plotdf[, corr_ps_colnames]
|
||||||
|
|
||||||
# Plot #1
|
# Plot #1
|
||||||
plot_corr_df_ps = my_gg_pairs(corr_df_ps, plot_title="Stability estimates")
|
plot_corr_df_ps = my_gg_pairs(corr_df_ps, plot_title="Stability estimates")
|
||||||
|
|
||||||
##########################################################
|
##########################################################
|
||||||
#================
|
#================
|
||||||
# Conservation
|
# Conservation
|
||||||
|
@ -101,7 +105,7 @@ corr_conservation_cols = c( static_cols
|
||||||
, "ConSurf"
|
, "ConSurf"
|
||||||
, "SNAP2"
|
, "SNAP2"
|
||||||
, "PROVEAN"
|
, "PROVEAN"
|
||||||
, aff_dist_cols
|
#, aff_dist_cols
|
||||||
, "dst_mode"
|
, "dst_mode"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -166,6 +170,6 @@ png(paste0(outdir_images
|
||||||
,"_CorrC.png"), height =7, width=7, unit="in",res=300)
|
,"_CorrC.png"), height =7, width=7, unit="in",res=300)
|
||||||
|
|
||||||
cowplot::plot_grid(ggmatrix_gtable(plot_corr_df_aff),
|
cowplot::plot_grid(ggmatrix_gtable(plot_corr_df_aff),
|
||||||
labels = "C",
|
labels = "C",
|
||||||
label_size = 12)
|
label_size = 12)
|
||||||
dev.off()
|
dev.off()
|
||||||
|
|
|
@ -61,7 +61,7 @@ lin_countP = lin_count_bp(lf_data = lineage_dfL[['lin_lf']]
|
||||||
, y_scale_percent = FALSE
|
, y_scale_percent = FALSE
|
||||||
, y_label = c("Count")
|
, y_label = c("Count")
|
||||||
)
|
)
|
||||||
|
lin_countP
|
||||||
#===============================
|
#===============================
|
||||||
# lineage SNP diversity count
|
# lineage SNP diversity count
|
||||||
#===============================
|
#===============================
|
||||||
|
@ -88,7 +88,7 @@ lin_diversityP = lin_count_bp_diversity(lf_data = lineage_dfL[['lin_wf']]
|
||||||
, subtitle_text = NULL
|
, subtitle_text = NULL
|
||||||
, sts = 20
|
, sts = 20
|
||||||
, subtitle_colour = "#350E20FF")
|
, subtitle_colour = "#350E20FF")
|
||||||
|
lin_diversityP
|
||||||
#=============================================
|
#=============================================
|
||||||
# Output plots: Lineage count and Diversity
|
# Output plots: Lineage count and Diversity
|
||||||
#=============================================
|
#=============================================
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue