Skip to content

Commit

Permalink
add side chain packing flags
Browse files Browse the repository at this point in the history
  • Loading branch information
dauparas committed Mar 28, 2024
1 parent b161414 commit 3ba15a8
Show file tree
Hide file tree
Showing 63 changed files with 37,159 additions and 6 deletions.
129 changes: 129 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
76 changes: 75 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

This package provides inference code for [LigandMPNN](https://www.biorxiv.org/content/10.1101/2023.12.22.573103v1) & [ProteinMPNN](https://www.science.org/doi/10.1126/science.add2187) models. The code and model parameters are available under the MIT license.

Third party code: side chain packing uses helper functions from [Openfold](https://github.com/aqlaboratory/openfold).

### Running the code
```
git clone https://github.com/dauparas/LigandMPNN.git
Expand Down Expand Up @@ -77,7 +79,10 @@ To run the model of your choice specify `--model_type` and optionally the model
--model_type "per_residue_label_membrane_mpnn"
--checkpoint_per_residue_label_membrane_mpnn "./model_params/per_residue_label_membrane_mpnn_v_48_020.pt" #noised with 0.20A Gaussian noise
```

- Side chain packing model
```
--checkpoint_path_sc "./model_params/ligandmpnn_sc_v_32_002_16.pt"
```
## Design examples
### 1 default
Default settings will run ProteinMPNN.
Expand Down Expand Up @@ -532,6 +537,75 @@ python score.py \
--number_of_batches 10
```

## Side chain packing examples

### 1 design a new sequence and pack side chains (return 1 side chain packing sample - fast)
Design a new sequence using any of the available models and also pack side chains of the new sequence. Return only a single solution for the side chain packing.
```
python run.py \
--model_type "ligand_mpnn" \
--seed 111 \
--pdb_path "./inputs/1BC8.pdb" \
--out_folder "./outputs/sc_default_fast" \
--pack_side_chains 1 \
--number_of_packs_per_design 0 \
--pack_with_ligand_context 1
```
### 2 design a new sequence and pack side chains (return 4 side chain packing samples)
Same as above, but returns 4 independent samples for side chains. b-factor shows log prob density per chi angle group.
```
python run.py \
--model_type "ligand_mpnn" \
--seed 111 \
--pdb_path "./inputs/1BC8.pdb" \
--out_folder "./outputs/sc_default" \
--pack_side_chains 1 \
--number_of_packs_per_design 4 \
--pack_with_ligand_context 1
```

### 3 fix specific residues fors sequence design and packing
This option will not repack side chains of the fixed residues, but use them as a context.
```
python run.py \
--model_type "ligand_mpnn" \
--seed 111 \
--pdb_path "./inputs/1BC8.pdb" \
--out_folder "./outputs/sc_fixed_residues" \
--pack_side_chains 1 \
--number_of_packs_per_design 4 \
--pack_with_ligand_context 1 \
--fixed_residues "C6 C7 C8 C9 C10 C11 C12 C13 C14 C15" \
--repack_everything 0
```
### 4 fix specific residues for sequence design but repack everything
This option will repacks all the residues.
```
python run.py \
--model_type "ligand_mpnn" \
--seed 111 \
--pdb_path "./inputs/1BC8.pdb" \
--out_folder "./outputs/sc_fixed_residues_full_repack" \
--pack_side_chains 1 \
--number_of_packs_per_design 4 \
--pack_with_ligand_context 1 \
--fixed_residues "C6 C7 C8 C9 C10 C11 C12 C13 C14 C15" \
--repack_everything 1
```

### 5 design a new sequence using LigandMPNN but pack side chains without considering ligand/DNA etc atoms
You can run side chain packing without taking into account context atoms like DNA atoms. This most likely will results in side chain clashing with context atoms, but it might be interesting to see how model's uncertainty changes when ligand atoms are present vs not for side chain conformations.
```
python run.py \
--model_type "ligand_mpnn" \
--seed 111 \
--pdb_path "./inputs/1BC8.pdb" \
--out_folder "./outputs/sc_no_context" \
--pack_side_chains 1 \
--number_of_packs_per_design 4 \
--pack_with_ligand_context 0
```

### Things to add
- Support for ProteinMPNN CA-only model.
- Examples for scoring sequences only.
Expand Down
5 changes: 4 additions & 1 deletion get_model_params.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@ wget -q https://files.ipd.uw.edu/pub/ligandmpnn/global_label_membrane_mpnn_v_48_
wget -q https://files.ipd.uw.edu/pub/ligandmpnn/solublempnn_v_48_002.pt -O $1"/solublempnn_v_48_002.pt"
wget -q https://files.ipd.uw.edu/pub/ligandmpnn/solublempnn_v_48_010.pt -O $1"/solublempnn_v_48_010.pt"
wget -q https://files.ipd.uw.edu/pub/ligandmpnn/solublempnn_v_48_020.pt -O $1"/solublempnn_v_48_020.pt"
wget -q https://files.ipd.uw.edu/pub/ligandmpnn/solublempnn_v_48_030.pt -O $1"/solublempnn_v_48_030.pt"
wget -q https://files.ipd.uw.edu/pub/ligandmpnn/solublempnn_v_48_030.pt -O $1"/solublempnn_v_48_030.pt"

#LigandMPNN for side-chain packing (multi-step denoising model)
wget -q https://files.ipd.uw.edu/pub/ligandmpnn/ligandmpnn_sc_v_32_002_16.pt -O $1"/ligandmpnn_sc_v_32_002_16.pt"
6 changes: 6 additions & 0 deletions openfold/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#from . import model
#from . import utils
#from . import np
#from . import resources

#__all__ = ["model", "utils", "np", "data", "resources"]
Loading

0 comments on commit 3ba15a8

Please sign in to comment.