consurf plot: add debug option. logoP SNP: distance flame tiles

This commit is contained in:
Tanushree Tunstall 2022-08-03 10:48:25 +01:00
parent f2709f3992
commit e498d46f8b
2 changed files with 230 additions and 219 deletions

View file

@ -86,7 +86,8 @@ wideP_consurf <- function(plotdf
, tpos3 = 0
, default_gt_clr = "white"
){
, debug=FALSE
){
if(missing(point_colours)){
temp_cols = colorRampPalette(c("seagreen", "sienna3"))(30)
@ -445,7 +446,7 @@ wideP_consurf <- function(plotdf
# out = g1
# }
#
############################################################################################
############################################################################################
#==============================================
# x-axis: geom_tiles ~ active sites and others
#==============================================
@ -460,10 +461,12 @@ wideP_consurf <- function(plotdf
if (all(!is.null(active_aa_pos) &&
!is.null(aa_pos_drug) &&
!is.null(aa_pos_lig1) && !is.null(aa_pos_lig2) && !is.null(aa_pos_lig3))) {
if (debug){
cat("\n\nAnnotating xvar with active, drug binding, and Lig 1&2&3 sites")
cat("\nCreating column colours, column name:", aa_colour_colname3)
cat("\nDoing Plot with 3 ligands")
}
out = out + geom_tile(aes(,tpos3
, width = tW
, height = tH )
@ -483,19 +486,22 @@ wideP_consurf <- function(plotdf
, fill = plotdf[[aa_colour_colname1]]
, colour = plotdf[[aa_colour_colname1]]
, linetype = "solid")
if (debug){
cat("\nDone Plot with 3 ligands")
}
}
#---------------------
# Add2plot: 2 ligands
#---------------------
if (all(!is.null(active_aa_pos) &&
!is.null(aa_pos_drug) &&
!is.null(aa_pos_lig1) && !is.null(aa_pos_lig2) && is.null(aa_pos_lig3))) {
if (debug){
cat("\n\nAnnotating xvar with active, drug binding, and Lig 1&2 sites")
cat("\nCreating column colours, column name:", aa_colour_colname2)
cat("\nDoing Plot with 2 ligands")
}
out = out +
geom_tile(aes(, tpos2
, width = tW
@ -509,9 +515,10 @@ wideP_consurf <- function(plotdf
, fill = plotdf[[aa_colour_colname1]]
, colour = plotdf[[aa_colour_colname1]]
, linetype = "solid")
if (debug){
cat("\nDone Plot with 2 ligands")
}
}
#---------------------
# Add2plot: 1 ligand
@ -519,11 +526,12 @@ wideP_consurf <- function(plotdf
if (all(!is.null(active_aa_pos) &&
!is.null(aa_pos_drug) &&
!is.null(aa_pos_lig1) && is.null(aa_pos_lig2) && is.null(aa_pos_lig3))) {
if (debug){
cat("\n\nAnnotating xvar with active, drug binding, and Lig 1 sites")
cat("\nCreating column colours, column name:", aa_colour_colname1)
cat("\nDoing Plot with 1 ligands")
}
out = out +
geom_tile(aes(, tpos1
, width = tW
@ -546,20 +554,20 @@ wideP_consurf <- function(plotdf
is.null(aa_pos_lig1) &&
is.null(aa_pos_lig2) &&
is.null(aa_pos_lig3))) {
if (debug){
cat("\n\nAnnotating xvar with active and drug binding sites")
cat("\nCreating column colours, column name:", aa_colour_colname)
cat("\nDoing Plot with 0 ligands: active and drug site only")
}
out = out + geom_tile(aes(, tpos3
, width = tW
, height = tH)
, fill = plotdf[[aa_colour_colname]]
, colour = plotdf[[aa_colour_colname]]
, linetype = "solid")
if (debug){
cat("\nDone Plot with: Active and Drug sites")
}
}
}else{
cat("\nNo annotation for additional ligands on xvar requested")
@ -609,8 +617,8 @@ wideP_consurf <- function(plotdf
# )
# }
#==============================================
return(out2)
#return(out2)
return(out2)
#return(out2)
}

View file

@ -117,14 +117,16 @@ LogoPlotSnps <- function(plot_df
if (is.matrix(tab_mt)){
cat("\nPASS: Mutant matrix successfully created..."
, "\nRownames of mutant matrix:", rownames(tab_mt)
, "\nColnames of mutant matrix:", colnames(tab_mt))
#, "\nRownames of mutant matrix:", rownames(tab_mt)
#, "\nColnames of mutant matrix:", colnames(tab_mt)
)
} else{
tab_mt = as.matrix(tab_mt, rownames = T)
if (is.matrix(tab_mt)){
cat("\nCreating mutant matrix..."
, "\nRownames of mutant matrix:", rownames(tab_mt)
, "\nColnames of mutant matrix:", colnames(tab_mt))
#, "\nRownames of mutant matrix:", rownames(tab_mt)
#, "\nColnames of mutant matrix:", colnames(tab_mt)
)
}
}
@ -151,8 +153,9 @@ LogoPlotSnps <- function(plot_df
, "\nDim of wt matrix:", dim(tab_wt)
, "\nDim of mutant matrix:", dim(tab_mt)
, "\n"
, "\nRownames of mutant matrix:", rownames(tab_wt)
, "\nColnames of mutant matrix:", colnames(tab_wt))
#, "\nRownames of mutant matrix:", rownames(tab_wt)
#, "\nColnames of mutant matrix:", colnames(tab_wt)
)
}
######################################