Usage

Samplesheet input

You will need to create a samplesheet with information about the samples you would like to analyse before running the pipeline. Use the --input parameter to specify its location of a comma-separated file that consists of 3 columns and a header row as shown in the examples below.

--input '[path to samplesheet file]'

Samplesheet columns

An example samplesheet has been provided with the pipeline.

Column Description
sample Custom sample name. This entry will be identical for multiple sequencing libraries/runs from the same sample.
alleles A string that consists of the patient’s alleles (separated by “;”), or a full path to a allele “.txt” file where each allele is saved on a row. A species-prefixed sentinel <prefix>-all (e.g. HLA-all, BoLA-all, H-2-all) expands to every supported allele of that species per tool — see Pan-species prediction.
mhc_class Specifies the MHC class for which the prediction should be performed. Valid values are: I, II.
filename Full path to a variant, protein or peptide file (“.vcf”, “.vcf.gz”,“fasta”, “tsv”).
tumor_sample Optional. Name of the tumour sample as it appears in the VCF header (e.g. TUMOR for Strelka). Needed when the VCF holds more than one sample; leave empty for single-sample VCFs.
germline_vcf Optional. Path to the patient’s germline VCF, used only as context so the windows carry their own variants. Never scanned for candidates.

The pipeline will auto-detect whether a sample is either in variant, protein or peptide file file format using the information provided in the samplesheet. If you provide peptide format (tsv), make sure your peptide list aligns with --peptide_col_name (default: “sequence”).

Input Formats:

  • variant: .vcf,.vcf.gz
  • protein: .fasta
  • peptide: .tsv (with peptide column aligning with --peptide_col_name, default: “sequence”)

An example samplesheet has been provided with the pipeline.

Genomic variants

Input VCFs are raw somatic calls; VEP runs inside the pipeline, so do not pre-annotate them. Only PASS records are used, contigs are renamed to Ensembl style (chr1 to 1, chrM to MT), and multiallelic sites are split.

For VCFs with more than one sample column (matched tumour/normal from sarek’s Mutect2 or Strelka, or DRAGEN), set the tumor_sample samplesheet column to the tumour sample’s name as it appears in the VCF header; bcftools query -l your.vcf lists them, and Strelka names them NORMAL and TUMOR. Leave it empty for single-sample VCFs. Callers that emit no GT field are handled automatically.

Peptides come only from coding-altering variants on complete protein-coding transcripts: missense, in-frame indels and frameshifts. Synonymous, stop-gain/loss, splice and non-coding variants yield none, and so do incomplete-CDS or non-coding-biotype transcripts, though such variants are still captured through the gene’s complete transcripts.

Somatic variants close enough to share a peptide are assumed to be in cis and are also evaluated together, so a peptide spanning two mutations is generated either way. If the VCF already carries read-backed phasing (FORMAT/HP), that phasing is used instead.

Germline context (germline_vcf). Windows are cut from the reference genome, so a somatic variant with a germline variant beside it yields a peptide the patient never makes. Point the optional germline_vcf samplesheet column at the patient’s germline calls (sarek and comparable callers emit one per normal sample) and those variants are folded into the windows, wild-type as well as mutant, giving the patient’s own sequence instead of the reference. Germline calls are context only: they are never scanned for candidates and never become peptides of their own. Only germline records near a somatic site are used, and only missense ones are folded in, a pvacseq limitation. Peptides are reported in both contexts, with and without the germline change, so nothing is lost if the two variants turn out to be on opposite chromosomes.

Tip

Set --proteome_reference <proteome.fa> (a UniProt or Ensembl pep.all.fa) to drop variant peptides that also occur in the normal proteome.

Reference data

The variant path needs a VEP cache and a matching genome FASTA. The Wildtype/Frameshift VEP plugins come from the pVACtools container, so you do not provide them.

Parameter What
--vep_species VEP species matching the cache, e.g. homo_sapiens, mus_musculus.
--vep_genome VEP assembly matching the cache, e.g. GRCh38, GRCm39.
--vep_cache_version VEP cache version matching the cache, e.g. 116.
--vep_cache VEP offline Ensembl cache, either a directory or a .tar.gz of it.
--ref_fasta Ensembl genome FASTA for that build, plain or bgzipped.

Provide them. Caches are published at annotation-cache, which needs no download of your own:

nextflow run nf-core/epitopeprediction -profile docker \
--input samplesheet.csv --outdir results \
--vep_species mus_musculus --vep_genome GRCm39 --vep_cache_version 116 \
--vep_cache s3://annotation-cache/vep_cache/116_GRCm39/ \
--ref_fasta <genome.fa>

Reading that bucket anonymously needs aws.client.anonymous = true in your config. For species or releases it does not carry, assets/download_vep_references.sh fetches a cache and FASTA straight from Ensembl:

SPECIES=mus_musculus ASSEMBLY=GRCm39 RELEASE=116 assets/download_vep_references.sh

Or download in-pipeline (--vep_download_cache). The pipeline fetches the cache and the genome FASTA itself and publishes both under <outdir>/references for reuse. This pulls ~20 GB, so run it once and reuse the result via --vep_cache/--ref_fasta.

nextflow run nf-core/epitopeprediction -profile docker \
--input samplesheet.csv --outdir results \
--vep_species homo_sapiens --vep_genome GRCh38 --vep_cache_version 116 \
--vep_download_cache

VEP lists the available caches over FTP. On networks where passive FTP fails (the download then ends with “No matching species found”), use --vep_cache with a pre-downloaded or annotation-cache copy.

Full samplesheet

The sample identifiers are used to determine which sample belongs to the input file. Below is an example for the same sample with different input files that can be used:

Terminal window
sample,alleles,mhc_class,filename
GBM_1,A*01:01;A*02:01;B*07:02;B*24:02;C*03:01;C*04:01,I,gbm_1_variants.vcf(.gz)
GBM_1,gbm1_alleles.txt,I,gbm_1_proteins.fasta
GBM_1,DRB1*01:01,II,gbm_1_peptides.tsv

You can also perform predictions for MHC class I and II in the same run by specifying the value in the corresponding column (one value per row). Please make sure to select the alleles accordingly. You can also provide your alleles in a .txt file containing one allele per row.

Pan-species prediction

To predict against every supported allele of a given species, use the sentinel <species>-all in the alleles column. Species names are resolved via mhcgnomes, so prefix tags and common names both work:

  • HLA-all or human-all — all supported human HLA alleles (class depends on mhc_class and tool)
  • BoLA-all or cattle-all — all supported bovine alleles
  • H-2-all, H2-all, or mouse-all — all supported mouse alleles
  • Mamu-all, Patr-all, SLA-all, DLA-all, … — other species supported by mhcgnomes and the specified predictor
Terminal window
sample,alleles,mhc_class,filename
sample1,HLA-all,I,peptides.tsv

Peptide length limits

--min/max_peptide_length_classI and --min/max_peptide_length_classII select the peptide lengths to predict. Each predictor additionally has a fixed length window it can handle, so a peptide is only passed to a predictor if it falls into both the requested range and the predictor’s window:

Predictor MHC class Peptide lengths
mhcflurry I 5-15
mhcnuggets I 5-15
mhcnuggetsii II 5-30
netmhcpan I 8-14
netmhciipan II 9-50
mixmhcpred I 8-14
mixmhciipred II 12-21

Running the pipeline

The typical command for running the pipeline is as follows:

nextflow run nf-core/epitopeprediction --input ./samplesheet.csv --outdir ./results -profile docker

This will launch the pipeline with the docker configuration profile and default options (mhcflurry by default). See below for more information about profiles.

Note that the pipeline will create the following files in your working directory:

work # Directory containing the nextflow working files
<OUTDIR> # Finished results in specified location (defined with --outdir)
.nextflow_log # Log file from Nextflow
# Other nextflow hidden files, eg. history of pipeline runs and old logs.

If you wish to repeatedly use the same parameters for multiple runs, rather than specifying each flag in the command, you can specify these in a params file.

Pipeline settings can be provided in a yaml or json file via -params-file <file>.

Warning

Do not use -c <file> to specify parameters as this will result in errors. Custom config files specified with -c must only be used for tuning process resource specifications, other infrastructural tweaks (such as output directories), or module arguments (args).

The above pipeline run specified with a params file in yaml format:

nextflow run nf-core/epitopeprediction -profile docker -params-file params.yaml

with:

params.yaml
input: './samplesheet.csv'
outdir: './results/'
<...>

You can also generate such YAML/JSON files via nf-core/launch.

Running the pipeline with NetMHC

The pipeline supports NetMHCpan 4.2b and NetMHCIIpan 4.3 (sub-releases b, e and i). If one of the external tools is specified, the path to the corresponding tarball has to be specified. See the download sections for NetMHCpan-4.2 and NetMHCIIpan-4.3.

When using conda, the parameter --netmhc_system must also be specified if the default value linux is not applicable.

NetMHCpan 4.2 supports different prediction modes. We strongly recommend using the default mode, but if necessary, the other modes can be selected with a custom config file.

The antigen presentation mode is selected with -mode 0, the pathogen mode with -mode 1 and the neoepitope mode with -mode 2 in the module arguments. The config file can look like this:

process {
withName: NETMHCPAN {
ext.args = '-mode <1|2>'
}
}
Important

Only the specific versions netMHCpan-4.2bstatic.Linux.tar.gz and netMHCIIpan-4.3{b,e,i}.Linux.tar.gz are supported, as the pipeline validates these tarballs via checksum to ensure integrity.

A typical command is as follows:

nextflow run nf-core/epitopeprediction \
-profile docker \
--input ./samplesheet.csv \
--outdir ./results \
--tools 'netmhcpan,netmhciipan' \
--min_peptide_length_classI 8 \
--max_peptide_length_classI 12 \
--min_peptide_length_classII 12 \
--max_peptide_length_classII 25 \
--netmhcpan_path /path/to/netMHCpan-4.2bstatic.Linux.tar.gz \
--netmhciipan_path /path/to/netMHCIIpan-4.3i.Linux.tar.gz \

Running the pipeline with MixMHCpred / MixMHCIIpred

The pipeline supports MixMHCpred for MHC class I binding prediction and MixMHCIIpred for MHC class II binding prediction.

Important

MixMHCpred and MixMHCIIpred are licensed for academic non-commercial research only. Commercial use, including providing services with them, requires a separate license from the Ludwig Institute for Cancer Research. Read the MixMHCpred license and the MixMHC2pred license before use.

The pipeline only runs these tools with --accept_mixmhcpred_license, which confirms that you have read the licenses and use the tools for academic non-commercial research only.

Their licenses do not allow a prebuilt container, so Wave builds one on the fly from the module Dockerfile when you add -with-wave. Do not use -profile wave for these tools: it enables Wave freeze mode, which fails without a private build repository.

If you cannot or do not want to use Wave, supply your own containers instead. Build them from modules/local/mixmhcpred/Dockerfile and modules/local/mixmhciipred/Dockerfile, keep them private (the licenses forbid redistribution), and point the processes at them in a custom config passed with -c. Use fully qualified image names, since the pipeline prefixes bare names with quay.io/:

process {
withName: 'MIXMHCPRED' {
container = 'registry.example.org/mixmhcpred:3.0'
}
withName: 'MIXMHCIIPRED' {
container = 'registry.example.org/mixmhc2pred:2.0.2'
}
}

A typical command for MHC class I is:

nextflow run nf-core/epitopeprediction \
-profile docker \
-with-wave \
--input ./samplesheet.csv \
--outdir ./results \
--tools 'mixmhcpred' \
--accept_mixmhcpred_license \
--min_peptide_length_classI 8 \
--max_peptide_length_classI 12

For MHC class II:

nextflow run nf-core/epitopeprediction \
-profile docker \
-with-wave \
--input ./samplesheet.csv \
--outdir ./results \
--tools 'mixmhciipred' \
--accept_mixmhcpred_license \
--min_peptide_length_classII 12 \
--max_peptide_length_classII 21

Updating the pipeline

When you run the above command, Nextflow automatically pulls the pipeline code from GitHub and stores it as a cached version. After this, it will use the cached version if available - even if the pipeline has been updated since. To ensure that you’re running the latest version of the pipeline, make sure that you regularly update the cached version of the pipeline:

nextflow pull nf-core/epitopeprediction

Reproducibility

It is a good idea to specify the pipeline version when running the pipeline on your data. This ensures that a specific version of the pipeline code and software are used when you run your pipeline. If you keep using the same tag, you’ll be running the same version of the pipeline, even if there have been changes to the code since.

First, go to the nf-core/epitopeprediction releases page and find the latest pipeline version - numeric only (eg. 1.3.1). Then specify this when running the pipeline with -r (one hyphen) - eg. -r 1.3.1. Of course, you can switch to another version by changing the number after the -r flag.

This version number will be logged in reports when you run the pipeline, so that you’ll know what you used when you look back in the future. For example, at the bottom of the MultiQC reports.

To further assist in reproducibility, you can use share and reuse parameter files to repeat pipeline runs with the same settings without having to write out a command with every single parameter.

Tip

If you wish to share such profile (such as upload as supplementary material for academic publications), make sure to NOT include cluster specific paths to files, nor institutional specific profiles.

Core Nextflow arguments

Note

These options are part of Nextflow and use a single hyphen (pipeline parameters use a double-hyphen)

-profile

Use this parameter to choose a configuration profile. Profiles can give configuration presets for different compute environments.

