rearranged corr plot cols and also added example for ggpairs

This commit is contained in:
Tanushree Tunstall 2022-08-11 20:56:34 +01:00
parent fdb3f00503
commit b302daaa60
7 changed files with 227 additions and 681 deletions

View file

@ -1,5 +1,11 @@
#!/usr/bin/env Rscript
#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/rpob.R")
#########################################################
# TASK: Replace B-factors in the pdb file with the mean
# normalised stability values.
@ -22,25 +28,26 @@ cat(c(getwd(),"\n"))
library(bio3d)
require("getopt", quietly = TRUE) # cmd parse arguments
#========================================================
#drug = "pyrazinamide"
#gene = "pncA"
#drug = ""
#gene = ""
# command line args
spec = matrix(c(
"drug" , "d", 1, "character",
"gene" , "g", 1, "character"
), byrow = TRUE, ncol = 4)
opt = getopt(spec)
drug = opt$drug
gene = opt$gene
if(is.null(drug)|is.null(gene)) {
stop("Missing arguments: --drug and --gene must both be specified (case-sensitive)")
}
# # command line args
# spec = matrix(c(
# "drug" , "d", 1, "character",
# "gene" , "g", 1, "character"
# ), byrow = TRUE, ncol = 4)
#
# opt = getopt(spec)
#
# drug = opt$drug
# gene = opt$gene
#
# if(is.null(drug)|is.null(gene)) {
# stop("Missing arguments: --drug and --gene must both be specified (case-sensitive)")
# }
#========================================================
gene_match = paste0(gene,"_p.")
cat(gene)
gene_match = paste0(gene,"_p."); cat(gene_match)
cat(gene_match)
#=============
@ -64,7 +71,6 @@ cat(paste0("Input file:", infile_pdb) )
in_filename_mean_stability = paste0(tolower(gene), "_mean_ens_stability.csv")
infile_mean_stability = paste0(outdir_plots, "/", in_filename_mean_stability)
cat(paste0("Input file:", infile_mean_stability) )
#=======
@ -150,12 +156,12 @@ plot(density(df_duet$b)
#=============
#hist(my_df$averaged_duet
hist(my_df$avg_ens_stability_scaled
hist(my_df$avg_stability_scaled_pos_scaled
, xlab = ""
, main = "mean stability values")
#plot(density(my_df$averaged_duet)
plot(density(my_df$avg_ens_stability_scaled)
plot(density(my_df$avg_stability_scaled_pos_scaled)
, xlab = ""
, main = "mean stability values")
@ -178,7 +184,7 @@ plot(density(my_df$avg_ens_stability_scaled)
# this makes all the B-factor values in the non-matched positions as NA
#df_duet$b = my_df$averaged_duet_scaled[match(df_duet$resno, my_df$position)]
df_duet$b = my_df$avg_ens_stability_scaled[match(df_duet$resno, my_df$position)]
df_duet$b = my_df$avg_stability_scaled_pos_scaled[match(df_duet$resno, my_df$position)]
#=========
# step 2_P1
@ -194,8 +200,8 @@ na_rep = 2
df_duet$b[is.na(df_duet$b)] = na_rep
# # sanity check: should be 0 and True
# # duet and lig
# if ( (sum(df_duet$b == na_rep) == b_na_duet) && (sum(df_lig$b == na_rep) == b_na_lig) ) {
# # duet
# if ( (sum(df_duet$b == na_rep) == b_na_duet) {
# print ("PASS: NA's replaced with 0s successfully in df_duet and df_lig")
# } else {
# print("FAIL: NA replacement in df_duet NOT successful")
@ -205,20 +211,13 @@ df_duet$b[is.na(df_duet$b)] = na_rep
# max(df_duet$b); min(df_duet$b)
#
# # sanity checks: should be True
# if( (max(df_duet$b) == max(my_df$avg_ens_stability_scaled)) & (min(df_duet$b) == min(my_df$avg_ens_stability_scaled)) ){
# if( (max(df_duet$b) == max(my_df$avg_stability_scaled_pos_scaled)) & (min(df_duet$b) == min(my_df$avg_stability_scaled_pos_scaled)) ){
# print("PASS: B-factors replaced correctly in df_duet")
# } else {
# print ("FAIL: To replace B-factors in df_duet")
# quit()
# }
# if( (max(df_lig$b) == max(my_df$avg_ens_affinity_scaled)) & (min(df_lig$b) == min(my_df$avg_ens_affinity_scaled)) ){
# print("PASS: B-factors replaced correctly in df_lig")
# } else {
# print ("FAIL: To replace B-factors in df_lig")
# quit()
# }
#=========
# step 3_P1
#=========