I'm working now on a method to try and plot a protein sequence after digested with one (or more) restriction enzyme(s).
the goal is to use a specific cleavage points and cut the protein sequence into snippets. After filtering the too long and too shots snippets, I would like to plot the remained peptides and get a table of the coverage.
Below I have attached a part of code for one pattern (trypsin cleaves the protein after a
K) as well as the image i would like to get.
Before I reinvent the wheel, I was wondering if there is already some other method of doing it and if so, please let me know.
protein1 <- readAAStringSet(file="Protein1.fasta") protein1 <- toString(protein1) hits <- matchPattern("K", protein1) subseqs <- IRanges(PartitioningByEnd(end(hits))) subseqs.filt <- subseqs[width(subseqs) >=6 & width(subseqs) <= 30 ] plotRanges(subseqs.filt) AAcovered <- sum(as.data.frame(subseqs.filt)$width) AApeptides<- length(as.data.frame(subseqs.filt)$width) write.table(x = as.data.frame(subseqs.filt), file = "Protein1.txt", sep="\t", quote = F ) paste0("This gives a coverage ratio of ", format(AAcovered * 100 / hits@subject@length, trim = FALSE, digits=4 ), "%" )