knitr::opts_chunk$set(echo = TRUE)
The aim of this package is to supply a set of tools, which will ease working with peptide data within the field of immunoinformatics.
Using Hadley Wickham's brilliant devtools
package, we can easily install PepTools
like so:
install.packages("devtools") devtools::install_github("leonjessen/PepTools")
Once the package has been installed, we can simply load it like so:
library("PepTools")
PepTools
comes with an example data set of 5,000 9-mer peptides, which have been predicted by NetMHCpan 4.0 Server to be strong binders to HLA-A*02:01.
We can view the first 10 peptides like so
PEPTIDES %>% head(10)
and derive the count matrix:
PEPTIDES %>% pssm_counts %>% .[1:9,1:10]
and the frequency matrix:
PEPTIDES %>% pssm_freqs %>% .[1:9,1:10]
and the bits of information matrix;
PEPTIDES %>% pssm_freqs %>% pssm_bits %>% .[1:9,1:10]
Using the ggseqlogo
package, we can visualise the bits matrix:
PEPTIDES %>% pssm_freqs %>% pssm_bits %>% t %>% ggseqlogo(method="custom")
and compare with the ggseqlogo
build in peptide-to-bits conversion:
PEPTIDES %>% ggseqlogo
PepTools
also contain function for encoding peptides:
PEPTIDES %>% pep_encode %>% dim
As can be seen from the dimensions, pep_encode
creates a 3D array or a tensor with 5,000 rows, 9 columns and 20 slices, corresponding to n_peptides x l_peptide x l_enc
, where the encoding is the BLOSUM62
matrix. This way each peptide is encoded as an'image', which can then be used as input to a Deep Learning model. To get a better understanding of what is going on, we can plot the 3 first encoded peptide 'images':
PEPTIDES %>% pep_plot_images
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.