SwinSite is a deep learning-based method for predicting protein–ligand binding sites using a hybrid of Swin Transformer and 3D CNN architectures. It processes protein structures in 3D and outputs likely binding regions.
conda create -n swinsite python=3.12
conda activate swinsite
# Install PyTorch with CUDA support
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126pip install openbabel-wheel matplotlib py3dmol einops scikit-image scikit-learn h5py tqdm timmRun the prediction script on a set of protein–ligand complexes:
python predict.py \
-i ./example \
-o ./output/example \
-l ./logs/log.txtArguments:
-i: Path to input directory (should contain subdirectories withprotein.pdbandligand.mol2)-f: File format (default:pdb, optional:mol2)-o: Output directory-l: Log file path
The predicted pockets and grids will be saved in the specified output directory.
To run both prediction and visualization in an interactive environment:
-
Launch Jupyter Lab:
jupyter lab
-
Open the notebook:
predict_and_visualize.ipynb
This notebook:
- Runs
predict.pyfor inference - Uses
py3Dmolto visualize proteins, ligands, and predicted pockets
example/
├── 1abc/
│ ├── protein.pdb
│ ├── ligand.mol2
├── 2xyz/
│ ├── protein.pdb
│ ├── ligand.mol2
Each subdirectory should contain a single protein–ligand pair.
For each processed sample, the following files will be generated:
pocket_*.mol2: Atom-level predicted pocketsgrid_*.mol2: Grid-based volumetric pocketslog.txt: Log file containing progress and error messages