added separate scripts for layout for convinience

This commit is contained in:
Tanushree Tunstall 2022-08-09 21:47:24 +01:00
parent d78b072732
commit cd86fcf8e8
6 changed files with 468 additions and 78 deletions

View file

@ -22,7 +22,7 @@ genomics_param = c("Log10(MAF)")
dist_genP = lf_bp2(lf_dist_genP
#, p_title
, violin_quantiles = c(0.5), monochrome = F)
#dist_genP
#-------------------
# Genomics data plot
#-------------------
@ -42,12 +42,18 @@ wilcox.test(wf_dist_genP$`Log10(MAF)`[wf_dist_genP$mutation_info_labels=="R"]
tapply(wf_dist_genP$`Log10(MAF)`, wf_dist_genP$mutation_info_labels, summary)
#---------------------------------------
# Distance data plot: not genomics data
#---------------------------------------
#-------------------
# Distance data plot:
#--------------------
# not genomics
dist_dataP = lf_dist_genP[!lf_dist_genP$param_type%in%genomics_param,]
#dist_dataP$param_type = factor(dist_dataP$param_type)
dist_dataP$param_type = factor(dist_dataP$param_type)
table(dist_dataP$param_type)
levels(dist_dataP$param_type)
# relevel factor to control ordering of appearance of plot
dist_dataP$param_type <-relevel(dist_dataP$param_type, "Lig Dist(Å)" )
table(dist_dataP$param_type)
levels(dist_dataP$param_type)
distanceP = lf_bp2(dist_dataP
#, p_title = ""
@ -66,6 +72,55 @@ tapply(wf_dist_genP$`PPI Dist(Å)`, wf_dist_genP$mutation_info_labels, summary)
tapply(wf_dist_genP$`Lig Dist(Å)`, wf_dist_genP$mutation_info_labels, summary)
#-------------------
# Distance data plot: LigDist
#--------------------
levels(dist_dataP$param_type)[[1]]
#Lig Dist(Å), PPI Dist(Å)
dist_data_lig = dist_dataP[dist_dataP$param_type%in%c(levels(dist_dataP$param_type)[[1]]),]
dist_data_lig$param_type = factor(dist_data_lig$param_type)
table(dist_data_lig$param_type)
levels(dist_data_lig$param_type)
distanceP_lig = lf_bp2(dist_data_lig
#, p_title = ""
, violin_quantiles = c(0.5), monochrome = F)
distanceP_lig
if (tolower(gene)%in%geneL_ppi2){
#-------------------
# Distance data plot: LigDist
#--------------------
levels(dist_dataP$param_type)[[2]]
#Lig Dist(Å), PPI Dist(Å)
dist_data_ppi2 = dist_dataP[dist_dataP$param_type%in%c(levels(dist_dataP$param_type)[[2]]),]
dist_data_ppi2$param_type = factor(dist_data_ppi2$param_type)
table(dist_data_ppi2$param_type)
levels(dist_data_ppi2$param_type)
distanceP_ppi2 = lf_bp2(dist_data_ppi2
#, p_title = ""
, violin_quantiles = c(0.5), monochrome = F)
distanceP_ppi2
}
if (tolower(gene)%in%geneL_na){
#-------------------
# Distance data plot: NADist
#--------------------
levels(dist_dataP$param_type)[[3]]
#Lig Dist(Å), PPI Dist(Å)
dist_data_na = dist_dataP[dist_dataP$param_type%in%c(levels(dist_dataP$param_type)[[3]]),]
dist_data_na$param_type = factor(dist_data_na$param_type)
table(dist_data_na$param_type)
levels(dist_data_na$param_type)
distanceP_na = lf_bp2(dist_data_na
#, p_title = ""
, violin_quantiles = c(0.5), monochrome = F)
distanceP_na
}
#==============
# Plot:DUET
#==============
@ -234,35 +289,27 @@ if (tolower(gene)%in%geneL_na){
######################################
# Outplot with stats
######################################
outdir_images = paste0("~/git/Writing/thesis/images/results/", tolower(gene), "/")
dm_om_combinedP = paste0(outdir_images
,tolower(gene)
,"_dm_om_all.svg" )
cat("DM OM plots with stats:", dm_om_combinedP)
svg(dm_om_combinedP, width = 32, height = 18)
cowplot::plot_grid(
cowplot::plot_grid(duetP, foldxP, deepddgP, dynamut2P, genomicsP, distanceP
, nrow=1
, rel_widths = c(1/7, 1/7,1/7,1/7, 1/7, 1.75/7)),
#, rel_widths = c(1/8, 1/8,1/8,1/8, 1/8, 2.75/8)), # for 3 distances
cowplot::plot_grid(consurfP, proveanP, snap2P
, mcsmligP
, mcsmlig2P
, mcsmppi2P
#, mcsmnaP
, nrow=1),
nrow=2)
dev.off()
#foo = lf_consurfP
# proveanP = lf_bp2(lf_proveanP, colour_categ = "mutation_info_labels"
# , p_title = paste0("Evolutionary conservation")
# , dot_transparency = 1
# , violin_quantiles = c(0.5), monochrome = F)
# outdir_images = paste0("~/git/Writing/thesis/images/results/", tolower(gene), "/")
#
# proveanP
# dm_om_combinedP = paste0(outdir_images
# ,tolower(gene)
# ,"_dm_om_all.svg" )
#
# cat("DM OM plots with stats:", dm_om_combinedP)
# svg(dm_om_combinedP, width = 32, height = 18)
# cowplot::plot_grid(
# cowplot::plot_grid(duetP, foldxP, deepddgP, dynamut2P, genomicsP, distanceP
# , nrow=1
# , rel_widths = c(1/7, 1/7,1/7,1/7, 1/7, 1.75/7)),
# #, rel_widths = c(1/8, 1/8,1/8,1/8, 1/8, 2.75/8)), # for 3 distances
# cowplot::plot_grid(consurfP, proveanP, snap2P
# , mcsmligP
# , mcsmlig2P
# , mcsmppi2P
# #, mcsmnaP
# , nrow=1),
# nrow=2)
#
# dev.off()