Skip to content

Commit 2c426e5

Browse files
Acedrg atom name fixes (#123)
1 parent 8e4a359 commit 2c426e5

File tree

4 files changed

+13
-19
lines changed

4 files changed

+13
-19
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CCP4i2 Changelog
22

3+
## [2.5.1] - 2026-02-05
4+
5+
- Fix to spaces/quoting in AceDRG atom name matching
6+
37
## [2.5.0] - 2026-01-06
48

59
- New task to check a model against AU contents

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2.5.0
1+
v2.5.1

core/version.params.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<function>PARAMS</function>
66
<pluginName>ccp4i2</pluginName>
77
<userId></userId>
8-
<creationTime>06/Jan/2026</creationTime>
9-
<ccp4iVersion>2.5.0</ccp4iVersion>
8+
<creationTime>05/Feb/2026</creationTime>
9+
<ccp4iVersion>2.5.1</ccp4iVersion>
1010
<pluginVersion></pluginVersion>
1111
</ccp4i2_header>
1212
</ccp4i2>

wrappers/acedrgNew/script/atomMatching.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
1-
from __future__ import print_function
2-
31
import sys
42
import os
53
import argparse
6-
import re
74

85
import ccp4mg
96
import mmdb2
107
import ccp4srs
118

12-
from rdkit import Chem
13-
from rdkit.Chem import AllChem
14-
import rdkit
15-
169
from gemmi import cif
1710

1811
from .dictFileToMonomer import dictFileToMonomer
@@ -27,11 +20,15 @@ def changeDictionaryAtomNames(doc, changes):
2720
col = block.find_values(tag)
2821
for i, atomId in enumerate(col):
2922
if atomId in changes:
30-
col[i] = cif.quote(changes[atomId])
23+
newId = changes[atomId]
24+
if "'" in newId or '"' in newId:
25+
col[i] = cif.quote(newId)
26+
else:
27+
col[i] = newId
3128

3229
def replaceMatchesInDict(matches,theDict,outfile):
3330
#Gemmi returns the vaules in the cif document with no leading/trailing whitespace.
34-
matches = {k.strip(): v for k, v in matches.items()}
31+
matches = {k.strip(): v.strip() for k, v in matches.items()}
3532
try:
3633
doc = cif.read_file(theDict)
3734
changeDictionaryAtomNames(doc,matches)
@@ -369,10 +366,3 @@ def matchAtoms(ifname,ofname=None,dictMatchName=None,selection="",dictFileName=N
369366
dictFileName = args.f
370367
retMatches = matchAtoms(ifname,ofname,dictMatchName,selection,dictFileName)
371368
print(retMatches)
372-
373-
"""
374-
mol = Chem.rdmolfiles.MolFromPDBFile(sys.argv[1],removeHs=False)
375-
print mol
376-
This is how we'd get to PDB file from RDKit.
377-
print Chem.rdmolfiles.MolToPDBBlock(mol)
378-
"""

0 commit comments

Comments
 (0)