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

View file

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