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)
# pulling down data for MYO7A
prot_data <- drawProteins::get_features("Q13402")
# produce data frame
prot_data <- drawProteins::feature_to_dataframe(prot_data)
# make protein schematic
p <- draw_canvas(prot_data)
p <- draw_chains(p, prot_data)
p
# take one amino acid as example...
x_ample <- prot_data[50,]
x_ample$type <- "SNP"
# check what's in x_ample
x_ample
# plot the protein chain...
p + geom_rect(data = x_ample,
aes(xmin=begin,
xmax=end,
ymin=order-0.2,
ymax=order+0.2),
colour = "red"
)
# add protein variant above the chain as a yellow circle...
p + geom_point(data = x_ample,
aes(x = begin,
y = order+0.25),
shape = 21,
colour = "black",
size = 10,
fill = "yellow"
)
# add protein variant below the chain as a red triangle...
p + geom_point(data = x_ample,
aes(x = begin,
y = order-0.25),
shape = 24,
colour = "black",
size = 10,
fill = "red"
)
# duplicate the row...
x_ample[2,] <- x_ample[1,]
# change the location to what amino acid you want
x_ample[2,]$begin <- 1000
x_ample[2,]$end <- 1000
# plot both variants as diamonds below the chain...
p + geom_point(data = x_ample,
aes(x = begin,
y = order-0.25),
shape = 23,
colour = "black",
size = 10,
fill = "green"
)