Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
82688f0
shape argument added
Feb 17, 2026
cc6ac17
shape test added
rversin Feb 19, 2026
46ecf2a
shape handling added
rversin Feb 19, 2026
9f1d8f3
capri shape fix
rversin Feb 20, 2026
d9a5a78
Merge branch 'CG-HADDOCK' of https://github.com/haddocking/haddock3 i…
amjjbonvin Apr 13, 2026
692d0c5
Fixed shape issue in cgtoaa and added shape docking example
amjjbonvin Apr 13, 2026
1222085
Updated config files
amjjbonvin Apr 13, 2026
5dad2f8
Updated protein-protein-shape docking example
amjjbonvin Apr 13, 2026
cb1e962
Updated config files, added end-to-end test
amjjbonvin Apr 13, 2026
e6c6d47
Added mol_fix_origin=true for shape
amjjbonvin Apr 14, 2026
25b705d
missing dockstring and definition added
rversin Apr 14, 2026
c5d7130
corrected code
rversin Apr 14, 2026
5cb554d
usage of Path instead of splicing
rversin Apr 14, 2026
c57dae4
test fixed
rversin Apr 15, 2026
8e7b003
Add check for shape before reading cg-to-aa restraints
amjjbonvin Apr 15, 2026
f0fb788
Merge branch 'CG-HADDOCK-shape' of https://github.com/haddocking/hadd…
amjjbonvin Apr 15, 2026
59c38fd
shape removed from martinize
rversin Apr 15, 2026
9dcb648
shape check added
rversin Apr 15, 2026
1840ab7
shape checking function added
rversin Apr 15, 2026
2475f40
shape removed from martinize
rversin Apr 15, 2026
b9b0a54
shape checks updated
rversin Apr 15, 2026
92d2de3
test for generate_topology fixed
rversin Apr 15, 2026
7d6c75a
Avoid reading of cg-to-aa restraints for shape
amjjbonvin Apr 15, 2026
b2024ef
Merge branch 'CG-HADDOCK-shape' of https://github.com/haddocking/hadd…
amjjbonvin Apr 15, 2026
88fc754
Correction
amjjbonvin Apr 15, 2026
1a93483
add helper function in CG file generation
VGPReys Apr 16, 2026
a924dd0
.psf to .Format.TOPOLOGY
VGPReys Apr 16, 2026
f62f615
fix origin name
VGPReys Apr 16, 2026
b98db55
fix aa psf filepath
VGPReys Apr 16, 2026
267100e
full path usage
rversin Apr 16, 2026
df61242
shape added to PDBFile
rversin Apr 16, 2026
3fd590e
selection of spage residues
rversin Apr 16, 2026
3812fdf
Merge branch 'CG-HADDOCK-shape' into enhance-filename-generation-cg
VGPReys Apr 16, 2026
2bd6c74
Merge pull request #1521 from haddocking/enhance-filename-generation-cg
VGPReys Apr 16, 2026
b94a039
add check for backmapping file in tests
VGPReys Apr 20, 2026
9dfc8bf
path issues and remove tmp files
VGPReys Apr 20, 2026
0e0c184
fname in end2end
VGPReys Apr 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changelog

- 2026-04-13: Fixed issue with shape in cgtoa module and added shape docking example
- 2026-03-30: Added nucleosome-PCR1 CG docking example
- 2026-03-09: Automated type casting for optional argument seed in haddock3-restraints random_removal - Issue #1485
- 2026-02-28: Switched to ilRMSD clustering from protein-ligand examples - Issue #1481
Expand Down
54 changes: 54 additions & 0 deletions end-to-end_tests/test_protein-protein-shape.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""End-to-end test for the protein-protein-shape docking example."""

import shutil
import tempfile
import gzip
from pathlib import Path

from haddock.clis.cli import main as cli_main

import warnings
from Bio.PDB.PDBExceptions import PDBConstructionWarning


EXAMPLE_DIR = (
Path(__file__).resolve().parents[1] / "examples" / "docking-protein-protein-shape"
)

def test_protein_protein_shape(monkeypatch):
"""Test protein-protein-shape CG docking example.

