This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Does anyone know how to generate a figure of the amino acid position in protein sequence?

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!

enter image description here

acid figure protein amino sequence

2 answers

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")

enter image description here

Solved! Thank you so much for the idea!

Use "Green checkmark" to accept the answers to provide closure to this thread. You can accept multiple answers as correct.

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)

enter image description here

It works perfectly, thank you so much!

Log in to answer this question.