added combined lineage plot

This commit is contained in:
Tanushree Tunstall 2022-08-09 19:33:49 +01:00
parent fe292e3717
commit 94454d6fba
10 changed files with 421 additions and 190 deletions

View file

@ -45,6 +45,9 @@ outcome_cols_stability = c("duet_outcome"
, "ddg_dynamut2_outcome"
, "foldx_outcome")
all_stability_cols = c(raw_cols_stability
, scaled_cols_stability
, outcome_cols_stability)
#===================
# affinity cols
#===================
@ -62,6 +65,10 @@ outcome_cols_affinity = c( "ligand_outcome"
, "mmcsm_lig_outcome"
, "mcsm_ppi2_outcome"
, "mcsm_na_outcome")
all_affinity_cols = c(raw_cols_affinity
, scaled_cols_affinity
, outcome_cols_affinity)
#===================
# conservation cols
#===================
@ -73,28 +80,45 @@ scaled_cols_conservation = c("consurf_scaled"
, "snap2_scaled"
, "provean_scaled")
# CANNOT strictly be used, as categories are not identical with conssurf missing altogether
outcome_cols_conservation = c("provean_outcome"
, "snap2_outcome"
, "consurf_colour_rev"
, "consurf_colour"#doesn't exist,use this mapping
)
, "consurf_outcome")
all_conserv_cols = c(raw_cols_conservation
, scaled_cols_conservation
, outcome_cols_conservation)
all_cols = c(common_cols
, raw_cols_stability
, scaled_cols_stability
, outcome_cols_stability
, raw_cols_affinity
, scaled_cols_affinity
, outcome_cols_affinity
, raw_cols_conservation
, scaled_cols_conservation
, outcome_cols_conservation)
, all_stability_cols
, all_affinity_cols
, all_conserv_cols)
########################################
categ_cols_to_factor = grep( "_outcome|_info", colnames(merged_df3) )
fact_cols = colnames(merged_df3)[categ_cols_to_factor]
if (any(lapply(merged_df3[, fact_cols], class) == "character")){
cat("\nChanging", length(categ_cols_to_factor), "cols to factor")
merged_df3[, fact_cols] <- lapply(merged_df3[, fact_cols], as.factor)
if (all(lapply(merged_df3[, fact_cols], class) == "factor")){
cat("\nSuccessful: cols changed to factor")
}
}else{
cat("\nRequested cols aready factors")
}
cat("\ncols changed to factor are:\n", colnames(merged_df3)[categ_cols_to_factor] )
####################################
# merged_df3: NECESSARY pre-processing
###################################
df3 = merged_df3
#df3 = merged_df3
plot_cols = c("mutationinformation", "mutation_info_labels", "position", "dst_mode"
, all_cols)
df3 = merged_df3[, colnames(merged_df3)%in%plot_cols]
#=================
# PREFORMATTING: for consistency