Several generic profiles are bundled with the pipeline which instruct the pipeline to use software packaged using different methods (Docker, Singularity, Podman, Shifter, Charliecloud, Apptainer, Conda) - see below.

Important

We highly recommend the use of Docker or Singularity containers for full pipeline reproducibility, however when this is not possible, Conda is also supported.

The pipeline also dynamically loads configurations from https://github.com/nf-core/configs when it runs, making multiple config profiles for various institutional clusters available at run time. For more information and to check if your system is supported, please see the nf-core/configs documentation.

Note that multiple profiles can be loaded, for example: -profile test,docker - the order of arguments is important! They are loaded in sequence, so later profiles can overwrite earlier profiles.

If -profile is not specified, the pipeline will run locally and expect all software to be installed and available on the PATH. This is not recommended, since it can lead to different results on different machines dependent on the computer environment.

  • test
    • A profile with a complete configuration for automated testing
    • Includes links to test data so needs no other parameters
  • docker
    • A generic configuration profile to be used with Docker
  • singularity
    • A generic configuration profile to be used with Singularity
  • podman
    • A generic configuration profile to be used with Podman
  • shifter
    • A generic configuration profile to be used with Shifter
  • charliecloud
    • A generic configuration profile to be used with Charliecloud
  • apptainer
    • A generic configuration profile to be used with Apptainer
  • wave
    • A generic configuration profile to enable Wave containers. Use together with one of the above (requires Nextflow 24.03.0-edge or later).
  • conda
    • A generic configuration profile to be used with Conda. Please only use Conda as a last resort i.e. when it’s not possible to run the pipeline with Docker, Singularity, Podman, Shifter, Charliecloud, or Apptainer.

-resume

Specify this when restarting a pipeline. Nextflow will use cached results from any pipeline steps where the inputs are the same, continuing from where it got to previously. For input to be considered the same, not only the names must be identical but the files’ contents as well. For more info about this parameter, see this blog post.

You can also supply a run name to resume a specific run: -resume [run-name]. Use the nextflow log command to show previous run names.

-c

Specify the path to a specific config file (this is a core Nextflow command). See the nf-core website documentation for more information.

Custom configuration

Resource requests

Whilst the default requirements set within the pipeline will hopefully work for most people and with most input data, you may find that you want to customise the compute resources that the pipeline requests. Each step in the pipeline has a default set of requirements for number of CPUs, memory and time. For most of the pipeline steps, if the job exits with any of the error codes specified here it will automatically be resubmitted with higher resources request (2 x original, then 3 x original). If it still fails after the third attempt then the pipeline execution is stopped.

To change the resource requests, please see the max resources and customise process resources section of the nf-core website.

Custom Containers

In some cases, you may wish to change the container or conda environment used by a pipeline steps for a particular tool. By default, nf-core pipelines use containers and software from the biocontainers or bioconda projects. However, in some cases the pipeline specified version maybe out of date.

To use a different container from the default container or conda environment specified in a pipeline, please see the updating tool versions section of the nf-core website.

Custom Tool Arguments

A pipeline might not always support every possible argument or option of a particular tool used in pipeline. Fortunately, nf-core pipelines provide some freedom to users to insert additional parameters that the pipeline does not include by default.

To learn how to provide additional arguments to a particular tool of the pipeline, please see the customising tool arguments section of the nf-core website.

nf-core/configs

In most cases, you will need to create a custom config as a one-off but if you, and others within your organization, are likely to be running nf-core pipelines regularly and need to use the same settings regularly then we can advise that you request that your custom config file is uploaded to the nf-core/configs git repository. Before you do this, test that the config file works with your pipeline of choice using the -c parameter. Then you can create a pull request to the nf-core/configs repository with the addition of your config file, associated documentation file (see examples in nf-core/configs/docs), and amending nfcore_custom.config to include your custom profile.

See the main Nextflow documentation for more information about creating your own configuration files.

If you have any questions or issues, please send us a message on Slack on the #configs channel.

Running in the background

Nextflow handles job submissions and supervises the running jobs. The Nextflow process must run until the pipeline is finished.

The Nextflow -bg flag launches Nextflow in the background, detached from your terminal so that the workflow does not stop if you log out of your session. The logs are saved to a file.

Alternatively, you can use screen / tmux or a similar tool to create a detached session which you can log back into at a later time. Some HPC setups also allow you to run nextflow within a cluster job submitted your job scheduler (from where it submits more jobs).

Nextflow memory requirements

In some cases, the Nextflow Java virtual machines can start to request a large amount of memory. We recommend adding the following line to your environment to limit this (typically in ~/.bashrc or ~./bash_profile):

NXF_OPTS='-Xms1g -Xmx4g'