Solved! Thank you so much for the idea!
• 0 views
•
link
Does anyone know if there is a package or online tool to generate a figure like below given any protein sequence? Thank you so much!
Some R code:
aa = c("A", "C", "D", "E", "F", "G", "H", "I", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "Y")
seq = strsplit("AKEQSWRT","")[[1]]
# Build a binary matrix with TRUE where the position has the AA in that row (positions are columns)
aamat <- matrix(aa, ncol=length(seq), nrow = length(aa)) == matrix(seq, ncol = length(seq), nrow = length(aa), byrow=T)
# Plot it
heatmap(aamat*1, Rowv=NA, Colv=NA, col=c('white','black'), xlab = "Position in protein sequence", ylab = "Amino acid")
Never seen a package does this but like Asaf showed R is very convenient for plotting.
Here is another example:
https://colab.research.google.com/drive/1TZus8et3Wwe6LBSJQaLmjI7GHSGQFNVv?usp=sharing
aa <- c("A", "C", "D", "E", "F", "G", "H", "I", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "Y")
peptide <- sample(aa, 500, TRUE)
positions = c()
for (a in 1: length(aa)) {
for (p in 1:length(peptide)) {
if (aa[a] == peptide[p]) {
positions <- rbind(c(aa[a], p,a), positions)
}
}
}
pos <- positions[,-1]
rownames(pos) <- positions[,1]
plot(pos, pch = 20, yaxt="n")
axis(2, at=pos[,2], labels=rownames(pos), las=2)
It works perfectly, thank you so much!
Log in to answer this question.