From 7b3085bbaba97d3639e6c1620eb3af24d063bf3e Mon Sep 17 00:00:00 2001 From: Maxx Tessmer Date: Wed, 22 Apr 2026 20:20:13 -0700 Subject: [PATCH] Fix bug sometimes skipping peptide bond when using bio ccd to infer bonds. --- src/chilife/Topology.py | 12 +++++++----- src/chilife/__init__.py | 2 +- tests/test_MolSys.py | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/chilife/Topology.py b/src/chilife/Topology.py index 2853fc0..900cc32 100644 --- a/src/chilife/Topology.py +++ b/src/chilife/Topology.py @@ -422,10 +422,8 @@ def bonds_from_ccd_data(molsys, ccd_data): if "chem_comp" in ccd_data[res.resname]: res_ccd_data = ccd_data[res.resname]["chem_comp"] - if ( - pres := res.previous_residue() - ) is not None and "link type" in res_ccd_data: - link_type = res_ccd_data["link type"] + if (pres := res.previous_residue()) is not None and "type" in res_ccd_data: + link_type = res_ccd_data["type"].lower() if link_type in POLYMER_LINKAGE_TYPES: a1, a2, btype, bchiral = POLYMER_LINKAGE_TYPES[link_type] i1 = pres.ix[pres.names == a1].flat[0] @@ -477,4 +475,8 @@ def numpyify_ccd(ccd_data): # Linkage data is atom name of the previous residue followed by atom name of the current residue followed by bond type -POLYMER_LINKAGE_TYPES = {"L-peptide linking": ["C", "N", BondType.SINGLE, "N"]} +POLYMER_LINKAGE_TYPES = { + "l-peptide linking": ["C", "N", BondType.SINGLE, "N"], + "peptide linking": ["C", "N", BondType.SINGLE, "N"], + "d-peptide linking": ["C", "N", BondType.SINGLE, "N"], +} diff --git a/src/chilife/__init__.py b/src/chilife/__init__.py index 63fe186..a0a5aba 100644 --- a/src/chilife/__init__.py +++ b/src/chilife/__init__.py @@ -44,4 +44,4 @@ # SpinLabel = SpinLabel.SpinLabel # dSpinLabel = dSpinLabel.dSpinLabel -__version__ = "1.2.1" +__version__ = "1.2.2" diff --git a/tests/test_MolSys.py b/tests/test_MolSys.py index 390c4f7..6acaf43 100644 --- a/tests/test_MolSys.py +++ b/tests/test_MolSys.py @@ -707,5 +707,5 @@ def test_write_sdf(): def test_use_ccd(): mol = MolSys.from_pdb("test_data/7o1o.pdb", use_ccd=chilife.bio_ccd) - assert len(mol.bonds) == 5508 + assert len(mol.bonds) == 5863 assert chilife.BondType.DOUBLE in mol.bond_types