Skip to content

MHCnuggets container with command line interface

aellini edited this page Nov 7, 2019 · 1 revision
  1. Create a new and empty directory on your workstation, and change into that directory. From inside of the empty directory clone the repository to your workstation:

git clone https://github.com/KarchinLab/mhcnuggets

  1. Create file called Dockerfile, and contents of the file should be:
FROM python:3

COPY mhcnuggets mhcnuggets

WORKDIR mhcnuggets

RUN python3 setup.py sdist bdist_wheel

RUN pip install dist/mhcnuggets-2.3.2.tar.gz

WORKDIR /mhcnuggets/mhcnuggets

CMD tail -f /dev/null
  1. Run the following command from within the same directory as the Dockerfile to build the docker image:

sudo docker build -t mhcnuggets .

  1. Create a file called docker-compose.yml, with the following contents:
version: '3'
services: 
  mhcnuggets:
    image: mhcnuggets
    container_name: mhcnuggets
    volumes:
    - ./mount:/mhcnuggets/mount
    
  1. In the same directory that docker-compose.yml resides in, create another directory called mount

  2. While still in the same directory that docker-compose.yml resides in, run the following command to start the docker container:

sudo docker-compose up -d

  1. OPTIONALLY: If desired, copy any files that you want mhcnuggets to have access to into the mount directory you created in step 5. For example, if you want to use your peptides file, copy it into the mount directory, the peptides_path would be /mhcnuggets/mount/

  2. Now run the following command to run python (with mhcnuggets installed) from the docker container:

sudo docker exec -it mhcnuggets python

  1. You can now run your predict and train modules. For example, paste the following into the prompt and hit enter (may need to hit enter a few times for the last line to be executed):
from mhcnuggets.src.predict import predict

predict(class_='I', peptides_path='data/test/test_peptides.peps', mhc='HLA-A02:01')

Clone this wiki locally