Xi-Spirane-4 / geometry /verify.py
PureOne's picture
Release Xi-Spirane 4 research dataset
174a005 verified
Raw History Blame Contribute Delete
1.58 kB
"""Integrity, row-coverage and arithmetic checks on the released geometric results."""
import csv
import gzip
import hashlib
import json
from pathlib import Path
from math import isclose
root=Path(__file__).resolve().parent
assert hashlib.sha256(gzip.decompress((root/'4IY5.pdb.gz').read_bytes())).hexdigest()=='63d3747763cf731f3e3638d613cc576c34a59531dac8a971d3a395f82ad761c4'
def table(name):
with (root/name).open() as f:
return list(csv.DictReader(f))
free=table('conformer_endpoints.csv')
rigid=table('crystal_placements.csv')
relaxed=table('relaxation_endpoints.csv')
minima=table('least_strain_by_condition.csv')
assert len(free)==288 and all(r['status']=='converged' for r in free)
assert len(rigid)==1344 and len({(r['compound'],r['seed'],r['alt']) for r in rigid})==1344
assert len(relaxed)==132 and all(r['converged']=='True' for r in relaxed)
assert len(minima)==28
assert len({r['compound'] for r in minima})==7
for m in minima:
filt=[r for r in relaxed if r['compound']==m['compound'] and r['alt']==m['alt'] and r['anchor_force_constant']==m['anchor_k']]
val=[float(r['within_compound_strain_kcal_mol']) for r in filt if float(r['ring_rmsd_A'])<=.75 and
max(float(r['carbonyl_O_offset_A']),float(r['amide_N_offset_A']))<=1. and float(r['all_ligand_heavy_protein_min_A'])>=2.9]
assert len(val)==int(m['admissible']) and isclose(min(val),float(m['within_compound_strain_kcal_mol']),abs_tol=1.e-7)
print('Verified crystal SHA-256, 288 free endpoints, 1,344 rigid placements, 132 relaxed endpoints and 28 summarized conditions.')