added extreme_muts.R
This commit is contained in:
parent
8d9ede186c
commit
7e4be21575
2 changed files with 112 additions and 0 deletions
108
scripts/plotting/extreme_muts.R
Normal file
108
scripts/plotting/extreme_muts.R
Normal file
|
@ -0,0 +1,108 @@
|
|||
#!/usr/bin/env Rscript
|
||||
#########################################################
|
||||
# TASK: producing boxplots for dr and other muts
|
||||
|
||||
#########################################################
|
||||
#=======================================================================
|
||||
# working dir and loading libraries
|
||||
getwd()
|
||||
setwd("~/git/LSHTM_analysis/scripts/plotting")
|
||||
getwd()
|
||||
|
||||
#source("Header_TT.R")
|
||||
library(ggplot2)
|
||||
library(data.table)
|
||||
library(dplyr)
|
||||
|
||||
#=========
|
||||
# Input
|
||||
#=========
|
||||
#source("combining_dfs_plotting.R")
|
||||
|
||||
# FIXME: add a separate script to add foldx values and others
|
||||
source("output_tables.R")
|
||||
rm(df, merged_df3_short, df_output)
|
||||
|
||||
#===============================================================
|
||||
df_comp = df_ordered[!is.na(df_ordered$af),]
|
||||
|
||||
#%%%%%%%%%%%%%%%%%%%%%
|
||||
# REASSIGNMENT
|
||||
df = df_comp
|
||||
#%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
cols_all_muts_table = c("mutationinformation"
|
||||
, "mutation_info"
|
||||
, "af"
|
||||
, "af_percent"
|
||||
|
||||
, "or_mychisq"
|
||||
|
||||
, "pval_fisher"
|
||||
, "or_kin"
|
||||
|
||||
, "pwald_kin"
|
||||
, "duet_stability_change"
|
||||
, "duet_outcome"
|
||||
, "ligand_distance"
|
||||
, "ligand_affinity_change"
|
||||
, "ligand_outcome"
|
||||
, "ddg"
|
||||
, "foldx_outcome"
|
||||
, "asa"
|
||||
, "rsa"
|
||||
, "kd_values"
|
||||
, "rd_values")
|
||||
|
||||
df = df[,cols_all_muts_table]
|
||||
#===============================================================
|
||||
|
||||
#Most Frequent mutation
|
||||
|
||||
mf = df[df$af_percent == max(df$af_percent), ]
|
||||
mf
|
||||
|
||||
# highest OR
|
||||
hor = df[df$or_mychisq == max(df$or_mychisq), ]
|
||||
hor
|
||||
|
||||
|
||||
# Most Destabilising for protein stability (DUET)
|
||||
df_d = df[df$duet_outcome == "Destabilising",]
|
||||
|
||||
hd_duet = df_d[df_d$duet_stability_change == min(df_d$duet_stability_change), ]
|
||||
hd_duet
|
||||
|
||||
# Most Stabilising for protein stability (DUET)
|
||||
df_s = df[df$duet_outcome == "Stabilising",]
|
||||
hs_duet = df_s[df_s$duet_stability_change == max(df_s$duet_stability_change), ]
|
||||
hs_duet
|
||||
|
||||
# Closest Destabilising for protein stability
|
||||
close_d = df_d[order(df_d$ligand_distance, df_d$duet_stability_change),]
|
||||
|
||||
# Closest Stabilising for protein stability
|
||||
close_s = df_s[order(df_s$ligand_distance, df_s$duet_stability_change),]
|
||||
|
||||
|
||||
#===============
|
||||
# ligand affinity: filtered
|
||||
#================
|
||||
df_lig = df[df$ligand_distance<10,]
|
||||
|
||||
df_d_lig = df_lig[df_lig$ligand_outcome == "Destabilising",]
|
||||
hd_lig= df_d_lig[df_d_lig$ligand_affinity_change == min(df_d_lig$ligand_affinity_change), ]
|
||||
hd_lig
|
||||
|
||||
|
||||
df_s_lig = df[df$ligand_outcome == "Stabilising",]
|
||||
hs_lig= df_s_lig[df_s_lig$ligand_affinity_change == max(df_s_lig$ligand_affinity_change), ]
|
||||
hs_lig
|
||||
|
||||
|
||||
# Closest Destabilising for ligand affintiy
|
||||
close_d_lig = df_d_lig[order(df_d_lig$ligand_distance, df_d_lig$ligand_affinity_change),]
|
||||
|
||||
# Closest Stabilising for ligand affinity
|
||||
close_s_lig = df_s_lig[order(df_s_lig$ligand_distance, df_s_lig$ligand_affinity_change),]
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue