103 lines
3.6 KiB
R
103 lines
3.6 KiB
R
consurf_palette1 = c("0" = "yellow2"
|
|
, "1" = "cyan1"
|
|
, "2" = "steelblue2"
|
|
, "3" = "cadetblue2"
|
|
, "4" = "paleturquoise2"
|
|
, "5" = "thistle3"
|
|
, "6" = "thistle2"
|
|
, "7" = "plum2"
|
|
, "8" = "maroon"
|
|
, "9" = "violetred2")
|
|
|
|
consurf_palette2 = c("0" = "yellow2"
|
|
, "1" = "forestgreen"
|
|
, "2" = "seagreen3"
|
|
, "3" = "palegreen1"
|
|
, "4" = "darkseagreen2"
|
|
, "5" = "thistle3"
|
|
, "6" = "lightpink1"
|
|
, "7" = "orchid3"
|
|
, "8" = "orchid4"
|
|
, "9" = "darkorchid4")
|
|
|
|
|
|
#myCOL <- colorRampPalette(c("yellow2", "palegreen1", "darkorchid4"))(10)
|
|
#plot(1:100, col = myCOL, pch = 19, cex = 2)
|
|
#myColors <- scale_color_brewer(palette = "Cyan-Magenta")
|
|
|
|
consurf_cols = consurf_palette1
|
|
consurf_cols = consurf_palette2
|
|
#consurf_cols = myCOL
|
|
consurf_col_labs = c("Insufficient Data"
|
|
, "Variable"
|
|
, "2", "3", "4", "5"
|
|
, "6", "7", "8", "Conserved")
|
|
|
|
|
|
#breaks <- levels(as.factor(mtcars$cyl))
|
|
#colours <- ifelse(breaks == 4, "red", "blue")
|
|
|
|
aa_position_colname = "position"
|
|
length(unique(merged_df3[[aa_position_colname]]))
|
|
|
|
positionF <- levels(as.factor(merged_df3[[aa_position_colname]]))
|
|
length(positionF)
|
|
aa_pos_colours = ifelse(positionF%in%rna_bind_aa_pos, "purple"
|
|
, ifelse(positionF%in%binding_aa_pos, "orange", "black" ))
|
|
bar = merged_df3
|
|
bar[['lab_bg']] = ifelse(bar[[aa_position_colname]]%in%rna_bind_aa_pos
|
|
, "purple"
|
|
, ifelse(bar[[aa_position_colname]]%in%binding_aa_pos
|
|
, "orange", "white" ))
|
|
head(bar[[aa_position_colname]])
|
|
head(bar[['lab_bg']])
|
|
|
|
my_xlim = length(unique(bar$position)); my_xlim
|
|
|
|
ymin = min(bar$consurf_score)
|
|
ymax = max(bar$consurf_score)
|
|
|
|
g = ggplot(bar, aes(x = factor(position)
|
|
, y = consurf_score
|
|
, colour = factor(consurf_colour_rev))) +
|
|
|
|
coord_cartesian(xlim = c(1, my_xlim)
|
|
, ylim = c(ymin, ymax)
|
|
, clip = "off") +
|
|
geom_point() +
|
|
scale_colour_manual( values = consurf_cols
|
|
, labels = consurf_col_labs
|
|
) +
|
|
geom_errorbar(aes(ymin = consurf_ci_lower, ymax = consurf_ci_upper))
|
|
|
|
g0 = g + geom_tile(aes(,-2, width = 0.95, height = -0.2)
|
|
, fill = bar$lab_bg
|
|
, colour = "white")
|
|
g0
|
|
|
|
g1 = g0 + theme( axis.text.x = element_text(size = 10
|
|
, angle = 90
|
|
, hjust = 1
|
|
, vjust = 0.4
|
|
#, colour = aa_pos_colours
|
|
)
|
|
, axis.text.y = element_text(size = 12
|
|
, angle = 0
|
|
, hjust = 1
|
|
, vjust = 0)
|
|
, axis.title.x = element_text(size = 12)
|
|
, axis.title.y = element_text(size =12 )
|
|
, panel.background = element_rect(fill = "black", color = "black")
|
|
, panel.grid.major = element_line(color = "black")
|
|
, panel.grid.minor = element_line(color = "black")) +
|
|
guides(colour = guide_legend(title = "Consurf"
|
|
, position = "top"
|
|
#, direction = "horizontal"
|
|
)) +
|
|
labs(title = ""
|
|
, x = "Wild-type position"
|
|
, y = "Consurf score")
|
|
|
|
g1
|
|
|
|
##########################################
|