Does anyone know how to generate a figure of the amino acid position in protein sequence?
2
0
Entering edit mode
8 weeks ago
mickley413 • 0

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 • 380 views
ADD COMMENT
1
Entering edit mode
8 weeks ago
Asaf 9.5k

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

ADD COMMENT
0
Entering edit mode

Solved! Thank you so much for the idea!

ADD REPLY
0
Entering edit mode

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

ADD REPLY
1
Entering edit mode
8 weeks ago
barslmn ★ 1.2k

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

ADD COMMENT
0
Entering edit mode

It works perfectly, thank you so much!

ADD REPLY

Login before adding your answer.

Traffic: 2376 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6