NetMHC setup
Using NetMHC tools in LENS
LENS utilizes MHCflurry to estimate pMHC-specific binding affinities and
presentation scores. You may want other tools as well, such as NetMHCpan or
NetMHCstabpan, to further describe pMHCs of interest. LENS supports these
tools, but you must provide your own Docker images because of their restrictive
licensing. Information for creating the Docker images and modifying
LENS to use these tools is below.
Creating NetMHC Docker images
Obtain a license for each tool, then build the images yourself. These example Dockerfiles show how:
NetMHCpan
FROM ubuntu:20.04
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y wget vim tcsh
COPY netMHCpan-4.1b.Linux.tar.gz /
RUN tar xvf /netMHCpan-4.1b.Linux.tar.gz
RUN wget https://services.healthtech.dtu.dk/services/NetMHCpan-4.1/data.tar.gz
RUN tar xvf data.tar.gz
RUN mv /data /netMHCpan-4.1/data
RUN cp -r /netMHCpan-4.1/Linux_x86_64/bin /netMHCpan-4.1/bin
ENV NETMHCpan="/netMHCpan-4.1"
RUN rm /data.tar.gz
RUN rm /netMHCpan-4.1b.Linux.tar.gz
RUN sed -i 's/\/net\/sund-nas.win.dtu.dk\/storage\/services\/www\/packages\/netMHCpan\/4.1\/netMHCpan-4.1/\/netMHCpan-4.1\/data\//g' /netMHCpan-4.1/netMHCpan
ENV TMPDIR /tmp
CMD ["/bin/bash"]
NetMHCstabpan
FROM ubuntu:20.04
RUN apt-get update -y
RUN apt-get upgrade -y
RUN apt-get install -y wget vim tcsh gawk
COPY netMHCstabpan-1.0a.Linux.tar.gz /
RUN tar xvf /netMHCstabpan-1.0a.Linux.tar.gz
RUN wget https://services.healthtech.dtu.dk/services/NetMHCstabpan-1.0/data.tar.gz
RUN tar xvf data.tar.gz
RUN mv /data /netMHCstabpan-1.0/data
RUN cp -r /netMHCstabpan-1.0/Linux_x86_64/bin /netMHCstabpan-1.0/bin
ENV NETMHCstabpan="/netMHCstabpan-1.0"
RUN rm /data.tar.gz
RUN rm /netMHCstabpan-1.0a.Linux.tar.gz
RUN sed -i 's/\/net\/sund-nas.win.dtu.dk\/storage\/services\/www\/packages\/netMHCstabpan\/1.0\/netMHCstabpan-1.0/\/netMHCstabpan-1.0\/data\//g' /netMHCstabpan-1.0/netMHCstabpan
RUN chmod -R 777 /netMHCstabpan-1.0
ENV TMPDIR /tmp
CMD ["/bin/bash"]
NetCTLpan
FROM ubuntu:20.04
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y wget vim tcsh gawk
COPY netCTLpan-1.1b.Linux.tar.Z /
RUN tar xvf /netCTLpan-1.1b.Linux.tar.Z
RUN mkdir /netCTLpan-1.1/netMHCpan-2.3/Linux_x86_64/tmp
RUN cp -r /netCTLpan-1.1/netMHCpan-2.3/Linux_x86_64/bin/* /netCTLpan-1.1/netMHCpan-2.3/Linux_x86_64/tmp
RUN mv /netCTLpan-1.1/netMHCpan-2.3/Linux_x86_64/tmp /netCTLpan-1.1/netMHCpan-2.3/Linux_x86_64/bin/bin
RUN wget https://services.healthtech.dtu.dk/services/NetCTLpan-1.1/data_netCTLpan-1.1.tar.Z
RUN tar xvf data_netCTLpan-1.1.tar.Z
RUN mv data_netCTLpan-1.1 /netCTLpan-1.1/data
RUN wget https://services.healthtech.dtu.dk/services/NetCTLpan-1.1/data_netMHCpan-2.3.tar.Z
RUN tar xvf data_netMHCpan-2.3.tar.Z
RUN cp -r data_netMHCpan-2.3 /netCTLpan-1.1/netMHCpan-2.3/data
RUN cp -r data_netMHCpan-2.3 netCTLpan-1.1/netMHCpan-2.3/Linux_x86_64/bin/data
RUN cp -r /netCTLpan-1.1/Linux_x86_64/bin /netCTLpan-1.1/bin
RUN sed -i 's/\/usr\/cbs\/packages\/netCTLpan\/1.1\/netCTLpan-1.1/\/netCTLpan-1.1/g' /netCTLpan-1.1/netCTLpan
ENV NETCTLpan="/netCTLpan-1.1"
ENV NETMHCpan="/netCTLpan-1.1/netMHCpan-2.3/Linux_x86_64/bin"
RUN rm /netCTLpan-1.1b.Linux.tar.Z
ENV TMPDIR /tmp
CMD ["/bin/bash"]
Verifying the image layout
LENS invokes each tool by absolute path inside the container, so an image only works if the binary lands exactly where the workflow expects it. The Dockerfiles above are built to satisfy these paths:
Tool |
Path LENS invokes |
Where the Dockerfile puts it |
|---|---|---|
|
|
Created by unpacking the release archive at |
|
|
Created by |
|
|
Created by |
Warning
The cp -r ... /bin lines are not redundant. netMHCstabpan and netCTLpan
are invoked through the /bin copies, so removing those lines produces an
image that builds cleanly and then fails at runtime with a “No such file or
directory” error. If you adapt these Dockerfiles, keep the destination paths
in the table above.
Each Dockerfile also rewrites the DTU install path baked into the tool’s
launcher script with sed. That rewrite is what makes the tool runnable
outside DTU’s filesystem, so keep it as well.
To confirm an image before using it:
$ singularity exec my-netmhcpan.sif /netMHCpan-4.1/Linux_x86_64/bin/netMHCpan -listMHC | head
Adding the images to your project
Each NetMHC tool has its own module configuration file. Because the images cannot be distributed, they ship with a placeholder in place of a container:
process {
withLabel: netmhcpan_container {
label = 'cloud'
// Licensed tool: build your own image, then set it here.
// See https://uselens.io/en/lens-v1.9.3/netmhc_setup.html
container = 'SEE_uselens.io_FOR_BUILD_INSTRUCTIONS'
}
}
A run that reaches one of these processes without a real image will fail on the placeholder, which is the intended behaviour – it is a clearer signal than a missing-file error deep in a task log.
Two changes are needed to use one of these tools.
1. Point the container label at your image. In your project’s
/path/to/raft/projects/<PROJECT_ID>/workflow/nextflow.config, find the
label for the tool and replace SEE_uselens.io_FOR_BUILD_INSTRUCTIONS with your image:
Tool |
Container label to set |
|---|---|
|
|
|
|
|
|
withLabel: netmhcpan_container {
label = 'cloud'
container = '/path/to/images/my-netmhcpan.sif'
}
2. Enable the tool. Binding predictors are selected by the
antigen_tool parameter, which accepts a comma-separated list. Add the tool
alongside MHCflurry rather than replacing it, so you keep the columns the
default profile produces:
params.lens$immuno$peps_and_alleles_to_antigen_stats$antigen_tool = 'mhcflurry,netmhcpan'
Accepted values are mhcflurry, netmhcpan, netmhcstabpan,
netctlpan, and antigen_garnish. The corresponding NetMHC-prefixed
columns then appear in the report; see Report column reference.
Note
Agretopicity is calculated in a separate step with its own
antigen_tool setting
(params.lens$immuno$calculate_agretopicity$peps_and_alleles_to_antigen_stats$antigen_tool).
Leaving that on mhcflurry is fine, since the two settings are
independent.