how can I convert a sequence to number
1
0
Entering edit mode
@bioinformatics-10931
Last seen 2.8 years ago
United States

I am reading about a new package and I am interested in plotting logo of a protein sequence. The problem is that the author did not specify how one can convert the sequence to number

https://www.bioconductor.org/packages/devel/bioc/vignettes/motifStack/inst/doc/motifStack_HTML.html#plot-an-amino-acid-sequence-logo

Here is an example sequence

seq <- "MGLRYSIYIENPLSSPSSSYKSINDPLFHSQHRSQKNVSFITYGCRHCKTHLSSSFQIIS
RDYRGRTGTAYLMNKVVNVVEGKVEQRRMLTGDYLVCDILCHWCKRNVGWKYLQSSNDDQ
QYKEGKFILELKNICKCT"

is there anyone who could help me plot it using this package or any other package

motifStack • 801 views
ADD COMMENT
1
Entering edit mode
Ou, Jianhong ★ 1.3k
@ou-jianhong-4539
Last seen 3 days ago
United States

Is this a good way to show your sequence as a motif logo? It is not suggested. Whatever, you can try following code to plot your sequence.

seq <- "MGLRYSIYIENPLSSPSSSYKSINDPLFHSQHRSQKNVSFITYGCRHCKTHLSSSFQIIS
RDYRGRTGTAYLMNKVVNVVEGKVEQRRMLTGDYLVCDILCHWCKRNVGWKYLQSSNDDQ
QYKEGKFILELKNICKCT"
seq <- gsub("[^a-zA-Z]", "", seq)
seq <- strsplit(seq, "")[[1]]
rn <- sort(unique(seq))
mat <- matrix(0, nrow=length(rn), ncol=length(seq))
rownames(mat) <- rn
for(i in seq_along(seq)){mat[seq[i], i] <- 1 }
pfm <- new("pfm", mat=mat, name="your_seq_name")
plot(pfm) ##please make sure the canvas size: width >> height
ADD COMMENT

Login before adding your answer.

Traffic: 644 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