From 796e36397002e1c9be5f56064261941ecc85cb21 Mon Sep 17 00:00:00 2001 From: DrDean <86606752+DoctorDean@users.noreply.github.com> Date: Thu, 9 Jul 2026 14:40:31 +0200 Subject: [PATCH] Fix rotted PDB download (#85) and add a MaSIF-site CI smoke test Biopython's PDBList.retrieve_pdb_file relies on legacy wwPDB paths that RCSB retired, so the built-in download fails silently and breaks the pipeline downstream (#85). Fetch directly from https://files.rcsb.org/download/ instead. Verified: the built-in flow now runs end-to-end and scores ROC-AUC 0.9137 on 4ZQK_A. Also adds a CI smoke test asserting the 4ZQK_A ROC-AUC stays >= 0.8. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/masif-site-smoke.yml | 33 ++++++++++++++++++++++ source/data_preparation/00-pdb_download.py | 19 +++++++++---- 2 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/masif-site-smoke.yml diff --git a/.github/workflows/masif-site-smoke.yml b/.github/workflows/masif-site-smoke.yml new file mode 100644 index 00000000..b8132445 --- /dev/null +++ b/.github/workflows/masif-site-smoke.yml @@ -0,0 +1,33 @@ +name: masif-site smoke test + +# A reproducibility heartbeat: on every push/PR, run MaSIF-site end-to-end on the +# canonical 4ZQK_A example (inside the published pablogainza/masif image) and assert +# the interaction-site ROC-AUC stays healthy. Had this existed, issue #85 (the rotted +# PDB download) would have been caught the day it broke. + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + masif-site-4zqk: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: MaSIF-site on 4ZQK_A (built-in download) + run: | + docker run --rm -v "$PWD:/repo" pablogainza/masif:latest bash -lc ' + set -e + # use this checkout"s (fixed) source over the baked image + cp -f /repo/source/data_preparation/00-pdb_download.py \ + /masif/source/data_preparation/00-pdb_download.py + cd /masif/data/masif_site + ./data_prepare_one.sh 4ZQK_A + ./predict_site.sh 4ZQK_A + ./color_site.sh 4ZQK_A | tee /tmp/color.log + auc=$(grep "ROC AUC score for protein" /tmp/color.log | grep -oE "[0-9.]+" | tail -1) + echo "4ZQK_A ROC-AUC = $auc" + python -c "import sys; sys.exit(0 if float(\"$auc\") >= 0.8 else 1)" + ' diff --git a/source/data_preparation/00-pdb_download.py b/source/data_preparation/00-pdb_download.py index 410df02d..07991065 100755 --- a/source/data_preparation/00-pdb_download.py +++ b/source/data_preparation/00-pdb_download.py @@ -1,6 +1,6 @@ #!/usr/bin/python import Bio -from Bio.PDB import * +from Bio.PDB import * import sys import importlib import os @@ -9,7 +9,7 @@ # Local includes from input_output.protonate import protonate -if len(sys.argv) <= 1: +if len(sys.argv) <= 1: print("Usage: "+sys.argv[0]+" PDBID_A_B") print("A or B are the chains to include in this pdb.") sys.exit(1) @@ -23,13 +23,20 @@ in_fields = sys.argv[1].split('_') pdb_id = in_fields[0] -# Download pdb -pdbl = PDBList(server='http://ftp.wwpdb.org') -pdb_filename = pdbl.retrieve_pdb_file(pdb_id, pdir=masif_opts['tmp_dir'],file_format='pdb') +# Download pdb +# NOTE (revival): Biopython's PDBList.retrieve_pdb_file() relies on legacy wwPDB +# download paths that RCSB has retired. It now fails silently, leaving no file and +# breaking the whole pipeline downstream (see issue #85). Fetch the structure +# directly from the current, stable RCSB endpoint instead. +try: + from urllib.request import urlretrieve # Python 3 +except ImportError: + from urllib import urlretrieve # Python 2 +pdb_filename = os.path.join(masif_opts['tmp_dir'], pdb_id + ".pdb") +urlretrieve("https://files.rcsb.org/download/%s.pdb" % pdb_id.upper(), pdb_filename) ##### Protonate with reduce, if hydrogens included. # - Always protonate as this is useful for charges. If necessary ignore hydrogens later. protonated_file = masif_opts['raw_pdb_dir']+"/"+pdb_id+".pdb" protonate(pdb_filename, protonated_file) pdb_filename = protonated_file -