Home

Awesome

netmhc2pan

CRAN_Status_Badge

BranchGitHub Actions logoCodecov logo
masterR-CMD-checkcodecov.io
developR-CMD-checkcodecov.io

R package for NetMHCIIpan [1].

Please note that this page is intended for academic users only. Other users are requested to contact the Software Package Manager at health-software@dtu.dk

Install

Use remotes to install the netmhc2pan package:

remotes::install_github("richelbilderbeek/netmhc2pan")

Load the netmhc2pan library:

library(netmhc2pan)

Install NetMHCIIpan to a default folder using netmhc2pan and a download URL. The download URL can be obtained from the NetMHCIIpan website at https://services.healthtech.dtu.dk/services/NetMHCIIpan-3.2/ (at the 'Downloads' tab) and expires after four hours.

install_netmhc2pan("https://services.healthtech.dtu.dk/download/fb4dee93-ddbb-4639-ab21-45fdfd0ed23e")

Installation troubleshooting

URL is expired

Request a new download link

cannot open URL 'https://services.healthtech.dtu.dk/download/[number]/netMHCIIpan-3.2.Linux.tar.gz'

From a fresh download link, you can download the file, yet not install using the install_netmhc2pan function.

In that case, use the install_netmhc2pan_bin_from_file function:

install_netmhc2pan_bin_from_file("netMHCIIpan-3.2.Linux.tar.gz")

This function assumes that the file netMHCIIpan-3.2.Linux.tar.gz is in the working directory.

After this, install like normal:

install_netmhc2pan()

cannot open URL 'https://www.cbs.dtu.dk/services/NetMHCIIpan-3.2/data.Linux.tar.gz'

This happens when the university website is down (yes, this has happened!).

In that case, use the install_netmhc2pan_data_from_file function:

install_netmhc2pan_data_from_file("data.Linux.tar.gz")

This function assumes that the file data.Linux.tar.gz is in the working directory.

After this, install like normal:

install_netmhc2pan()

Usage

We start from a FASTA file with one or more protein sequences:

fasta_filename <- system.file(
  "extdata", "example.fasta", package = "netmhc2pan"
)

This is how to content of such a FASTA file looks like:

message(readLines(fasta_filename), sep = "\n")
>sp|L0T550|RIP2_MYCTU_158_180
AVLWAGVAFLAFLQLTALVLNLL

MHC2 has multiple alleles that bind differently to protein parts. NetMHCIIpan supports more than 5000 alleles:

all_alleles <- get_netmhc2pan_alleles()
testit::assert(length(all_alleles) > 5000)

We simply pick the first two alleles:

alleles <- all_alleles[1:2]

Running the NetMHCIIpan analysis:

bindings <- run_netmhc2pan(
  fasta_filename = fasta_filename,
  alleles = alleles
)

The data frame bindings contains the results:

knitr::kable(bindings)
PosPeptideIDAlleleone_minus_log50knMRank
1AVLWAGVAFLAFLQLsp|L0T550|RIP2_MYCTU_158_180DRB1_01010.510201.0939.0
2VLWAGVAFLAFLQLTsp|L0T550|RIP2_MYCTU_158_180DRB1_01010.475293.9847.0
3LWAGVAFLAFLQLTAsp|L0T550|RIP2_MYCTU_158_180DRB1_01010.524172.3136.0
4WAGVAFLAFLQLTALsp|L0T550|RIP2_MYCTU_158_180DRB1_01010.566109.0726.0
5AGVAFLAFLQLTALVsp|L0T550|RIP2_MYCTU_158_180DRB1_01010.60273.9419.0
6GVAFLAFLQLTALVLsp|L0T550|RIP2_MYCTU_158_180DRB1_01010.68031.937.0
7VAFLAFLQLTALVLNsp|L0T550|RIP2_MYCTU_158_180DRB1_01010.68829.206.5
8AFLAFLQLTALVLNLsp|L0T550|RIP2_MYCTU_158_180DRB1_01010.68032.047.0
9FLAFLQLTALVLNLLsp|L0T550|RIP2_MYCTU_158_180DRB1_01010.66935.928.5
1AVLWAGVAFLAFLQLsp|L0T550|RIP2_MYCTU_158_180DRB1_01020.3461188.9638.0
2VLWAGVAFLAFLQLTsp|L0T550|RIP2_MYCTU_158_180DRB1_01020.3291414.8544.0
3LWAGVAFLAFLQLTAsp|L0T550|RIP2_MYCTU_158_180DRB1_01020.379823.8228.0
4WAGVAFLAFLQLTALsp|L0T550|RIP2_MYCTU_158_180DRB1_01020.406616.0521.0
5AGVAFLAFLQLTALVsp|L0T550|RIP2_MYCTU_158_180DRB1_01020.425504.5517.0
6GVAFLAFLQLTALVLsp|L0T550|RIP2_MYCTU_158_180DRB1_01020.458353.1011.0
7VAFLAFLQLTALVLNsp|L0T550|RIP2_MYCTU_158_180DRB1_01020.456360.9011.0
8AFLAFLQLTALVLNLsp|L0T550|RIP2_MYCTU_158_180DRB1_01020.456361.5411.0
9FLAFLQLTALVLNLLsp|L0T550|RIP2_MYCTU_158_180DRB1_01020.442420.8814.0

The strongest binding is between the MHC2 allele DRB1_0101 at the 7th (to and including 21st) amino acid of the sp&#124;L0T550&#124;RIP2_MYCTU_158_180 protein, as it is in the top 6.5% of best binders.

FAQ

Under which operating systems does netmhc2pan work?

netmhc2pan can only work on the set of operating systems NetMHCIIpan works on. Currently, only Linux is supported:

Operating systemSupported by NetMHCIIpanSupported by netmhc2pan
DarwinYN
LinuxYY
WindowsNN

How to solve Can't locate Env.pm in @INC?

Install the Perl Env package with:

/usr/bin/perl -MCPAN -e 'install Env'

See notes at this Issue.

Are there similar packages?

These are the ones I use:

I am a non-academic user, can you help me obtain NetMHCIIpan?

No.

Note that I -the maintainer of this package- have the same problem. DTU will not make an exception, here is a quote from Morten Nielsen:

The university is very strict on these issues, and we will not able able to grant you access to the tool if you cannot provide an email address from an academic institution. I am sorry about this.

Troubleshooting

problem copying [file]: Permission denied

When installing the package as documented ...

remotes::install_github("richelbilderbeek/netmhc2pan")

... you get warnings such as these:

Warning messages:

1: In file.copy(savedcopy, lib, recursive = TRUE) :

  problem copying C:\Users\johndoe\Documents\R\win-library\4.1\00LOCK\xfun\libs\x64\xfun.dll to C:\Users\johndoe\Documents\R\win-library\4.1\xfun\libs\x64\xfun.dll: Permission denied

It means that you cannot install R packages there.

As this has nothing to do with this package, I suggest to contact your IT department to let them help you out.

Links

References