Uses docking-protein-protein-shape-CG-test.cfg to run the full pipeline
(topoaa, topocg rigidbody, caprieval, seletop, flexref, caprieval, cgtoaa, emref, caprieval,
clustfcc, seletopclusts, caprieva)
"""
warnings.simplefilter('ignore', PDBConstructionWarning)

with tempfile.TemporaryDirectory() as tmpdir:
shutil.copytree(Path(EXAMPLE_DIR, "data"), Path(tmpdir, "data"))
cfg = Path(tmpdir, "docking-protein-protein-shape-CG-test.cfg")
shutil.copy(
Path(EXAMPLE_DIR, "docking-protein-protein-shape-CG-test.cfg"), cfg
)

monkeypatch.chdir(tmpdir)
cli_main(cfg)

run_dir = Path("run1-CG-test")

# Verify all workflow steps produced output directories
assert Path(run_dir, "00_topoaa").exists(), f"00_topoaa not created"
assert Path(run_dir, "01_topocg").exists(), f"01_topocg not created"
assert Path(run_dir, "02_rigidbody").exists(), f"02_rigidbody not created"
assert Path(run_dir, "03_caprieval").exists(), f"03_caprieval not created"
assert Path(run_dir, "04_seletop").exists(), f"04_seletop created"
assert Path(run_dir, "05_flexref").exists(), f"05_flexref not created"
assert Path(run_dir, "06_caprieval").exists(), f"06_caprieval not created"
assert Path(run_dir, "07_cgtoaa").exists(), f"07_cgtoaa not created"
assert Path(run_dir, "08_emref").exists(), f"08_emref not created"
assert Path(run_dir, "09_caprieval").exists(), f"09_caprieval not created"
assert Path(run_dir, "10_clustfcc").exists(), f"10_clustfcc not created"
assert Path(run_dir, "11_seletopclusts").exists(), f"10_seletopclusts not created"
assert Path(run_dir, "12_caprieval").exists(), f"12_caprieval not created"
Comment thread
rvhonorato marked this conversation as resolved.
with gzip.open(Path(run_dir, "08_emref/emref_1.pdb.gz"), 'rt') as f:
assert any('SHA SHA S' in line for line in f), f"Shape atoms not found in emref PDB file"
2,034 changes: 2,034 additions & 0 deletions examples/docking-protein-protein-shape/data/2r15_A.pdb

Large diffs are not rendered by default.

2,034 changes: 2,034 additions & 0 deletions examples/docking-protein-protein-shape/data/2r15_B.pdb

Large diffs are not rendered by default.

4,023 changes: 4,023 additions & 0 deletions examples/docking-protein-protein-shape/data/2r15_reference.pdb

Large diffs are not rendered by default.

208 changes: 208 additions & 0 deletions examples/docking-protein-protein-shape/data/ambig-shape.tbl

Large diffs are not rendered by default.

418 changes: 418 additions & 0 deletions examples/docking-protein-protein-shape/data/shape.pdb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# ====================================================================
# Protein-protein docking example with shape restraints

# directory in which the scoring will be done
run_dir = "run1-CG-full"

# execution mode
mode = "local"
ncores = 50

# molecules to be docked
molecules = [
"data/2r15_A.pdb",
"data/2r15_B.pdb",
"data/shape.pdb",
]

# ====================================================================
# Parameters for each stage are defined below, prefer full paths
# ====================================================================
[topoaa]

[topocg]

[rigidbody]
tolerance = 20
ambig_fname = "data/ambig-shape.tbl"
mol_shape_3 = true

Comment thread
rversin marked this conversation as resolved.
[caprieval]
reference_fname = "data/2r15_reference.pdb"
fnat_cutoff = 7.0 # cutoff for coarse-grained structures

[seletop]

[flexref]
tolerance = 20
ambig_fname = "data/ambig-shape.tbl"
mol_shape_3 = true

[caprieval]
reference_fname = "data/2r15_reference.pdb"
fnat_cutoff = 7.0 # cutoff for coarse-grained structures

[cgtoaa]
mol_shape_3 = true
log_level = 'verbose'

[emref]
tolerance = 20
ambig_fname = "data/ambig-shape.tbl"
mol_shape_3 = true

[caprieval]
reference_fname = "data/2r15_reference.pdb"

[clustfcc]
min_population = 4

[seletopclusts]
top_models = 4

[caprieval]
reference_fname = "data/2r15_reference.pdb"

# ====================================================================

Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# ====================================================================
# Protein-protein docking example with shape restraints

# directory in which the scoring will be done
run_dir = "run1-CG-test"

# execution mode
mode = "local"
ncores = 10
debug = true

# molecules to be docked
molecules = [
"data/2r15_A.pdb",
"data/2r15_B.pdb",
"data/shape.pdb",
]

# ====================================================================
# Parameters for each stage are defined below, prefer full paths
# ====================================================================
[topoaa]

[topocg]

[rigidbody]
tolerance = 20
ambig_fname = "data/ambig-shape.tbl"
sampling = 5
mol_shape_3 = true

Comment thread
rversin marked this conversation as resolved.
[caprieval]
reference_fname = "data/2r15_reference.pdb"
fnat_cutoff = 7.0 # cutoff for coarse-grained structures

[seletop]
select = 2

[flexref]
tolerance = 20
ambig_fname = "data/ambig-shape.tbl"
mol_shape_3 = true

[caprieval]
reference_fname = "data/2r15_reference.pdb"
fnat_cutoff = 7.0 # cutoff for coarse-grained structures

[cgtoaa]
mol_shape_3 = true

[emref]
tolerance = 20
ambig_fname = "data/ambig-shape.tbl"
mol_shape_3 = true

[caprieval]
reference_fname = "data/2r15_reference.pdb"

[clustfcc]
min_population = 1

[seletopclusts]
top_models = 4

[caprieval]
reference_fname = "data/2r15_reference.pdb"

# ====================================================================

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# ====================================================================
# Protein-protein docking example with shape restraints

# directory in which the scoring will be done
run_dir = "run1-full"

# execution mode
mode = "local"
ncores = 50

# molecules to be docked
molecules = [
"data/2r15_A.pdb",
"data/2r15_B.pdb",
"data/shape.pdb",
]

# ====================================================================
# Parameters for each stage are defined below, prefer full paths
# ====================================================================
[topoaa]

[rigidbody]
tolerance = 20
ambig_fname = "data/ambig-shape.tbl"
mol_shape_3 = true

Comment thread
rversin marked this conversation as resolved.
[caprieval]
reference_fname = "data/2r15_reference.pdb"

[seletop]

[flexref]
tolerance = 20
ambig_fname = "data/ambig-shape.tbl"
mol_shape_3 = true

[caprieval]
reference_fname = "data/2r15_reference.pdb"

[emref]
tolerance = 20
ambig_fname = "data/ambig-shape.tbl"
mol_shape_3 = true

[caprieval]
reference_fname = "data/2r15_reference.pdb"

[clustfcc]
min_population = 4

[seletopclusts]
top_models = 4

[caprieval]
reference_fname = "data/2r15_reference.pdb"

# ====================================================================

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# ====================================================================
# Protein-protein docking example with shape restraints

# directory in which the scoring will be done
run_dir = "run1-test"

# execution mode
mode = "local"
ncores = 10

# molecules to be docked
molecules = [
"data/2r15_A.pdb",
"data/2r15_B.pdb",
"data/shape.pdb",
]

# ====================================================================
# Parameters for each stage are defined below, prefer full paths
# ====================================================================
[topoaa]

[rigidbody]
tolerance = 20
ambig_fname = "data/ambig-shape.tbl"
sampling = 5
mol_shape_3 = true

Comment thread
rversin marked this conversation as resolved.
[caprieval]
reference_fname = "data/2r15_reference.pdb"

[seletop]
select = 2

[flexref]
tolerance = 20
ambig_fname = "data/ambig-shape.tbl"
mol_shape_3 = true

[caprieval]
reference_fname = "data/2r15_reference.pdb"

[emref]
tolerance = 20
ambig_fname = "data/ambig-shape.tbl"
mol_shape_3 = true

[caprieval]
reference_fname = "data/2r15_reference.pdb"

[clustfcc]
min_population = 1

[seletopclusts]
top_models = 4

[caprieval]
reference_fname = "data/2r15_reference.pdb"

# ====================================================================

5 changes: 4 additions & 1 deletion src/haddock/libs/libaa2cg.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ def martinize(input_pdb, output_path, skipss):
Returns:
cg_pdb_name: str
Comment thread
rversin marked this conversation as resolved.
Outdated
Comment thread
rversin marked this conversation as resolved.
Outdated
"""
shape = False
Comment thread
rversin marked this conversation as resolved.
Outdated

