knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This demo shows how to predict the binding strength of peptides to different Major Histocompatibility MHC haplotypes.
First load the library:
library(netmhcpan)
This demo assumes NetMHCpan is installed.
Installation cannot be done netmhcpan
, as one needs
to request a download link at
http://www.cbs.dtu.dk/cgi-bin/nph-sw_request?netMHCpan/.
To install netMHCpan
, use install_netmhcpan
with the download link:
install_netmhcpan(" ")
The installation of netmhcpan
is checked, with
the goal of producing a helpful error message:
tryCatch( check_netmhcpan_installation(), error = function(e) print(e) )
Now, lets use the sequence of an example protein:
sequence <- "FAMILYVWFAMILYV" message(sequence)
Now, we need to select an MHC haplotype. There are many alleles, so first we count the number of haplotypes:
if (is_netmhcpan_installed()) { mhc_haplotypes <- get_netmhcpan_alleles() length(mhc_haplotypes) }
Now, we simply pick the first haplotype:
if (is_netmhcpan_installed()) { mhc_haplotype <- mhc_haplotypes[1] }
Now, we can predict how strong our peptide binds to our allele, by obtaining the Inhibitory Concentration 50% (IC50) value in nanomolars (nM), of which lower values indicate stronger binders:
if (is_netmhcpan_installed()) { knitr::kable( predict_ic50( peptides = sequence, mhc_haplotype = mhc_haplotype ) ) }
To investigate if whole a protein is immunogenic, we need to obtain the IC50 values for all its cleaved products. As the MHC-I molecules prefers 13 amino acids residues, we can get the IC50 values for each residue as such:
if (is_netmhcpan_installed()) { knitr::kable( predict_ic50s( protein_sequence = "AVLWAGVAFLAFLQLTALVLNLL", peptide_length = 13, mhc_haplotype = mhc_haplotype ) ) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.