Hello Tiphaine,
Sorry for the slow response to this question.
Yes you can easily add new features with your choice of colors and they can be added below or above the protein.
There is some code here that shows how to plot variants: https://rforbiochemists.blogspot.com/2018/02/my-drawproteins-package-has-been.html
To illustrate more of what is possible below is some code. Please see if it works.
Feel free to email with question/comments (brennanpincardiff@gmail.com) or add as issues on Github (https://github.com/brennanpincardiff/drawProteins/issues/).
Best wishes,
Paul
library(drawProteins)
library(ggplot2)
prot_data <- drawProteins::get_features("Q13402")
prot_data <- drawProteins::feature_to_dataframe(prot_data)
p <- draw_canvas(prot_data)
p <- draw_chains(p, prot_data)
p
x_ample <- prot_data[50,]
x_ample$type <- "SNP"
x_ample
p + geom_rect(data = x_ample,
aes(xmin=begin,
xmax=end,
ymin=order-0.2,
ymax=order+0.2),
colour = "red"
)
p + geom_point(data = x_ample,
aes(x = begin,
y = order+0.25),
shape = 21,
colour = "black",
size = 10,
fill = "yellow"
)
p + geom_point(data = x_ample,
aes(x = begin,
y = order-0.25),
shape = 24,
colour = "black",
size = 10,
fill = "red"
)
x_ample[2,] <- x_ample[1,]
x_ample[2,]$begin <- 1000
x_ample[2,]$end <- 1000
p + geom_point(data = x_ample,
aes(x = begin,
y = order-0.25),
shape = 23,
colour = "black",
size = 10,
fill = "green"
)