Skip to content

Installation

Requirements

  • Python >= 3.10, < 3.13

Install from Source

git clone https://github.com/5h4ng/OptiMHC.git
cd OptiMHC
pip install -e .

Or using uv (recommended for development):

git clone https://github.com/5h4ng/OptiMHC.git
cd OptiMHC
uv sync --locked

PyPI

PyPI distribution is not yet available. For now, install from source as shown above.

NetMHCpan / NetMHCIIpan Setup

Most OptiMHC dependencies are installed automatically via pip. The only exceptions are NetMHCpan and NetMHCIIpan, which are standalone executables that must be downloaded and installed manually.

1. Download

Both require a license from DTU Health Tech (free for academic use).

2. Install and Add to PATH

After downloading and extracting, follow the installation instructions provided by DTU. Then make sure the executables are accessible from your shell:

# Add to your ~/.bashrc or ~/.zshrc:
export PATH="/path/to/netMHCpan-4.1:$PATH"
export PATH="/path/to/netMHCIIpan-4.3:$PATH"
which netMHCpan       # Should print the path to the executable
which netMHCIIpan     # Should print the path to the executable

OptiMHC calls these tools via the mhctools library, which invokes netMHCpan and netMHCIIpan as command-line programs. If they are not on your PATH, the prediction step will fail with a "command not found" error.

3. Test the Installation

netMHCpan -v          # Should print the version number
netMHCIIpan -v        # Should print the version number

Tip

If you do not need MHC binding predictions, you can skip this step entirely and use OptiMHC with other features (Basic, SpectralSimilarity, DeepLC, PWM, OverlappingPeptide, MHCflurry) — all of which are installed via pip.

Verify OptiMHC Installation

optimhc --help

You should see the available commands: pipeline and experiment.