if not input_pdb:
emsg = "No input file detected"
Expand Down Expand Up @@ -906,6 +907,8 @@ def martinize(input_pdb, output_path, skipss):
for residue in mapping_dic:
if residue.id[0] != " ": # filter HETATMS
continue
if residue.resname == "SHA":
shape = True
Comment thread
rvhonorato marked this conversation as resolved.
Outdated

structure_builder.init_residue(residue.resname, residue.id[0],
residue.id[1], residue.id[2])
Expand Down Expand Up @@ -964,5 +967,5 @@ def martinize(input_pdb, output_path, skipss):
tbl_file.write(f"\n{tbl_str}")
tbl_file.close()

return cg_pdb_name
return cg_pdb_name, shape

2 changes: 1 addition & 1 deletion src/haddock/modules/analysis/caprieval/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def _run(self) -> None:

if ff == "martini2":
references = [
Path(martinize(ref_aa, self.path, False))
Path(martinize(ref_aa, self.path, False)[0])
for ref_aa in self.get_reference(models)
]
else:
Expand Down
16 changes: 10 additions & 6 deletions src/haddock/modules/refinement/cgtoaa/cns/cgtoaa.cns
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ do (segid = segid + "CG") (not segid S)
evaluate ($nchain=0)
while ($nchain < $data.ncomponents) loop nloop1
evaluate ($nchain = $nchain + 1)
structure @@$input_aa_psf_filename_$nchain end
coor @@$input_aa_pdb_filename_$nchain
if ($mol_shape_$nchain eq false) then
structure @@$input_aa_psf_filename_$nchain end
coor @@$input_aa_pdb_filename_$nchain
end if
end loop nloop1

{* Read paramters and set various force field related variables *}
Expand Down Expand Up @@ -161,17 +163,19 @@ evaluate ($kinter = 0.001)

flag excl * incl noe end

! Fix the CG model
fix sele=(segid *CG) end
! Fix the CG model and any shape
fix sele=(segid *CG or segid S) end
Comment thread
rvhonorato marked this conversation as resolved.

! Rigid body EM to position AA model onto CG model
!
minimize rigid
eval ($nchain = 0)
while ($nchain < $data.ncomponents) loop nloop1
eval($nchain = $nchain + 1)
group (segid $prot_segid_$nchain)
translation=true
if ($mol_shape_$nchain eq false) then
group (segid $prot_segid_$nchain)
translation=true
end if
end loop nloop1
nstep 200
nprint 10
Expand Down
Loading
Loading