Skip to content

Add DeepImmuno class-I immunogenicity predictor (#250) #221

Add DeepImmuno class-I immunogenicity predictor (#250)

Add DeepImmuno class-I immunogenicity predictor (#250) #221

Workflow file for this run

name: CI
on:
push:
branches:
- main
- master
pull_request:
permissions:
contents: read
jobs:
quality:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev,pepsickle]"
- name: Run lint checks
run: ./lint.sh
- name: Build distribution artifacts
run: python -m build --sdist --wheel --no-isolation
- name: Run public pytest subset
run: |
pytest -ra \
tests/test_binding_prediction.py \
tests/test_binding_prediction_collection.py \
tests/test_cli_parsing_helpers.py \
tests/test_cli_registry.py \
tests/test_class2_allele_formats.py \
tests/test_cli_filters.py \
tests/test_mhc_formats.py \
tests/test_netchop_parse.py \
tests/test_process_helpers.py \
tests/test_pred.py \
tests/test_annotate_table.py \
tests/test_prime.py \
tests/test_mixmhc2pred2.py \
tests/test_deeptap.py \
tests/test_calis.py \
tests/test_eramer.py \
tests/test_wrapper_base.py \
tests/test_deepimmuno.py \
tests/test_processing_predictor.py \
tests/test_pepsickle.py \
tests/test_bigmhc.py \
tests/test_unparseable_alleles.py \
tests/test_nettcr.py \
tests/test_tulip.py \
tests/test_random.py
integration-netmhc:
if: github.repository == 'openvax/mhctools'
runs-on: ubuntu-22.04
env:
# Deterministic, cacheable location for MHCflurry model weights, shared
# by the fetch step and the test run.
MHCFLURRY_DATA_DIR: ${{ github.workspace }}/mhcflurry-data
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Checkout private netmhc-bundle repo
uses: actions/checkout@v4
with:
repository: openvax/netmhc-bundle
ref: v1.0.0
token: ${{ secrets.NETMHC_BUNDLE_ACCESS_TOKEN }}
path: netmhc-bundle
- name: Install netmhc-bundle dependencies
run: |
sudo apt-get update
sudo apt-get install -y tcsh gawk python2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
python -m pip install 'setuptools<81'
- name: Resolve MHCflurry version for the cache key
id: mhcflurry
run: |
echo "version=$(python -c 'import mhcflurry; print(mhcflurry.__version__)')" >> "$GITHUB_OUTPUT"
- name: Cache MHCflurry model weights
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/mhcflurry-data
key: mhcflurry-${{ runner.os }}-${{ steps.mhcflurry.outputs.version }}
- name: Install MHCflurry data
run: |
# On a cache hit this is a no-op; on a miss, retry so a transient
# download failure (e.g. the HTTP 504 that flaked a prior run)
# doesn't fail the whole job.
for attempt in 1 2 3; do
if mhcflurry-downloads fetch; then exit 0; fi
echo "mhcflurry-downloads fetch failed (attempt ${attempt}/3); retrying in 15s" >&2
sleep 15
done
echo "mhcflurry-downloads fetch failed after 3 attempts" >&2
exit 1
- name: Configure netMHC tool paths
env:
NETMHC_BUNDLE_HOME: ${{ github.workspace }}/netmhc-bundle
run: |
# Wrapper scripts have hardcoded /tools/src paths; symlink so they resolve
sudo mkdir -p /tools
sudo ln -s "$NETMHC_BUNDLE_HOME" /tools/src
- name: Run full test suite
env:
NETMHC_BUNDLE_HOME: ${{ github.workspace }}/netmhc-bundle
NETMHC_BUNDLE_TMPDIR: ${{ github.workspace }}/netmhc-bundle-tmp
run: |
mkdir -p "$NETMHC_BUNDLE_TMPDIR"
export PATH="$PATH:$NETMHC_BUNDLE_HOME/bin"
./test.sh
integration-tulip:
# Exercises the TULIP wrapper end-to-end: mhctools runs in one interpreter
# and shells out to an ISOLATED sidecar env (torch + transformers==4.32.1)
# holding a public TULIP-TCR checkout. TULIP is GPLv3; we clone (not vendor)
# it here, same as running any user-provided external tool.
runs-on: ubuntu-22.04
env:
# Cacheable uv wheel cache (torch/transformers are large downloads).
UV_CACHE_DIR: ${{ github.workspace }}/.uv-cache
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Python 3.11 so transformers==4.32.1's tokenizers install from a
# prebuilt wheel (no cp312 wheel exists; a Rust build would be needed).
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install mhctools
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
# Cache the uv wheel downloads (torch, transformers==4.32.1, ...). Keyed
# on the setup script, which pins the dependency set, so a change there
# busts the cache.
- name: Cache uv sidecar downloads
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.uv-cache
key: uv-${{ runner.os }}-py311-${{ hashFiles('scripts/setup_tulip_env.sh') }}
# Cache the public TULIP-TCR checkout (~100 MB with weights + data). The
# setup script skips cloning when predict.py is already present. Bump the
# -v1 suffix to force a fresh clone.
- name: Cache TULIP-TCR checkout
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/TULIP-TCR
key: tulip-tcr-${{ runner.os }}-v1
- name: Build isolated TULIP sidecar env + clone TULIP-TCR
env:
# This job's `python` is already 3.11; use it for the sidecar env.
TULIP_SETUP_PYTHON: python
run: |
python -m pip install uv
scripts/setup_tulip_env.sh "${{ github.workspace }}/tulip-env" \
"${{ github.workspace }}/TULIP-TCR"
- name: Run TULIP wrapper tests (incl. end-to-end)
env:
TULIP_HOME: ${{ github.workspace }}/TULIP-TCR
TULIP_PYTHON: ${{ github.workspace }}/tulip-env/bin/python
run: |
python -m pytest tests/test_tulip.py -ra