Datasets:
Formats:
csv
Languages:
English
Size:
< 1K
Tags:
chemistry
medicinal-chemistry
computational-chemistry
structure-based-design
ampa-receptor
molecular-design
File size: 2,538 Bytes
174a005 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | """Export the least-strain, k=6 examples in the deposited 4IY5 coordinate frame."""
import csv
from pathlib import Path
import numpy as np
from rdkit import Chem
from scipy.spatial.distance import cdist
from crystal_check import OVERLAY_STRUCTURES, RING_NAMES, frame, read_pdb
from relax_overlap import geometry, relaxed_fit
root=Path(__file__).resolve().parent
pose_path=root/'representative_poses.sdf'
ligand,prot,names=read_pdb(root/'4IY5.pdb.gz')
with (root/'least_strain_by_condition.csv').open() as f:
rows=[r for r in csv.DictReader(f) if r['anchor_k']=='6.0' and int(r['admissible'])>0]
with Chem.SDWriter(str(pose_path)) as writer:
writer.SetForceV3000(True)
for r in rows:
key,alt,seed=r['compound'],r['alt'],int(r['seed'])
xyz=ligand[alt]
target=np.stack([xyz[i] for i in RING_NAMES+['O1','N3']])
near=cdist(prot,np.stack(list(xyz.values()))).min(axis=1)<=15.
mol,ff,coords,indices,cap=geometry(OVERLAY_STRUCTURES[key],seed)
cp,ct,rotation=frame(coords[indices[:-2]],target[:-2])
start=(coords-cp)@rotation+ct
stats,post=relaxed_fit(ff,start,indices,target,cap,prot[near],names[near],6.,include_coordinates=True)
for field in ('ring_rmsd_A','all_ligand_heavy_protein_min_A','carbonyl_O_offset_A','amide_N_offset_A'):
assert abs(float(r[field])-stats[field])<0.00001
conf=mol.GetConformer()
for i,p in enumerate(post):
conf.SetAtomPosition(i,tuple(p))
mol=Chem.RemoveHs(mol)
mol.SetProp('_Name',key+' | modeled | 4IY5 CX5 alt '+alt)
mol.SetProp('EVIDENCE','COMPUTATIONAL EXAMPLE ONLY; receptor frame from PDB 4IY5. Unobserved modeled placement; even CX516 in this set is modeled.')
mol.SetProp('PLACEMENT_SELECTION','Lowest admissible within-graph internal strain among tested starting geometries; harmonic anchor k=6 kcal/mol/A^2')
mol.SetProp('CONFORMER_SEED',str(seed))
mol.SetProp('REFERENCE_ALT',alt)
mol.SetProp('COST_ABOVE_SAMPLED_FREE_MINIMUM_KCAL_MOL',r['within_compound_strain_kcal_mol'])
writer.write(mol)
read=list(Chem.SDMolSupplier(str(pose_path)))
assert len(read)==len(rows)==14 and all(m is not None and m.GetConformer().Is3D() for m in read)
for mol,r in zip(read,rows):
expected=Chem.MolToSmiles(Chem.MolFromSmiles(OVERLAY_STRUCTURES[r['compound']]))
assert Chem.MolToSmiles(mol)==expected
print('Verified 14 modeled placements, including the reference ligand, in the experimental receptor coordinate frame.')
|