This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Position Weight Matrix in R or Python

Hello All,

I would like to create a position weight matrix in R or Python for some peptide sequences . I found that there are packages in R to create a position weight matrix for gene sequences(ATGC) like Biostrings but was difficult to find them for proteins/peptides. Any suggestions?

pwm peptide matrix

2 answers

Actually, you can create PSSM for amino acids in a similar manner as for DNA/RNA sequences.

library(Biostrings)
sequences <- c("ERLRELETKIGSLQEDLC","CERLRELETKIGSLQEDL","ERLRECLETKIGSLQEDL")
string_set <- AAStringSet(sequences)
PSSM <- consensusMatrix(string_set, as.prob = TRUE)

Biopython allows to create Position Weight Matrices using motifs module:

http://biopython.org/DIST/docs/tutorial/Tutorial.html#sec244

As far as I know, there are know constrains for the alphabet, so it could polypeptide.

Log in to answer this question.