Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- code/action_executor.py +654 -0
- code/benchmark_eval.py +400 -0
- code/build_dataset_v2.py +187 -0
- code/mol_corrupt.py +544 -0
- code/mol_ops.py +287 -0
- code/validate_with_executor.py +263 -0
- data/benchmark_results_claude_opus46.json +0 -0
- data/benchmark_results_gemini3.json +0 -0
- data/benchmark_results_gemini31.json +0 -0
- data/benchmark_results_gpt54.json +0 -0
- data/benchmark_results_gpt55.json +1901 -0
- data/benchmark_summary.json +302 -0
- data/dataset.json +0 -0
- data/images/000000.png +3 -0
- data/images/000001.png +3 -0
- data/images/000002.png +3 -0
- data/images/000003.png +3 -0
- data/images/000004.png +3 -0
- data/images/000005.png +3 -0
- data/images/000006.png +3 -0
- data/images/000007.png +3 -0
- data/images/000008.png +3 -0
- data/images/000009.png +3 -0
- data/images/000010.png +3 -0
- data/images/000011.png +3 -0
- data/images/000012.png +3 -0
- data/images/000013.png +3 -0
- data/images/000014.png +3 -0
- data/images/000015.png +3 -0
- data/images/000016.png +3 -0
- data/images/000017.png +3 -0
- data/images/000018.png +3 -0
- data/images/000019.png +3 -0
- data/images/000020.png +3 -0
- data/images/000021.png +3 -0
- data/images/000022.png +3 -0
- data/images/000023.png +3 -0
- data/images/000024.png +3 -0
- data/images/000025.png +3 -0
- data/images/000026.png +3 -0
- data/images/000027.png +3 -0
- data/images/000028.png +3 -0
- data/images/000029.png +3 -0
- data/images/000030.png +3 -0
- data/images/000031.png +3 -0
- data/images/000032.png +3 -0
- data/images/000033.png +3 -0
- data/images/000034.png +3 -0
- data/images/000035.png +3 -0
- data/images/000036.png +3 -0
code/action_executor.py
ADDED
|
@@ -0,0 +1,654 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
ActionExecutor — general-purpose molecular editing via a clean JSON Action protocol.
|
| 3 |
+
|
| 4 |
+
Design:
|
| 5 |
+
- Graph-level: ChangeAtom, AddAtom, RemoveAtom, ChangeBond, AddBond, RemoveBond
|
| 6 |
+
- Shorthand: AddGroup, RemoveGroup
|
| 7 |
+
- Stereo: FlipChirality, FlipEZ
|
| 8 |
+
- Semantic: MoveSubstituent, SwapSubstituents
|
| 9 |
+
- Composite: Batch
|
| 10 |
+
|
| 11 |
+
AtomRef (how to select an atom in the input SMILES):
|
| 12 |
+
{"map_num": 5} atom map number (preferred)
|
| 13 |
+
{"smarts": "[NH2]", "match_idx": 0} SMARTS pattern (most flexible)
|
| 14 |
+
{"idx": 3} raw atom index (fragile)
|
| 15 |
+
|
| 16 |
+
BondRef:
|
| 17 |
+
{"atom1": <AtomRef>, "atom2": <AtomRef>}
|
| 18 |
+
|
| 19 |
+
Usage:
|
| 20 |
+
ex = ActionExecutor()
|
| 21 |
+
new_smiles = ex.execute("CCO", {"type": "ChangeAtom", "atom": {"idx": 2}, "element": "N"})
|
| 22 |
+
# → "CCN"
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
import copy
|
| 26 |
+
import sys, os
|
| 27 |
+
sys.path.insert(0, os.path.dirname(__file__))
|
| 28 |
+
|
| 29 |
+
from rdkit import Chem
|
| 30 |
+
from rdkit.Chem import rdmolops
|
| 31 |
+
from rdkit import RDLogger
|
| 32 |
+
RDLogger.DisableLog("rdApp.*")
|
| 33 |
+
|
| 34 |
+
from mol_ops import (
|
| 35 |
+
BOND_TYPE_MAP, ELEM_TO_NUM,
|
| 36 |
+
add_functional_group, remove_functional_group, flip_ez,
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
# ---------------------------------------------------------------------------
|
| 41 |
+
# Exceptions
|
| 42 |
+
# ---------------------------------------------------------------------------
|
| 43 |
+
|
| 44 |
+
class ActionError(Exception):
|
| 45 |
+
"""Base class for all executor errors."""
|
| 46 |
+
|
| 47 |
+
class AtomNotFoundError(ActionError):
|
| 48 |
+
"""Raised when an AtomRef cannot be resolved."""
|
| 49 |
+
|
| 50 |
+
class BondNotFoundError(ActionError):
|
| 51 |
+
"""Raised when a BondRef cannot be resolved."""
|
| 52 |
+
|
| 53 |
+
class InvalidMolError(ActionError):
|
| 54 |
+
"""Raised when an operation produces an invalid molecule."""
|
| 55 |
+
|
| 56 |
+
class UnknownActionError(ActionError):
|
| 57 |
+
"""Raised for unsupported action types."""
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
# ---------------------------------------------------------------------------
|
| 61 |
+
# Helpers
|
| 62 |
+
# ---------------------------------------------------------------------------
|
| 63 |
+
|
| 64 |
+
BOND_STEREO_MAP = {
|
| 65 |
+
"E": Chem.BondStereo.STEREOE,
|
| 66 |
+
"Z": Chem.BondStereo.STEREOZ,
|
| 67 |
+
"CIS": Chem.BondStereo.STEREOZ,
|
| 68 |
+
"TRANS": Chem.BondStereo.STEREOE,
|
| 69 |
+
"NONE": Chem.BondStereo.STEREONONE,
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def _sanitize(rw, context=""):
|
| 74 |
+
try:
|
| 75 |
+
Chem.SanitizeMol(rw)
|
| 76 |
+
except Exception as e:
|
| 77 |
+
raise InvalidMolError(f"Sanitization failed{' (' + context + ')' if context else ''}: {e}")
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
def _reset_atom_hs(atom):
|
| 81 |
+
"""Clear explicit Hs and radical state so SanitizeMol recomputes implicit Hs."""
|
| 82 |
+
atom.SetNumExplicitHs(0)
|
| 83 |
+
atom.SetNoImplicit(False)
|
| 84 |
+
atom.SetNumRadicalElectrons(0)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def _kekulize_rw(rw: Chem.RWMol) -> Chem.RWMol:
|
| 88 |
+
"""Return a copy with aromatic bonds replaced by explicit single/double (Kekulé form)."""
|
| 89 |
+
rw2 = Chem.RWMol(copy.deepcopy(rw))
|
| 90 |
+
Chem.Kekulize(rw2, clearAromaticFlags=True)
|
| 91 |
+
return rw2
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def _to_canonical(mol):
|
| 95 |
+
for a in mol.GetAtoms():
|
| 96 |
+
a.SetAtomMapNum(0)
|
| 97 |
+
return Chem.MolToSmiles(mol)
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
def _shared_rings(mol, idx1, idx2):
|
| 101 |
+
"""Return set of ring-atom-index sets that contain both idx1 and idx2."""
|
| 102 |
+
ri = mol.GetRingInfo()
|
| 103 |
+
return [r for r in ri.AtomRings() if idx1 in r and idx2 in r]
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
# ---------------------------------------------------------------------------
|
| 107 |
+
# ActionExecutor
|
| 108 |
+
# ---------------------------------------------------------------------------
|
| 109 |
+
|
| 110 |
+
class ActionExecutor:
|
| 111 |
+
"""
|
| 112 |
+
Apply a JSON Action to a SMILES string and return the modified SMILES.
|
| 113 |
+
|
| 114 |
+
Public API:
|
| 115 |
+
execute(smiles, action) → str
|
| 116 |
+
execute_batch(smiles, actions) → str
|
| 117 |
+
"""
|
| 118 |
+
|
| 119 |
+
# ── Atom / Bond resolution ───────────────────────────────────────────────
|
| 120 |
+
|
| 121 |
+
def _resolve_atom(self, mol, ref: dict) -> int:
|
| 122 |
+
"""Resolve an AtomRef dict to a concrete atom index in mol."""
|
| 123 |
+
if "map_num" in ref:
|
| 124 |
+
mn = ref["map_num"]
|
| 125 |
+
for a in mol.GetAtoms():
|
| 126 |
+
if a.GetAtomMapNum() == mn:
|
| 127 |
+
return a.GetIdx()
|
| 128 |
+
raise AtomNotFoundError(f"No atom with map_num={mn}")
|
| 129 |
+
|
| 130 |
+
if "smarts" in ref:
|
| 131 |
+
patt = Chem.MolFromSmarts(ref["smarts"])
|
| 132 |
+
if patt is None:
|
| 133 |
+
raise AtomNotFoundError(f"Invalid SMARTS: {ref['smarts']!r}")
|
| 134 |
+
matches = mol.GetSubstructMatches(patt)
|
| 135 |
+
mi = ref.get("match_idx", 0)
|
| 136 |
+
if not matches or mi >= len(matches):
|
| 137 |
+
raise AtomNotFoundError(
|
| 138 |
+
f"SMARTS {ref['smarts']!r} match_idx={mi}: "
|
| 139 |
+
f"found {len(matches)} match(es)"
|
| 140 |
+
)
|
| 141 |
+
return matches[mi][0]
|
| 142 |
+
|
| 143 |
+
if "idx" in ref:
|
| 144 |
+
idx = ref["idx"]
|
| 145 |
+
if idx < 0 or idx >= mol.GetNumAtoms():
|
| 146 |
+
raise AtomNotFoundError(f"idx={idx} out of range (mol has {mol.GetNumAtoms()} atoms)")
|
| 147 |
+
return idx
|
| 148 |
+
|
| 149 |
+
raise AtomNotFoundError(f"AtomRef must have 'map_num', 'smarts', or 'idx': got {ref}")
|
| 150 |
+
|
| 151 |
+
def _resolve_bond(self, mol, bond_ref: dict):
|
| 152 |
+
"""Resolve a BondRef to (idx1, idx2, Bond)."""
|
| 153 |
+
i1 = self._resolve_atom(mol, bond_ref["atom1"])
|
| 154 |
+
i2 = self._resolve_atom(mol, bond_ref["atom2"])
|
| 155 |
+
bond = mol.GetBondBetweenAtoms(i1, i2)
|
| 156 |
+
if bond is None:
|
| 157 |
+
raise BondNotFoundError(f"No bond between atom idx {i1} and {i2}")
|
| 158 |
+
return i1, i2, bond
|
| 159 |
+
|
| 160 |
+
# ── Action handlers ──────────────────────────────────────────────────────
|
| 161 |
+
|
| 162 |
+
def _change_atom(self, rw: Chem.RWMol, action: dict):
|
| 163 |
+
idx = self._resolve_atom(rw, action["atom"])
|
| 164 |
+
atom = rw.GetAtomWithIdx(idx)
|
| 165 |
+
|
| 166 |
+
if "element" in action:
|
| 167 |
+
n = ELEM_TO_NUM.get(action["element"])
|
| 168 |
+
if n is None:
|
| 169 |
+
raise ActionError(f"Unknown element: {action['element']!r}")
|
| 170 |
+
atom.SetAtomicNum(n)
|
| 171 |
+
atom.SetNoImplicit(False)
|
| 172 |
+
|
| 173 |
+
if "charge" in action:
|
| 174 |
+
atom.SetFormalCharge(int(action["charge"]))
|
| 175 |
+
_reset_atom_hs(atom)
|
| 176 |
+
|
| 177 |
+
if "isotope" in action and action["isotope"] is not None:
|
| 178 |
+
atom.SetIsotope(int(action["isotope"]))
|
| 179 |
+
|
| 180 |
+
if "num_hs" in action and action["num_hs"] is not None:
|
| 181 |
+
atom.SetNumExplicitHs(int(action["num_hs"]))
|
| 182 |
+
atom.SetNoImplicit(True)
|
| 183 |
+
|
| 184 |
+
atom.UpdatePropertyCache(strict=False)
|
| 185 |
+
_sanitize(rw, "ChangeAtom")
|
| 186 |
+
return rw
|
| 187 |
+
|
| 188 |
+
def _add_atom(self, rw: Chem.RWMol, action: dict):
|
| 189 |
+
anchor_idx = self._resolve_atom(rw, action["anchor"])
|
| 190 |
+
elem = action["element"]
|
| 191 |
+
n = ELEM_TO_NUM.get(elem)
|
| 192 |
+
if n is None:
|
| 193 |
+
raise ActionError(f"Unknown element: {elem!r}")
|
| 194 |
+
|
| 195 |
+
order = action.get("bond_order", "SINGLE").upper()
|
| 196 |
+
bond_type = BOND_TYPE_MAP.get(order)
|
| 197 |
+
if bond_type is None:
|
| 198 |
+
raise ActionError(f"Unknown bond order: {order!r}")
|
| 199 |
+
|
| 200 |
+
new_idx = rw.AddAtom(Chem.Atom(n))
|
| 201 |
+
new_atom = rw.GetAtomWithIdx(new_idx)
|
| 202 |
+
|
| 203 |
+
if "charge" in action:
|
| 204 |
+
new_atom.SetFormalCharge(int(action["charge"]))
|
| 205 |
+
if "num_hs" in action and action["num_hs"] is not None:
|
| 206 |
+
new_atom.SetNumExplicitHs(int(action["num_hs"]))
|
| 207 |
+
|
| 208 |
+
_reset_atom_hs(rw.GetAtomWithIdx(anchor_idx))
|
| 209 |
+
|
| 210 |
+
rw.AddBond(anchor_idx, new_idx, bond_type)
|
| 211 |
+
_sanitize(rw, "AddAtom")
|
| 212 |
+
return rw
|
| 213 |
+
|
| 214 |
+
def _remove_atom(self, rw: Chem.RWMol, action: dict):
|
| 215 |
+
idx = self._resolve_atom(rw, action["atom"])
|
| 216 |
+
neighbors = [n.GetIdx() for n in rw.GetAtomWithIdx(idx).GetNeighbors()]
|
| 217 |
+
rw.RemoveAtom(idx)
|
| 218 |
+
for nidx in neighbors:
|
| 219 |
+
adj = nidx if nidx < idx else nidx - 1
|
| 220 |
+
if adj < rw.GetNumAtoms():
|
| 221 |
+
_reset_atom_hs(rw.GetAtomWithIdx(adj))
|
| 222 |
+
_sanitize(rw, "RemoveAtom")
|
| 223 |
+
return rw
|
| 224 |
+
|
| 225 |
+
def _change_bond(self, rw: Chem.RWMol, action: dict):
|
| 226 |
+
i1, i2, bond = self._resolve_bond(rw, action["bond"])
|
| 227 |
+
order = action["order"].upper()
|
| 228 |
+
bond_type = BOND_TYPE_MAP.get(order)
|
| 229 |
+
if bond_type is None:
|
| 230 |
+
raise ActionError(f"Unknown bond order: {order!r}")
|
| 231 |
+
bond.SetBondType(bond_type)
|
| 232 |
+
|
| 233 |
+
if "stereo" in action and action["stereo"]:
|
| 234 |
+
stereo = BOND_STEREO_MAP.get(action["stereo"].upper())
|
| 235 |
+
if stereo is not None:
|
| 236 |
+
bond.SetStereo(stereo)
|
| 237 |
+
|
| 238 |
+
for idx in (i1, i2):
|
| 239 |
+
_reset_atom_hs(rw.GetAtomWithIdx(idx))
|
| 240 |
+
_sanitize(rw, "ChangeBond")
|
| 241 |
+
return rw
|
| 242 |
+
|
| 243 |
+
def _add_bond(self, rw: Chem.RWMol, action: dict):
|
| 244 |
+
i1 = self._resolve_atom(rw, action["bond"]["atom1"])
|
| 245 |
+
i2 = self._resolve_atom(rw, action["bond"]["atom2"])
|
| 246 |
+
if rw.GetBondBetweenAtoms(i1, i2) is not None:
|
| 247 |
+
raise ActionError(f"Bond already exists between atoms {i1} and {i2}")
|
| 248 |
+
order = action.get("order", "SINGLE").upper()
|
| 249 |
+
bond_type = BOND_TYPE_MAP.get(order)
|
| 250 |
+
if bond_type is None:
|
| 251 |
+
raise ActionError(f"Unknown bond order: {order!r}")
|
| 252 |
+
rw.AddBond(i1, i2, bond_type)
|
| 253 |
+
for idx in (i1, i2):
|
| 254 |
+
_reset_atom_hs(rw.GetAtomWithIdx(idx))
|
| 255 |
+
_sanitize(rw, "AddBond")
|
| 256 |
+
return rw
|
| 257 |
+
|
| 258 |
+
def _remove_bond(self, rw: Chem.RWMol, action: dict):
|
| 259 |
+
i1, i2, _ = self._resolve_bond(rw, action["bond"])
|
| 260 |
+
rw.RemoveBond(i1, i2)
|
| 261 |
+
for idx in (i1, i2):
|
| 262 |
+
_reset_atom_hs(rw.GetAtomWithIdx(idx))
|
| 263 |
+
_sanitize(rw, "RemoveBond")
|
| 264 |
+
return rw
|
| 265 |
+
|
| 266 |
+
def _add_group(self, rw: Chem.RWMol, action: dict):
|
| 267 |
+
anchor = self._resolve_atom(rw, action["anchor"])
|
| 268 |
+
group = action["group"]
|
| 269 |
+
result = add_functional_group(rw, anchor_idx=anchor, group_name=group)
|
| 270 |
+
if result is None:
|
| 271 |
+
raise InvalidMolError(f"AddGroup failed: group={group!r} anchor={anchor}")
|
| 272 |
+
return Chem.RWMol(result)
|
| 273 |
+
|
| 274 |
+
def _remove_group(self, rw: Chem.RWMol, action: dict):
|
| 275 |
+
anchor = self._resolve_atom(rw, action["anchor"])
|
| 276 |
+
group = action["group"]
|
| 277 |
+
result, removed = remove_functional_group(rw, anchor_idx=anchor, group_name=group)
|
| 278 |
+
if result is None:
|
| 279 |
+
raise InvalidMolError(
|
| 280 |
+
f"RemoveGroup failed: group={group!r} not found at anchor={anchor}"
|
| 281 |
+
)
|
| 282 |
+
rw2 = Chem.RWMol(result)
|
| 283 |
+
_reset_atom_hs(rw2.GetAtomWithIdx(anchor))
|
| 284 |
+
_sanitize(rw2, "RemoveGroup")
|
| 285 |
+
return rw2
|
| 286 |
+
|
| 287 |
+
def _flip_chirality(self, rw: Chem.RWMol, action: dict):
|
| 288 |
+
idx = self._resolve_atom(rw, action["atom"])
|
| 289 |
+
atom = rw.GetAtomWithIdx(idx)
|
| 290 |
+
chi = atom.GetChiralTag()
|
| 291 |
+
if chi == Chem.ChiralType.CHI_TETRAHEDRAL_CW:
|
| 292 |
+
atom.SetChiralTag(Chem.ChiralType.CHI_TETRAHEDRAL_CCW)
|
| 293 |
+
elif chi == Chem.ChiralType.CHI_TETRAHEDRAL_CCW:
|
| 294 |
+
atom.SetChiralTag(Chem.ChiralType.CHI_TETRAHEDRAL_CW)
|
| 295 |
+
else:
|
| 296 |
+
raise ActionError(f"Atom idx={idx} has no specified chirality to flip")
|
| 297 |
+
_sanitize(rw, "FlipChirality")
|
| 298 |
+
return rw
|
| 299 |
+
|
| 300 |
+
def _flip_ez(self, smiles: str, action: dict) -> str:
|
| 301 |
+
"""
|
| 302 |
+
FlipEZ: invert E/Z at SMILES level.
|
| 303 |
+
If 'bond' is provided, validates it's a double bond first.
|
| 304 |
+
"""
|
| 305 |
+
mol = Chem.MolFromSmiles(smiles)
|
| 306 |
+
if mol is None:
|
| 307 |
+
raise InvalidMolError(f"Cannot parse SMILES: {smiles!r}")
|
| 308 |
+
|
| 309 |
+
if "bond" in action:
|
| 310 |
+
i1, i2, bond = self._resolve_bond(mol, action["bond"])
|
| 311 |
+
if bond.GetBondType() != Chem.BondType.DOUBLE:
|
| 312 |
+
raise ActionError(
|
| 313 |
+
f"FlipEZ: bond between atoms {i1} and {i2} is not a double bond"
|
| 314 |
+
)
|
| 315 |
+
|
| 316 |
+
smi = Chem.MolToSmiles(mol, isomericSmiles=True)
|
| 317 |
+
if "/" not in smi and "\\" not in smi:
|
| 318 |
+
raise ActionError("FlipEZ: SMILES has no E/Z notation to flip")
|
| 319 |
+
|
| 320 |
+
result = flip_ez(smi)
|
| 321 |
+
if result is None or result == smi:
|
| 322 |
+
raise ActionError("FlipEZ: flip produced no change or invalid molecule")
|
| 323 |
+
# Strip atom map numbers and return canonical form
|
| 324 |
+
mol_r = Chem.MolFromSmiles(result)
|
| 325 |
+
if mol_r is None:
|
| 326 |
+
raise InvalidMolError(f"FlipEZ produced invalid SMILES: {result!r}")
|
| 327 |
+
return _to_canonical(mol_r)
|
| 328 |
+
|
| 329 |
+
def _move_substituent(self, rw: Chem.RWMol, action: dict):
|
| 330 |
+
"""
|
| 331 |
+
Detach `substituent` from `from_atom` and reattach it to `to_atom`.
|
| 332 |
+
Works on aromatic rings by operating in Kekulé form.
|
| 333 |
+
"""
|
| 334 |
+
sub_idx = self._resolve_atom(rw, action["substituent"])
|
| 335 |
+
from_idx = self._resolve_atom(rw, action["from_atom"])
|
| 336 |
+
to_idx = self._resolve_atom(rw, action["to_atom"])
|
| 337 |
+
|
| 338 |
+
bond = rw.GetBondBetweenAtoms(from_idx, sub_idx)
|
| 339 |
+
if bond is None:
|
| 340 |
+
raise BondNotFoundError(
|
| 341 |
+
f"MoveSubstituent: no bond between from_atom={from_idx} and substituent={sub_idx}"
|
| 342 |
+
)
|
| 343 |
+
bond_type = bond.GetBondType()
|
| 344 |
+
# Use SINGLE for substituent attachment (aromatic bond → substituent is always single)
|
| 345 |
+
if bond_type == Chem.BondType.AROMATIC:
|
| 346 |
+
bond_type = Chem.BondType.SINGLE
|
| 347 |
+
|
| 348 |
+
if rw.GetBondBetweenAtoms(to_idx, sub_idx) is not None:
|
| 349 |
+
raise ActionError(
|
| 350 |
+
f"MoveSubstituent: bond already exists between to_atom={to_idx} and substituent={sub_idx}"
|
| 351 |
+
)
|
| 352 |
+
|
| 353 |
+
rw = _kekulize_rw(rw)
|
| 354 |
+
rw.RemoveBond(from_idx, sub_idx)
|
| 355 |
+
# Reset explicit Hs on both endpoints so valence is recomputed by sanitize
|
| 356 |
+
for i in (from_idx, to_idx):
|
| 357 |
+
_reset_atom_hs(rw.GetAtomWithIdx(i))
|
| 358 |
+
rw.AddBond(to_idx, sub_idx, bond_type)
|
| 359 |
+
_sanitize(rw, "MoveSubstituent")
|
| 360 |
+
return rw
|
| 361 |
+
|
| 362 |
+
def _swap_substituents(self, rw: Chem.RWMol, action: dict):
|
| 363 |
+
"""
|
| 364 |
+
Swap all non-ring substituents between two atoms (typically ring atoms).
|
| 365 |
+
Works on aromatic rings by operating in Kekulé form.
|
| 366 |
+
"""
|
| 367 |
+
idx1 = self._resolve_atom(rw, action["atom1"])
|
| 368 |
+
idx2 = self._resolve_atom(rw, action["atom2"])
|
| 369 |
+
|
| 370 |
+
if idx1 == idx2:
|
| 371 |
+
raise ActionError("SwapSubstituents: atom1 and atom2 are the same atom")
|
| 372 |
+
|
| 373 |
+
shared_ring_atoms = set()
|
| 374 |
+
for ring in _shared_rings(rw, idx1, idx2):
|
| 375 |
+
shared_ring_atoms.update(ring)
|
| 376 |
+
|
| 377 |
+
def get_substituents(center, other_center):
|
| 378 |
+
subs = []
|
| 379 |
+
for nb in rw.GetAtomWithIdx(center).GetNeighbors():
|
| 380 |
+
nidx = nb.GetIdx()
|
| 381 |
+
if nidx in shared_ring_atoms and nidx != other_center:
|
| 382 |
+
continue
|
| 383 |
+
if nidx == other_center:
|
| 384 |
+
continue
|
| 385 |
+
subs.append((nidx, rw.GetBondBetweenAtoms(center, nidx).GetBondType()))
|
| 386 |
+
return subs
|
| 387 |
+
|
| 388 |
+
subs1 = get_substituents(idx1, idx2)
|
| 389 |
+
subs2 = get_substituents(idx2, idx1)
|
| 390 |
+
|
| 391 |
+
rw = _kekulize_rw(rw)
|
| 392 |
+
|
| 393 |
+
for sub_idx, _ in subs1:
|
| 394 |
+
rw.RemoveBond(idx1, sub_idx)
|
| 395 |
+
for sub_idx, _ in subs2:
|
| 396 |
+
rw.RemoveBond(idx2, sub_idx)
|
| 397 |
+
|
| 398 |
+
# Reset explicit Hs on swap targets so valence is recomputed
|
| 399 |
+
for center in (idx1, idx2):
|
| 400 |
+
_reset_atom_hs(rw.GetAtomWithIdx(center))
|
| 401 |
+
|
| 402 |
+
for sub_idx, btype in subs1:
|
| 403 |
+
bt = Chem.BondType.SINGLE if btype == Chem.BondType.AROMATIC else btype
|
| 404 |
+
rw.AddBond(idx2, sub_idx, bt)
|
| 405 |
+
for sub_idx, btype in subs2:
|
| 406 |
+
bt = Chem.BondType.SINGLE if btype == Chem.BondType.AROMATIC else btype
|
| 407 |
+
rw.AddBond(idx1, sub_idx, bt)
|
| 408 |
+
|
| 409 |
+
_sanitize(rw, "SwapSubstituents")
|
| 410 |
+
return rw
|
| 411 |
+
|
| 412 |
+
# ── Dispatch ─────────────────────────────────────────────────────────────
|
| 413 |
+
|
| 414 |
+
_SMILES_LEVEL = {"FlipEZ", "Batch"}
|
| 415 |
+
|
| 416 |
+
def _dispatch(self, smiles: str, action: dict) -> str:
|
| 417 |
+
atype = action.get("type")
|
| 418 |
+
if not atype:
|
| 419 |
+
raise UnknownActionError("Action dict missing 'type' key")
|
| 420 |
+
|
| 421 |
+
# Batch: apply actions sequentially at SMILES level
|
| 422 |
+
if atype == "Batch":
|
| 423 |
+
for sub in action["actions"]:
|
| 424 |
+
smiles = self.execute(smiles, sub)
|
| 425 |
+
return smiles
|
| 426 |
+
|
| 427 |
+
# FlipEZ: SMILES-level operation
|
| 428 |
+
if atype == "FlipEZ":
|
| 429 |
+
return self._flip_ez(smiles, action)
|
| 430 |
+
|
| 431 |
+
# All other ops: work on RWMol
|
| 432 |
+
mol = Chem.MolFromSmiles(smiles)
|
| 433 |
+
if mol is None:
|
| 434 |
+
raise InvalidMolError(f"Cannot parse SMILES: {smiles!r}")
|
| 435 |
+
rw = Chem.RWMol(copy.deepcopy(mol))
|
| 436 |
+
|
| 437 |
+
handlers = {
|
| 438 |
+
"ChangeAtom": self._change_atom,
|
| 439 |
+
"AddAtom": self._add_atom,
|
| 440 |
+
"RemoveAtom": self._remove_atom,
|
| 441 |
+
"ChangeBond": self._change_bond,
|
| 442 |
+
"AddBond": self._add_bond,
|
| 443 |
+
"RemoveBond": self._remove_bond,
|
| 444 |
+
"AddGroup": self._add_group,
|
| 445 |
+
"RemoveGroup": self._remove_group,
|
| 446 |
+
"FlipChirality": self._flip_chirality,
|
| 447 |
+
"MoveSubstituent": self._move_substituent,
|
| 448 |
+
"SwapSubstituents": self._swap_substituents,
|
| 449 |
+
}
|
| 450 |
+
|
| 451 |
+
handler = handlers.get(atype)
|
| 452 |
+
if handler is None:
|
| 453 |
+
raise UnknownActionError(
|
| 454 |
+
f"Unknown action type: {atype!r}. "
|
| 455 |
+
f"Valid types: {sorted(handlers) + ['FlipEZ', 'Batch']}"
|
| 456 |
+
)
|
| 457 |
+
|
| 458 |
+
result_rw = handler(rw, action)
|
| 459 |
+
return _to_canonical(result_rw)
|
| 460 |
+
|
| 461 |
+
# ── Public API ────────────────────────────────────────────────────────────
|
| 462 |
+
|
| 463 |
+
def execute(self, smiles: str, action: dict) -> str:
|
| 464 |
+
"""
|
| 465 |
+
Apply a single Action to smiles.
|
| 466 |
+
|
| 467 |
+
Args:
|
| 468 |
+
smiles: input SMILES string (with or without atom map numbers)
|
| 469 |
+
action: Action dict with 'type' key and type-specific fields
|
| 470 |
+
|
| 471 |
+
Returns:
|
| 472 |
+
Canonical SMILES after applying the action.
|
| 473 |
+
|
| 474 |
+
Raises:
|
| 475 |
+
AtomNotFoundError, BondNotFoundError, InvalidMolError, UnknownActionError
|
| 476 |
+
"""
|
| 477 |
+
return self._dispatch(smiles, action)
|
| 478 |
+
|
| 479 |
+
def execute_batch(self, smiles: str, actions: list) -> str:
|
| 480 |
+
"""
|
| 481 |
+
Apply a list of Actions sequentially.
|
| 482 |
+
|
| 483 |
+
Equivalent to: execute(smiles, {"type": "Batch", "actions": actions})
|
| 484 |
+
"""
|
| 485 |
+
return self._dispatch(smiles, {"type": "Batch", "actions": actions})
|
| 486 |
+
|
| 487 |
+
|
| 488 |
+
# ---------------------------------------------------------------------------
|
| 489 |
+
# Inline tests
|
| 490 |
+
# ---------------------------------------------------------------------------
|
| 491 |
+
|
| 492 |
+
if __name__ == "__main__":
|
| 493 |
+
ex = ActionExecutor()
|
| 494 |
+
passed = failed = 0
|
| 495 |
+
|
| 496 |
+
def test(name, smiles, action, expected):
|
| 497 |
+
global passed, failed
|
| 498 |
+
try:
|
| 499 |
+
result = ex.execute(smiles, action)
|
| 500 |
+
exp_canon = Chem.MolToSmiles(Chem.MolFromSmiles(expected))
|
| 501 |
+
if result == exp_canon:
|
| 502 |
+
print(f" PASS {name}")
|
| 503 |
+
passed += 1
|
| 504 |
+
else:
|
| 505 |
+
print(f" FAIL {name}")
|
| 506 |
+
print(f" input: {smiles}")
|
| 507 |
+
print(f" expected: {exp_canon}")
|
| 508 |
+
print(f" got: {result}")
|
| 509 |
+
failed += 1
|
| 510 |
+
except Exception as e:
|
| 511 |
+
print(f" ERROR {name}: {e}")
|
| 512 |
+
failed += 1
|
| 513 |
+
|
| 514 |
+
print("=" * 60)
|
| 515 |
+
print("ActionExecutor — inline tests")
|
| 516 |
+
print("=" * 60)
|
| 517 |
+
|
| 518 |
+
# 1. ChangeAtom — element
|
| 519 |
+
test("ChangeAtom/element",
|
| 520 |
+
"CCCO",
|
| 521 |
+
{"type": "ChangeAtom", "atom": {"idx": 2}, "element": "N"},
|
| 522 |
+
"CCNO")
|
| 523 |
+
|
| 524 |
+
# 2. ChangeAtom — charge
|
| 525 |
+
test("ChangeAtom/charge",
|
| 526 |
+
"CC(=O)[O-]",
|
| 527 |
+
{"type": "ChangeAtom", "atom": {"smarts": "[O-]"}, "charge": 0},
|
| 528 |
+
"CC([O])=O") # canonical RDKit form of acetic acid
|
| 529 |
+
|
| 530 |
+
# 3. AddAtom — via idx
|
| 531 |
+
try:
|
| 532 |
+
r = ex.execute("CCO", {"type": "AddAtom", "anchor": {"idx": 1}, "element": "C"})
|
| 533 |
+
assert Chem.MolFromSmiles(r) is not None
|
| 534 |
+
print(" PASS AddAtom")
|
| 535 |
+
passed += 1
|
| 536 |
+
except Exception as e:
|
| 537 |
+
print(f" FAIL AddAtom: {e}")
|
| 538 |
+
failed += 1
|
| 539 |
+
|
| 540 |
+
# 4. RemoveAtom — via smarts
|
| 541 |
+
test("RemoveAtom",
|
| 542 |
+
"CCO",
|
| 543 |
+
{"type": "RemoveAtom", "atom": {"smarts": "[OH]"}},
|
| 544 |
+
"CC")
|
| 545 |
+
|
| 546 |
+
# 5. ChangeBond — DOUBLE→SINGLE (C=O → C-O in acetaldehyde)
|
| 547 |
+
test("ChangeBond",
|
| 548 |
+
"CC=O",
|
| 549 |
+
{"type": "ChangeBond",
|
| 550 |
+
"bond": {"atom1": {"idx": 1}, "atom2": {"idx": 2}},
|
| 551 |
+
"order": "SINGLE"},
|
| 552 |
+
"CCO")
|
| 553 |
+
|
| 554 |
+
# 6. AddBond
|
| 555 |
+
test("AddBond",
|
| 556 |
+
"CCCC",
|
| 557 |
+
{"type": "AddBond",
|
| 558 |
+
"bond": {"atom1": {"idx": 0}, "atom2": {"idx": 3}},
|
| 559 |
+
"order": "SINGLE"},
|
| 560 |
+
"C1CCC1")
|
| 561 |
+
|
| 562 |
+
# 7. RemoveBond
|
| 563 |
+
test("RemoveBond",
|
| 564 |
+
"C1CCC1",
|
| 565 |
+
{"type": "RemoveBond",
|
| 566 |
+
"bond": {"atom1": {"smarts": "[CH2]", "match_idx": 0},
|
| 567 |
+
"atom2": {"smarts": "[CH2]", "match_idx": 3}}},
|
| 568 |
+
"CCCC")
|
| 569 |
+
|
| 570 |
+
# 8. AddGroup
|
| 571 |
+
test("AddGroup",
|
| 572 |
+
"c1ccccc1",
|
| 573 |
+
{"type": "AddGroup", "anchor": {"idx": 0}, "group": "OH"},
|
| 574 |
+
"Oc1ccccc1")
|
| 575 |
+
|
| 576 |
+
# 9. RemoveGroup
|
| 577 |
+
test("RemoveGroup",
|
| 578 |
+
"Oc1ccccc1",
|
| 579 |
+
{"type": "RemoveGroup", "anchor": {"smarts": "[c;r6]", "match_idx": 0}, "group": "OH"},
|
| 580 |
+
"c1ccccc1")
|
| 581 |
+
|
| 582 |
+
# 10. FlipChirality — via smarts
|
| 583 |
+
test("FlipChirality",
|
| 584 |
+
"C[C@@H](O)F",
|
| 585 |
+
{"type": "FlipChirality", "atom": {"smarts": "[C@@H]"}},
|
| 586 |
+
"C[C@H](O)F")
|
| 587 |
+
|
| 588 |
+
# 11. FlipEZ
|
| 589 |
+
test("FlipEZ",
|
| 590 |
+
"C/C=C/C",
|
| 591 |
+
{"type": "FlipEZ",
|
| 592 |
+
"bond": {"atom1": {"idx": 1}, "atom2": {"idx": 2}}},
|
| 593 |
+
"C/C=C\\C")
|
| 594 |
+
|
| 595 |
+
# 12. MoveSubstituent — move Cl from position 1 to position 3 on pyridine
|
| 596 |
+
# pyridine with Cl at C2: Clc1ccccn1 → move Cl to C4: c1cc(Cl)ccn1
|
| 597 |
+
test("MoveSubstituent",
|
| 598 |
+
"Clc1ccccn1",
|
| 599 |
+
{"type": "MoveSubstituent",
|
| 600 |
+
"substituent": {"smarts": "[Cl]"},
|
| 601 |
+
"from_atom": {"smarts": "[c;r6]", "match_idx": 0},
|
| 602 |
+
"to_atom": {"smarts": "[c;r6]", "match_idx": 2}},
|
| 603 |
+
"c1cc(Cl)ccn1")
|
| 604 |
+
|
| 605 |
+
# 13. SwapSubstituents — on o-chlorotoluene, swap Cl and CH3
|
| 606 |
+
# Cc1ccccc1Cl → Clc1ccccc1C (same thing, test canonical form)
|
| 607 |
+
try:
|
| 608 |
+
mol_in = Chem.MolFromSmiles("Cc1ccccc1Cl")
|
| 609 |
+
# assign map nums for stable ref
|
| 610 |
+
rw = Chem.RWMol(mol_in)
|
| 611 |
+
for a in rw.GetAtoms():
|
| 612 |
+
a.SetAtomMapNum(a.GetIdx() + 1)
|
| 613 |
+
mapped = Chem.MolToSmiles(rw)
|
| 614 |
+
|
| 615 |
+
# find the two substituted ring carbons
|
| 616 |
+
c_idx = next(a.GetIdx() for a in rw.GetAtoms()
|
| 617 |
+
if a.GetAtomicNum() == 6 and not a.GetIsAromatic()
|
| 618 |
+
and any(nb.GetIsAromatic() for nb in a.GetNeighbors()))
|
| 619 |
+
cl_nb = next(a for a in rw.GetAtoms() if a.GetAtomicNum() == 17)
|
| 620 |
+
cl_ring = next(nb.GetIdx() for nb in cl_nb.GetNeighbors())
|
| 621 |
+
ch3_ring = next(nb.GetIdx() for nb in rw.GetAtomWithIdx(c_idx).GetNeighbors()
|
| 622 |
+
if nb.GetIsAromatic())
|
| 623 |
+
|
| 624 |
+
r = ex.execute(mapped, {
|
| 625 |
+
"type": "SwapSubstituents",
|
| 626 |
+
"atom1": {"map_num": ch3_ring + 1},
|
| 627 |
+
"atom2": {"map_num": cl_ring + 1},
|
| 628 |
+
})
|
| 629 |
+
mol_r = Chem.MolFromSmiles(r)
|
| 630 |
+
assert mol_r is not None
|
| 631 |
+
print(f" PASS SwapSubstituents ({Chem.MolToSmiles(mol_in)} → {r})")
|
| 632 |
+
passed += 1
|
| 633 |
+
except Exception as e:
|
| 634 |
+
print(f" FAIL SwapSubstituents: {e}")
|
| 635 |
+
failed += 1
|
| 636 |
+
|
| 637 |
+
# 14. Batch — two actions
|
| 638 |
+
test("Batch",
|
| 639 |
+
"CCO",
|
| 640 |
+
{"type": "Batch", "actions": [
|
| 641 |
+
{"type": "ChangeAtom", "atom": {"idx": 2}, "element": "N"},
|
| 642 |
+
{"type": "AddGroup", "anchor": {"idx": 2}, "group": "CH3"},
|
| 643 |
+
]},
|
| 644 |
+
"CCN(C)")
|
| 645 |
+
|
| 646 |
+
# 15. map_num AtomRef (with pre-mapped SMILES)
|
| 647 |
+
test("AtomRef/map_num",
|
| 648 |
+
"[CH3:1][CH2:2][OH:3]",
|
| 649 |
+
{"type": "ChangeAtom", "atom": {"map_num": 3}, "element": "N"},
|
| 650 |
+
"CCN")
|
| 651 |
+
|
| 652 |
+
print("=" * 60)
|
| 653 |
+
print(f"Results: {passed} passed, {failed} failed out of {passed+failed} tests")
|
| 654 |
+
print("=" * 60)
|
code/benchmark_eval.py
ADDED
|
@@ -0,0 +1,400 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
Sends (wrong_smiles_mapped + correct_image) to a vision LLM, asks it to predict
|
| 5 |
+
the correction action in ActionExecutor JSON format, then verifies execution.
|
| 6 |
+
|
| 7 |
+
Usage:
|
| 8 |
+
# Dry run — prints prompt for first sample, no API call
|
| 9 |
+
python benchmark_eval.py --dataset ./data/pubchem_dataset --dry_run
|
| 10 |
+
|
| 11 |
+
# Real run
|
| 12 |
+
python benchmark_eval.py \\
|
| 13 |
+
--dataset ./data/pubchem_dataset \\
|
| 14 |
+
--model gpt-4o \\
|
| 15 |
+
--api_key sk-... \\
|
| 16 |
+
--api_base https://api.openai.com/v1 \\
|
| 17 |
+
--out ./data/pubchem_dataset/benchmark_results.json \\
|
| 18 |
+
--n 20
|
| 19 |
+
|
| 20 |
+
# Filter to one op type
|
| 21 |
+
python benchmark_eval.py ... --op change_atom_element
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
import os, sys, json, re, time, base64, argparse, random, threading
|
| 25 |
+
from collections import defaultdict
|
| 26 |
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
| 27 |
+
sys.path.insert(0, os.path.dirname(__file__))
|
| 28 |
+
|
| 29 |
+
from rdkit import Chem, RDLogger
|
| 30 |
+
RDLogger.DisableLog("rdApp.*")
|
| 31 |
+
|
| 32 |
+
from action_executor import ActionExecutor, ActionError
|
| 33 |
+
|
| 34 |
+
# ---------------------------------------------------------------------------
|
| 35 |
+
# Op type name mapping: dataset format → ActionExecutor type
|
| 36 |
+
# ---------------------------------------------------------------------------
|
| 37 |
+
|
| 38 |
+
OLD_TO_NEW_TYPE = {
|
| 39 |
+
"change_atom_element": "ChangeAtom",
|
| 40 |
+
"change_charge": "ChangeAtom",
|
| 41 |
+
"add_atom": "AddAtom",
|
| 42 |
+
"remove_atom": "RemoveAtom",
|
| 43 |
+
"change_bond_order": "ChangeBond",
|
| 44 |
+
"add_bond": "AddBond",
|
| 45 |
+
"remove_bond": "RemoveBond",
|
| 46 |
+
"add_functional_group": "AddGroup",
|
| 47 |
+
"remove_functional_group": "RemoveGroup",
|
| 48 |
+
"flip_chirality": "FlipChirality",
|
| 49 |
+
"flip_ez": "FlipEZ",
|
| 50 |
+
"move_substituent": "MoveSubstituent",
|
| 51 |
+
"swap_substituents": "SwapSubstituents",
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
# ---------------------------------------------------------------------------
|
| 55 |
+
# System prompt
|
| 56 |
+
# ---------------------------------------------------------------------------
|
| 57 |
+
|
| 58 |
+
SYSTEM_PROMPT = """You are a molecular structure correction assistant.
|
| 59 |
+
|
| 60 |
+
You will be shown:
|
| 61 |
+
1. An image of the CORRECT molecule
|
| 62 |
+
2. A SMILES string with atom map numbers (:[n] tags) representing the WRONG molecule
|
| 63 |
+
|
| 64 |
+
Your task: identify what is wrong and output a single JSON action that corrects the wrong SMILES to match the image.
|
| 65 |
+
|
| 66 |
+
## Action types and schemas
|
| 67 |
+
|
| 68 |
+
ChangeAtom: {"type": "ChangeAtom", "atom": AtomRef, "element": str, "charge": int}
|
| 69 |
+
AddAtom: {"type": "AddAtom", "anchor": AtomRef, "element": str, "bond_order": str}
|
| 70 |
+
RemoveAtom: {"type": "RemoveAtom", "atom": AtomRef}
|
| 71 |
+
ChangeBond: {"type": "ChangeBond", "bond": BondRef, "order": str}
|
| 72 |
+
AddBond: {"type": "AddBond", "bond": BondRef, "order": str}
|
| 73 |
+
RemoveBond: {"type": "RemoveBond", "bond": BondRef}
|
| 74 |
+
AddGroup: {"type": "AddGroup", "anchor": AtomRef, "group": str}
|
| 75 |
+
RemoveGroup: {"type": "RemoveGroup", "anchor": AtomRef, "group": str}
|
| 76 |
+
FlipChirality: {"type": "FlipChirality", "atom": AtomRef}
|
| 77 |
+
FlipEZ: {"type": "FlipEZ"}
|
| 78 |
+
MoveSubstituent: {"type": "MoveSubstituent", "substituent": AtomRef, "from_atom": AtomRef, "to_atom": AtomRef}
|
| 79 |
+
SwapSubstituents: {"type": "SwapSubstituents", "atom1": AtomRef, "atom2": AtomRef}
|
| 80 |
+
|
| 81 |
+
## AtomRef and BondRef
|
| 82 |
+
|
| 83 |
+
AtomRef: {"map_num": <integer>} ← the number after : in the SMILES, e.g. :5 → map_num 5
|
| 84 |
+
BondRef: {"atom1": AtomRef, "atom2": AtomRef}
|
| 85 |
+
|
| 86 |
+
## Valid values
|
| 87 |
+
|
| 88 |
+
bond_order: "SINGLE" | "DOUBLE" | "TRIPLE"
|
| 89 |
+
group: "OH" | "NH2" | "F" | "Cl" | "Br" | "CH3" | "COOH" | "CHO" | "NO2"
|
| 90 |
+
element: standard element symbol, e.g. "C", "N", "O", "S", "F", "Cl", "Br"
|
| 91 |
+
|
| 92 |
+
## Output format
|
| 93 |
+
|
| 94 |
+
Output ONLY a valid JSON object with no additional text or explanation.
|
| 95 |
+
Example: {"type": "ChangeAtom", "atom": {"map_num": 3}, "element": "N"}
|
| 96 |
+
"""
|
| 97 |
+
|
| 98 |
+
# ---------------------------------------------------------------------------
|
| 99 |
+
# Helpers
|
| 100 |
+
# ---------------------------------------------------------------------------
|
| 101 |
+
|
| 102 |
+
def _img_to_b64(path):
|
| 103 |
+
with open(path, "rb") as f:
|
| 104 |
+
return base64.b64encode(f.read()).decode()
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def _extract_json(raw: str):
|
| 108 |
+
"""Parse JSON from LLM output, handling markdown fences."""
|
| 109 |
+
raw = raw.strip()
|
| 110 |
+
# Try direct parse first
|
| 111 |
+
try:
|
| 112 |
+
return json.loads(raw)
|
| 113 |
+
except json.JSONDecodeError:
|
| 114 |
+
pass
|
| 115 |
+
# Strip markdown fences
|
| 116 |
+
m = re.search(r"```(?:json)?\s*(\{.*?\})\s*```", raw, re.DOTALL)
|
| 117 |
+
if m:
|
| 118 |
+
try:
|
| 119 |
+
return json.loads(m.group(1))
|
| 120 |
+
except json.JSONDecodeError:
|
| 121 |
+
pass
|
| 122 |
+
# Find first {...} block
|
| 123 |
+
m = re.search(r"\{.*\}", raw, re.DOTALL)
|
| 124 |
+
if m:
|
| 125 |
+
try:
|
| 126 |
+
return json.loads(m.group(0))
|
| 127 |
+
except json.JSONDecodeError:
|
| 128 |
+
pass
|
| 129 |
+
return None
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
def _canon(smiles):
|
| 133 |
+
if smiles is None:
|
| 134 |
+
return None
|
| 135 |
+
mol = Chem.MolFromSmiles(smiles)
|
| 136 |
+
return Chem.MolToSmiles(mol) if mol else None
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
# ---------------------------------------------------------------------------
|
| 140 |
+
# BenchmarkEvaluator
|
| 141 |
+
# ---------------------------------------------------------------------------
|
| 142 |
+
|
| 143 |
+
class BenchmarkEvaluator:
|
| 144 |
+
def __init__(self, model, api_key, api_base, dataset_dir, delay=0.5, workers=4):
|
| 145 |
+
self.model = model
|
| 146 |
+
self.dataset_dir = dataset_dir
|
| 147 |
+
self.delay = delay
|
| 148 |
+
self.workers = workers
|
| 149 |
+
self.executor = ActionExecutor()
|
| 150 |
+
self._lock = threading.Lock()
|
| 151 |
+
|
| 152 |
+
if api_key and model:
|
| 153 |
+
import openai
|
| 154 |
+
self.client = openai.OpenAI(api_key=api_key, base_url=api_base)
|
| 155 |
+
else:
|
| 156 |
+
self.client = None
|
| 157 |
+
|
| 158 |
+
# ── Data loading ─────────────────────────────────────────────────────────
|
| 159 |
+
|
| 160 |
+
def _load_dataset(self, n=None, op_filter=None, seed=0):
|
| 161 |
+
for fname in ("dataset.json", "roundtrip_test.json"):
|
| 162 |
+
p = os.path.join(self.dataset_dir, fname)
|
| 163 |
+
if os.path.exists(p):
|
| 164 |
+
with open(p) as f:
|
| 165 |
+
records = json.load(f)
|
| 166 |
+
break
|
| 167 |
+
else:
|
| 168 |
+
raise FileNotFoundError(f"No dataset JSON in {self.dataset_dir}")
|
| 169 |
+
|
| 170 |
+
if op_filter:
|
| 171 |
+
records = [r for r in records if r["operation"]["type"] == op_filter]
|
| 172 |
+
|
| 173 |
+
if n and n < len(records):
|
| 174 |
+
random.seed(seed)
|
| 175 |
+
records = random.sample(records, n)
|
| 176 |
+
|
| 177 |
+
return records
|
| 178 |
+
|
| 179 |
+
# ── LLM call ─────────────────────────────────────────────────────────────
|
| 180 |
+
|
| 181 |
+
def _call_llm(self, record):
|
| 182 |
+
img_path = os.path.join(self.dataset_dir, record["image_path"])
|
| 183 |
+
b64 = _img_to_b64(img_path)
|
| 184 |
+
|
| 185 |
+
messages = [
|
| 186 |
+
{"role": "system", "content": SYSTEM_PROMPT},
|
| 187 |
+
{
|
| 188 |
+
"role": "user",
|
| 189 |
+
"content": [
|
| 190 |
+
{
|
| 191 |
+
"type": "text",
|
| 192 |
+
"text": f"Wrong SMILES (with atom map numbers): {record['wrong_smiles_mapped']}\n\nThe image below shows the CORRECT molecule. Output the JSON action to fix the wrong SMILES.",
|
| 193 |
+
},
|
| 194 |
+
{
|
| 195 |
+
"type": "image_url",
|
| 196 |
+
"image_url": {"url": f"data:image/png;base64,{b64}"},
|
| 197 |
+
},
|
| 198 |
+
],
|
| 199 |
+
},
|
| 200 |
+
]
|
| 201 |
+
|
| 202 |
+
resp = self.client.chat.completions.create(
|
| 203 |
+
model=self.model,
|
| 204 |
+
messages=messages,
|
| 205 |
+
max_tokens=4096,
|
| 206 |
+
temperature=0,
|
| 207 |
+
)
|
| 208 |
+
return resp.choices[0].message.content
|
| 209 |
+
|
| 210 |
+
# ── Evaluate one record ───────────────────────────────────────────────────
|
| 211 |
+
|
| 212 |
+
def _evaluate_one(self, record, raw_output):
|
| 213 |
+
op_type = record["operation"]["type"]
|
| 214 |
+
gt_ae_type = OLD_TO_NEW_TYPE.get(op_type, op_type)
|
| 215 |
+
result = {
|
| 216 |
+
"id": record.get("id"),
|
| 217 |
+
"op_type": op_type,
|
| 218 |
+
"image_path": record.get("image_path"),
|
| 219 |
+
"wrong_smiles_mapped": record["wrong_smiles_mapped"],
|
| 220 |
+
"correct_smiles": record["correct_smiles"],
|
| 221 |
+
"predicted_raw": raw_output,
|
| 222 |
+
"predicted_action": None,
|
| 223 |
+
"restored_smiles": None,
|
| 224 |
+
"exec_match": False,
|
| 225 |
+
"type_match": False,
|
| 226 |
+
"parse_error": False,
|
| 227 |
+
"exec_error": None,
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
# 1. Parse
|
| 231 |
+
action = _extract_json(raw_output)
|
| 232 |
+
if action is None:
|
| 233 |
+
result["parse_error"] = True
|
| 234 |
+
return result
|
| 235 |
+
result["predicted_action"] = action
|
| 236 |
+
|
| 237 |
+
# 2. Type match
|
| 238 |
+
result["type_match"] = (action.get("type") == gt_ae_type)
|
| 239 |
+
|
| 240 |
+
# 3. Execute
|
| 241 |
+
try:
|
| 242 |
+
restored = self.executor.execute(record["wrong_smiles_mapped"], action)
|
| 243 |
+
result["restored_smiles"] = restored
|
| 244 |
+
except ActionError as e:
|
| 245 |
+
result["exec_error"] = str(e)
|
| 246 |
+
return result
|
| 247 |
+
except Exception as e:
|
| 248 |
+
result["exec_error"] = f"unexpected: {e}"
|
| 249 |
+
return result
|
| 250 |
+
|
| 251 |
+
# 4. Compare (canonical)
|
| 252 |
+
result["exec_match"] = (_canon(restored) == _canon(record["correct_smiles"]))
|
| 253 |
+
return result
|
| 254 |
+
|
| 255 |
+
# ── Report ────────────────────────────────────────────────────────────────
|
| 256 |
+
|
| 257 |
+
def _report(self, results, out_path=None):
|
| 258 |
+
by_op = defaultdict(list)
|
| 259 |
+
for r in results:
|
| 260 |
+
by_op[r["op_type"]].append(r)
|
| 261 |
+
|
| 262 |
+
total = len(results)
|
| 263 |
+
total_exec = sum(1 for r in results if r["exec_match"])
|
| 264 |
+
total_type = sum(1 for r in results if r["type_match"])
|
| 265 |
+
total_parse = sum(1 for r in results if r["parse_error"])
|
| 266 |
+
total_err = sum(1 for r in results if r["exec_error"])
|
| 267 |
+
|
| 268 |
+
w = 78
|
| 269 |
+
print("=" * w)
|
| 270 |
+
print(f" Model: {self.model or 'dry_run'} N={total}")
|
| 271 |
+
print("=" * w)
|
| 272 |
+
print(f"{'Op Type':<32} {'N':>4} {'ExecMatch':>10} {'TypeMatch':>10} {'ParseErr':>8} {'ExecErr':>7}")
|
| 273 |
+
print("-" * w)
|
| 274 |
+
|
| 275 |
+
for op in sorted(by_op):
|
| 276 |
+
recs = by_op[op]
|
| 277 |
+
n = len(recs)
|
| 278 |
+
em = sum(1 for r in recs if r["exec_match"])
|
| 279 |
+
tm = sum(1 for r in recs if r["type_match"])
|
| 280 |
+
pe = sum(1 for r in recs if r["parse_error"])
|
| 281 |
+
ee = sum(1 for r in recs if r["exec_error"])
|
| 282 |
+
mark = "" if em == n else " ✗"
|
| 283 |
+
print(f"{op:<32} {n:>4} {em:>4}/{n:<4}{em/n*100:>4.0f}% "
|
| 284 |
+
f"{tm:>4}/{n:<4}{tm/n*100:>4.0f}% {pe:>8} {ee:>7}{mark}")
|
| 285 |
+
|
| 286 |
+
print("-" * w)
|
| 287 |
+
print(f"{'TOTAL':<32} {total:>4} {total_exec:>4}/{total:<4}{total_exec/total*100:>4.0f}% "
|
| 288 |
+
f"{total_type:>4}/{total:<4}{total_type/total*100:>4.0f}% "
|
| 289 |
+
f"{total_parse:>8} {total_err:>7}")
|
| 290 |
+
print("=" * w)
|
| 291 |
+
if out_path:
|
| 292 |
+
print(f"Results → {out_path}")
|
| 293 |
+
|
| 294 |
+
# ── Main evaluate loop ────────────────────────────────────────────────────
|
| 295 |
+
|
| 296 |
+
def evaluate(self, n=None, op_filter=None, out_path=None, seed=0):
|
| 297 |
+
records = self._load_dataset(n=n, op_filter=op_filter, seed=seed)
|
| 298 |
+
print(f"Loaded {len(records)} records from {self.dataset_dir}")
|
| 299 |
+
|
| 300 |
+
# Resume: load existing results
|
| 301 |
+
done_ids = set()
|
| 302 |
+
results = []
|
| 303 |
+
if out_path and os.path.exists(out_path):
|
| 304 |
+
with open(out_path) as f:
|
| 305 |
+
results = json.load(f)
|
| 306 |
+
done_ids = {r["id"] for r in results}
|
| 307 |
+
print(f"Resuming: {len(done_ids)} already evaluated")
|
| 308 |
+
|
| 309 |
+
todo = [r for r in records if r.get("id") not in done_ids]
|
| 310 |
+
total = len(records)
|
| 311 |
+
|
| 312 |
+
def _process(record):
|
| 313 |
+
raw = self._call_llm(record)
|
| 314 |
+
if self.delay > 0:
|
| 315 |
+
time.sleep(self.delay)
|
| 316 |
+
return self._evaluate_one(record, raw)
|
| 317 |
+
|
| 318 |
+
completed = len(done_ids)
|
| 319 |
+
with ThreadPoolExecutor(max_workers=self.workers) as pool:
|
| 320 |
+
futures = {pool.submit(_process, r): r for r in todo}
|
| 321 |
+
for fut in as_completed(futures):
|
| 322 |
+
result = fut.result()
|
| 323 |
+
status = "✓" if result["exec_match"] else ("?" if result["parse_error"] else "✗")
|
| 324 |
+
with self._lock:
|
| 325 |
+
results.append(result)
|
| 326 |
+
completed += 1
|
| 327 |
+
print(f" [{completed}/{total}] id={result['id']} op={result['op_type']} {status}", flush=True)
|
| 328 |
+
if out_path:
|
| 329 |
+
with open(out_path, "w") as f:
|
| 330 |
+
json.dump(results, f, indent=2)
|
| 331 |
+
|
| 332 |
+
self._report(results, out_path)
|
| 333 |
+
return results
|
| 334 |
+
|
| 335 |
+
def dry_run(self, op_filter=None):
|
| 336 |
+
"""Print the prompt for the first matching record, no API call."""
|
| 337 |
+
records = self._load_dataset(n=None, op_filter=op_filter)
|
| 338 |
+
if not records:
|
| 339 |
+
print("No records found.")
|
| 340 |
+
return
|
| 341 |
+
r = records[0]
|
| 342 |
+
img_path = os.path.join(self.dataset_dir, r["image_path"])
|
| 343 |
+
print("=" * 60)
|
| 344 |
+
print("SYSTEM PROMPT:")
|
| 345 |
+
print("=" * 60)
|
| 346 |
+
print(SYSTEM_PROMPT)
|
| 347 |
+
print("=" * 60)
|
| 348 |
+
print("USER MESSAGE:")
|
| 349 |
+
print("=" * 60)
|
| 350 |
+
print(f"Wrong SMILES (mapped): {r['wrong_smiles_mapped']}")
|
| 351 |
+
print(f"[image: {img_path} ({os.path.getsize(img_path)//1024} KB)]")
|
| 352 |
+
print()
|
| 353 |
+
print(f"GT operation: {r['operation']}")
|
| 354 |
+
print(f"GT correct: {r['correct_smiles']}")
|
| 355 |
+
print("=" * 60)
|
| 356 |
+
print("Image exists:", os.path.exists(img_path))
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
# ---------------------------------------------------------------------------
|
| 360 |
+
# CLI
|
| 361 |
+
# ---------------------------------------------------------------------------
|
| 362 |
+
|
| 363 |
+
def main():
|
| 364 |
+
parser = argparse.ArgumentParser(description="MolEdit benchmark evaluator")
|
| 365 |
+
parser.add_argument("--dataset", default="./data/pubchem_dataset")
|
| 366 |
+
parser.add_argument("--model", default=None, help="e.g. gpt-4o")
|
| 367 |
+
parser.add_argument("--api_base", default="https://api.openai.com/v1")
|
| 368 |
+
parser.add_argument("--out", default=None, help="Output JSON path")
|
| 369 |
+
parser.add_argument("--n", type=int, default=None, help="Sample size")
|
| 370 |
+
parser.add_argument("--op", default=None, help="Filter to one op type")
|
| 371 |
+
parser.add_argument("--delay", type=float, default=0.5, help="Seconds between API calls")
|
| 372 |
+
parser.add_argument("--workers", type=int, default=4, help="Concurrent API workers")
|
| 373 |
+
parser.add_argument("--seed", type=int, default=0)
|
| 374 |
+
parser.add_argument("--dry_run", action="store_true", help="Print prompt, no API call")
|
| 375 |
+
args = parser.parse_args()
|
| 376 |
+
|
| 377 |
+
api_key = os.environ.get("OPENAI_API_KEY")
|
| 378 |
+
|
| 379 |
+
ev = BenchmarkEvaluator(
|
| 380 |
+
model=args.model,
|
| 381 |
+
api_key=api_key,
|
| 382 |
+
api_base=args.api_base,
|
| 383 |
+
dataset_dir=args.dataset,
|
| 384 |
+
delay=args.delay,
|
| 385 |
+
workers=args.workers,
|
| 386 |
+
)
|
| 387 |
+
|
| 388 |
+
if args.dry_run:
|
| 389 |
+
ev.dry_run(op_filter=args.op)
|
| 390 |
+
return
|
| 391 |
+
|
| 392 |
+
if not args.model or not api_key:
|
| 393 |
+
parser.error("--model is required and OPENAI_API_KEY env var must be set (or use --dry_run)")
|
| 394 |
+
|
| 395 |
+
out = args.out or os.path.join(args.dataset, "benchmark_results.json")
|
| 396 |
+
ev.evaluate(n=args.n, op_filter=args.op, out_path=out, seed=args.seed)
|
| 397 |
+
|
| 398 |
+
|
| 399 |
+
if __name__ == "__main__":
|
| 400 |
+
main()
|
code/build_dataset_v2.py
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Build MolEdit dataset v2 — balanced, 20 samples per op type (13 types = 260 total).
|
| 3 |
+
|
| 4 |
+
Changes from v1:
|
| 5 |
+
- target_per_op is a fixed CLI arg (default 20), not derived from n_samples
|
| 6 |
+
- Uses a much larger candidate pool to handle rare op types
|
| 7 |
+
- Multi-pass: exhausts full pool before giving up on any op type
|
| 8 |
+
- Saves to a new output directory (default: ./data/pubchem_dataset_v2)
|
| 9 |
+
|
| 10 |
+
Usage:
|
| 11 |
+
python build_dataset_v2.py \
|
| 12 |
+
--input /home/dataset-assist-0/usr/lh/mzm/data/pubchem/CID-SMILES.gz.1 \
|
| 13 |
+
--output ./data/pubchem_dataset_v2 \
|
| 14 |
+
--target_per_op 20 \
|
| 15 |
+
--pool 20000 \
|
| 16 |
+
--seed 42
|
| 17 |
+
"""
|
| 18 |
+
|
| 19 |
+
import os, sys, json, random, argparse, subprocess, signal
|
| 20 |
+
sys.path.insert(0, os.path.dirname(__file__))
|
| 21 |
+
|
| 22 |
+
from rdkit import Chem
|
| 23 |
+
from rdkit.Chem import Draw, AllChem
|
| 24 |
+
from rdkit import RDLogger
|
| 25 |
+
RDLogger.DisableLog("rdApp.*")
|
| 26 |
+
|
| 27 |
+
from mol_corrupt import corrupt_molecule, CORRUPTION_TYPES
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
# ---------------------------------------------------------------------------
|
| 31 |
+
# Molecule filtering
|
| 32 |
+
# ---------------------------------------------------------------------------
|
| 33 |
+
|
| 34 |
+
def is_valid(mol, smiles):
|
| 35 |
+
if mol is None or "." in smiles:
|
| 36 |
+
return False
|
| 37 |
+
n = mol.GetNumAtoms()
|
| 38 |
+
if n < 5 or n > 60:
|
| 39 |
+
return False
|
| 40 |
+
if not any(a.GetAtomicNum() == 6 for a in mol.GetAtoms()):
|
| 41 |
+
return False
|
| 42 |
+
return True
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
# ---------------------------------------------------------------------------
|
| 46 |
+
# Streaming sample from gzip file
|
| 47 |
+
# ---------------------------------------------------------------------------
|
| 48 |
+
|
| 49 |
+
def stream_sample(filepath, pool_size, seed=42):
|
| 50 |
+
rng = random.Random(seed)
|
| 51 |
+
pool = []
|
| 52 |
+
proc = subprocess.Popen(
|
| 53 |
+
["zcat", filepath],
|
| 54 |
+
stdout=subprocess.PIPE,
|
| 55 |
+
stderr=subprocess.DEVNULL,
|
| 56 |
+
preexec_fn=lambda: signal.signal(signal.SIGPIPE, signal.SIG_DFL),
|
| 57 |
+
)
|
| 58 |
+
for raw in proc.stdout:
|
| 59 |
+
line = raw.decode("ascii", errors="ignore").strip()
|
| 60 |
+
parts = line.split("\t")
|
| 61 |
+
if len(parts) >= 2 and parts[0].isdigit():
|
| 62 |
+
pool.append((parts[0], parts[1]))
|
| 63 |
+
if len(pool) >= pool_size:
|
| 64 |
+
break
|
| 65 |
+
proc.kill(); proc.wait()
|
| 66 |
+
rng.shuffle(pool)
|
| 67 |
+
return pool
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def render(smiles, path, size=(400, 300)):
|
| 71 |
+
mol = Chem.MolFromSmiles(smiles)
|
| 72 |
+
if mol is None:
|
| 73 |
+
return False
|
| 74 |
+
AllChem.Compute2DCoords(mol)
|
| 75 |
+
Draw.MolToFile(mol, path, size=size)
|
| 76 |
+
return True
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
# ---------------------------------------------------------------------------
|
| 80 |
+
# Main builder
|
| 81 |
+
# ---------------------------------------------------------------------------
|
| 82 |
+
|
| 83 |
+
def build(input_path, output_dir, target_per_op=20, pool_size=20000, seed=42):
|
| 84 |
+
img_dir = os.path.join(output_dir, "images")
|
| 85 |
+
os.makedirs(img_dir, exist_ok=True)
|
| 86 |
+
|
| 87 |
+
print(f"Sampling {pool_size} candidates from {input_path} ...")
|
| 88 |
+
raw_pool = stream_sample(input_path, pool_size, seed=seed)
|
| 89 |
+
print(f" Got {len(raw_pool)} candidates, filtering ...")
|
| 90 |
+
|
| 91 |
+
valid = []
|
| 92 |
+
for cid, smi in raw_pool:
|
| 93 |
+
mol = Chem.MolFromSmiles(smi)
|
| 94 |
+
if is_valid(mol, smi):
|
| 95 |
+
valid.append((cid, Chem.MolToSmiles(mol), mol))
|
| 96 |
+
print(f" {len(valid)} molecules passed filtering")
|
| 97 |
+
|
| 98 |
+
collected = {op: 0 for op in CORRUPTION_TYPES}
|
| 99 |
+
records = []
|
| 100 |
+
idx = 0
|
| 101 |
+
skipped = 0
|
| 102 |
+
|
| 103 |
+
# Pass through the pool repeatedly until all op types hit target
|
| 104 |
+
# or we've done max_passes full sweeps (to avoid infinite loop)
|
| 105 |
+
max_passes = 5
|
| 106 |
+
for pass_num in range(1, max_passes + 1):
|
| 107 |
+
remaining_ops = [op for op in CORRUPTION_TYPES if collected[op] < target_per_op]
|
| 108 |
+
if not remaining_ops:
|
| 109 |
+
break
|
| 110 |
+
print(f"\nPass {pass_num}: {len(remaining_ops)} op types still need samples")
|
| 111 |
+
|
| 112 |
+
random.seed(seed + pass_num)
|
| 113 |
+
random.shuffle(valid)
|
| 114 |
+
|
| 115 |
+
for cid, canonical, mol in valid:
|
| 116 |
+
if not remaining_ops:
|
| 117 |
+
break
|
| 118 |
+
|
| 119 |
+
for op_type in list(remaining_ops):
|
| 120 |
+
if collected[op_type] >= target_per_op:
|
| 121 |
+
remaining_ops.remove(op_type)
|
| 122 |
+
continue
|
| 123 |
+
|
| 124 |
+
result = corrupt_molecule(canonical, op_type=op_type, max_retries=15)
|
| 125 |
+
if result is None:
|
| 126 |
+
skipped += 1
|
| 127 |
+
continue
|
| 128 |
+
|
| 129 |
+
wrong_smi, wrong_smi_mapped, correction = result
|
| 130 |
+
item_id = f"{idx:06d}"
|
| 131 |
+
img_rel = os.path.join("images", f"{item_id}.png")
|
| 132 |
+
abs_img = os.path.join(output_dir, img_rel)
|
| 133 |
+
|
| 134 |
+
if not render(canonical, abs_img):
|
| 135 |
+
skipped += 1
|
| 136 |
+
continue
|
| 137 |
+
|
| 138 |
+
records.append({
|
| 139 |
+
"id": item_id,
|
| 140 |
+
"cid": cid,
|
| 141 |
+
"correct_smiles": canonical,
|
| 142 |
+
"wrong_smiles": wrong_smi,
|
| 143 |
+
"wrong_smiles_mapped": wrong_smi_mapped,
|
| 144 |
+
"image_path": img_rel,
|
| 145 |
+
"operation": correction,
|
| 146 |
+
})
|
| 147 |
+
collected[op_type] += 1
|
| 148 |
+
idx += 1
|
| 149 |
+
|
| 150 |
+
if idx % 50 == 0:
|
| 151 |
+
print(f" {idx} samples collected ...")
|
| 152 |
+
|
| 153 |
+
remaining_ops = [op for op in CORRUPTION_TYPES if collected[op] < target_per_op]
|
| 154 |
+
|
| 155 |
+
print("\nOp type coverage:")
|
| 156 |
+
for op in CORRUPTION_TYPES:
|
| 157 |
+
mark = "✓" if collected[op] >= target_per_op else f"✗ (only {collected[op]})"
|
| 158 |
+
print(f" {op:<35} {collected[op]:>4} {mark}")
|
| 159 |
+
|
| 160 |
+
json_path = os.path.join(output_dir, "dataset.json")
|
| 161 |
+
with open(json_path, "w") as f:
|
| 162 |
+
json.dump(records, f, indent=2, ensure_ascii=False)
|
| 163 |
+
|
| 164 |
+
print(f"\nDone: {len(records)} samples → {json_path} (skipped {skipped})")
|
| 165 |
+
return records
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
# ---------------------------------------------------------------------------
|
| 169 |
+
# CLI
|
| 170 |
+
# ---------------------------------------------------------------------------
|
| 171 |
+
|
| 172 |
+
if __name__ == "__main__":
|
| 173 |
+
parser = argparse.ArgumentParser()
|
| 174 |
+
parser.add_argument("--input", default="/home/dataset-assist-0/usr/lh/mzm/data/pubchem/CID-SMILES.gz.1")
|
| 175 |
+
parser.add_argument("--output", default="./data/pubchem_dataset_v2")
|
| 176 |
+
parser.add_argument("--target_per_op", type=int, default=20, help="Samples per op type")
|
| 177 |
+
parser.add_argument("--pool", type=int, default=20000, help="Candidate pool size from input file")
|
| 178 |
+
parser.add_argument("--seed", type=int, default=42)
|
| 179 |
+
args = parser.parse_args()
|
| 180 |
+
|
| 181 |
+
build(
|
| 182 |
+
input_path=args.input,
|
| 183 |
+
output_dir=args.output,
|
| 184 |
+
target_per_op=args.target_per_op,
|
| 185 |
+
pool_size=args.pool,
|
| 186 |
+
seed=args.seed,
|
| 187 |
+
)
|
code/mol_corrupt.py
ADDED
|
@@ -0,0 +1,544 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Corruption engine using atom map numbers for stable atom identification.
|
| 3 |
+
|
| 4 |
+
Each corrupt_* function returns (wrong_rw, raw_correction_with_wrong_rw_indices).
|
| 5 |
+
corrupt_molecule() assigns atom map nums to wrong_rw, translates indices → map_nums,
|
| 6 |
+
and returns (wrong_smiles, wrong_smiles_mapped, correction_with_maps).
|
| 7 |
+
|
| 8 |
+
wrong_smiles : clean SMILES without maps (for display / training input)
|
| 9 |
+
wrong_smiles_mapped : SMILES with :[n] map tags (for executor to locate atoms)
|
| 10 |
+
correction : operation params use atom_map/anchor_map/atom1_map/atom2_map
|
| 11 |
+
instead of raw atom_idx — these survive SMILES round-trips.
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
import copy
|
| 15 |
+
import random
|
| 16 |
+
from rdkit import Chem
|
| 17 |
+
from rdkit.Chem import AllChem
|
| 18 |
+
|
| 19 |
+
from mol_ops import (
|
| 20 |
+
BOND_TYPE_MAP, BOND_TYPE_NAME, ELEM_TO_NUM, NUM_TO_ELEM,
|
| 21 |
+
FUNCTIONAL_GROUPS,
|
| 22 |
+
change_atom_element, add_atom, remove_atom, change_charge,
|
| 23 |
+
change_bond_order, add_bond, remove_bond,
|
| 24 |
+
add_functional_group, remove_functional_group,
|
| 25 |
+
flip_chirality, flip_ez,
|
| 26 |
+
validate_mol,
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
CORRUPTION_TYPES = [
|
| 30 |
+
"change_atom_element",
|
| 31 |
+
"add_atom",
|
| 32 |
+
"remove_atom",
|
| 33 |
+
"change_charge",
|
| 34 |
+
"change_bond_order",
|
| 35 |
+
"add_bond",
|
| 36 |
+
"remove_bond",
|
| 37 |
+
"add_functional_group",
|
| 38 |
+
"remove_functional_group",
|
| 39 |
+
"flip_chirality",
|
| 40 |
+
"flip_ez",
|
| 41 |
+
"move_substituent",
|
| 42 |
+
"swap_substituents",
|
| 43 |
+
]
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
# ---------------------------------------------------------------------------
|
| 47 |
+
# Helpers
|
| 48 |
+
# ---------------------------------------------------------------------------
|
| 49 |
+
|
| 50 |
+
def _random_other_elem(current_elem):
|
| 51 |
+
candidates = [e for e in ("C", "N", "O", "S") if e != current_elem]
|
| 52 |
+
return random.choice(candidates)
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def _has_free_valence(atom):
|
| 56 |
+
try:
|
| 57 |
+
return atom.GetNumImplicitHs() > 0
|
| 58 |
+
except Exception:
|
| 59 |
+
return False
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
def _assign_atom_maps(rw):
|
| 63 |
+
"""Assign map_num = idx+1 to every atom in rw (in-place)."""
|
| 64 |
+
for atom in rw.GetAtoms():
|
| 65 |
+
atom.SetAtomMapNum(atom.GetIdx() + 1)
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def _strip_atom_maps(rw):
|
| 69 |
+
"""Return a copy of rw with all atom maps removed."""
|
| 70 |
+
c = copy.deepcopy(rw)
|
| 71 |
+
for atom in c.GetAtoms():
|
| 72 |
+
atom.SetAtomMapNum(0)
|
| 73 |
+
return c
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
def _translate_correction(wrong_rw, raw):
|
| 77 |
+
"""
|
| 78 |
+
Translate a raw correction (atom_idx → map_num) for stable cross-SMILES use.
|
| 79 |
+
raw = {'type': ..., 'params': {atom_idx: X, ...}, 'description': ...}
|
| 80 |
+
Returns new correction dict with map_num-based params.
|
| 81 |
+
"""
|
| 82 |
+
params = {}
|
| 83 |
+
for k, v in raw["params"].items():
|
| 84 |
+
if k == "atom_idx":
|
| 85 |
+
params["atom_map"] = wrong_rw.GetAtomWithIdx(v).GetAtomMapNum()
|
| 86 |
+
elif k == "anchor_idx":
|
| 87 |
+
params["anchor_map"] = wrong_rw.GetAtomWithIdx(v).GetAtomMapNum()
|
| 88 |
+
elif k == "atom_idx1":
|
| 89 |
+
params["atom1_map"] = wrong_rw.GetAtomWithIdx(v).GetAtomMapNum()
|
| 90 |
+
elif k == "atom_idx2":
|
| 91 |
+
params["atom2_map"] = wrong_rw.GetAtomWithIdx(v).GetAtomMapNum()
|
| 92 |
+
elif k == "substituent_idx":
|
| 93 |
+
params["substituent_map"] = wrong_rw.GetAtomWithIdx(v).GetAtomMapNum()
|
| 94 |
+
elif k == "from_idx":
|
| 95 |
+
params["from_map"] = wrong_rw.GetAtomWithIdx(v).GetAtomMapNum()
|
| 96 |
+
elif k == "to_idx":
|
| 97 |
+
params["to_map"] = wrong_rw.GetAtomWithIdx(v).GetAtomMapNum()
|
| 98 |
+
elif k == "ring_idx1":
|
| 99 |
+
params["ring1_map"] = wrong_rw.GetAtomWithIdx(v).GetAtomMapNum()
|
| 100 |
+
elif k == "ring_idx2":
|
| 101 |
+
params["ring2_map"] = wrong_rw.GetAtomWithIdx(v).GetAtomMapNum()
|
| 102 |
+
else:
|
| 103 |
+
params[k] = v
|
| 104 |
+
return {"type": raw["type"], "params": params, "description": raw["description"]}
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
# ---------------------------------------------------------------------------
|
| 108 |
+
# Individual corruption functions
|
| 109 |
+
# Each returns (wrong_rw, raw_correction) or None
|
| 110 |
+
# raw_correction uses atom indices in wrong_rw space
|
| 111 |
+
# ---------------------------------------------------------------------------
|
| 112 |
+
|
| 113 |
+
def corrupt_change_atom_element(mol):
|
| 114 |
+
rw = Chem.RWMol(mol)
|
| 115 |
+
atoms = [a for a in rw.GetAtoms()
|
| 116 |
+
if a.GetAtomicNum() > 1 and not a.GetIsAromatic()]
|
| 117 |
+
if not atoms:
|
| 118 |
+
return None
|
| 119 |
+
atom = random.choice(atoms)
|
| 120 |
+
idx = atom.GetIdx()
|
| 121 |
+
old_elem = NUM_TO_ELEM.get(atom.GetAtomicNum(), "C")
|
| 122 |
+
new_elem = _random_other_elem(old_elem)
|
| 123 |
+
result = change_atom_element(rw, atom_idx=idx, to_elem=new_elem)
|
| 124 |
+
if result is None:
|
| 125 |
+
return None
|
| 126 |
+
return result, {
|
| 127 |
+
"type": "change_atom_element",
|
| 128 |
+
"params": {"atom_idx": idx, "from_elem": new_elem, "to_elem": old_elem},
|
| 129 |
+
"description": f"Change atom {idx} from {new_elem} back to {old_elem}",
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
def corrupt_add_atom(mol):
|
| 134 |
+
rw = Chem.RWMol(mol)
|
| 135 |
+
atoms = [a for a in rw.GetAtoms() if _has_free_valence(a)]
|
| 136 |
+
if not atoms:
|
| 137 |
+
return None
|
| 138 |
+
anchor = random.choice(atoms)
|
| 139 |
+
new_elem = random.choice(["C", "N", "O"])
|
| 140 |
+
result = add_atom(rw, anchor_idx=anchor.GetIdx(), new_elem=new_elem)
|
| 141 |
+
if result is None:
|
| 142 |
+
return None
|
| 143 |
+
new_idx = result.GetNumAtoms() - 1
|
| 144 |
+
return result, {
|
| 145 |
+
"type": "remove_atom",
|
| 146 |
+
"params": {"atom_idx": new_idx, "elem": new_elem},
|
| 147 |
+
"description": f"Remove extra {new_elem} atom (added by corruption)",
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
def corrupt_remove_atom(mol):
|
| 152 |
+
rw = Chem.RWMol(mol)
|
| 153 |
+
terminals = [a for a in rw.GetAtoms()
|
| 154 |
+
if a.GetDegree() == 1 and not a.IsInRing() and a.GetAtomicNum() > 1]
|
| 155 |
+
if not terminals:
|
| 156 |
+
return None
|
| 157 |
+
atom = random.choice(terminals)
|
| 158 |
+
idx = atom.GetIdx()
|
| 159 |
+
elem = NUM_TO_ELEM.get(atom.GetAtomicNum(), "C")
|
| 160 |
+
neighbor = atom.GetNeighbors()[0]
|
| 161 |
+
anchor_idx = neighbor.GetIdx()
|
| 162 |
+
bond = rw.GetBondBetweenAtoms(idx, anchor_idx)
|
| 163 |
+
bond_type = BOND_TYPE_NAME.get(bond.GetBondType(), "SINGLE")
|
| 164 |
+
|
| 165 |
+
result = remove_atom(rw, atom_idx=idx)
|
| 166 |
+
if result is None:
|
| 167 |
+
return None
|
| 168 |
+
# Atoms after idx shift down by 1
|
| 169 |
+
adj_anchor = anchor_idx if anchor_idx < idx else anchor_idx - 1
|
| 170 |
+
return result, {
|
| 171 |
+
"type": "add_atom",
|
| 172 |
+
"params": {"anchor_idx": adj_anchor, "new_elem": elem, "bond_type": bond_type},
|
| 173 |
+
"description": f"Add missing {elem} atom back to anchor",
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
def corrupt_change_charge(mol):
|
| 178 |
+
rw = Chem.RWMol(mol)
|
| 179 |
+
# Only corrupt atoms that currently have charge 0 (reversible: 0→±1, then ±1→0 is safe)
|
| 180 |
+
candidates = [a for a in rw.GetAtoms()
|
| 181 |
+
if a.GetAtomicNum() in (7, 8) and not a.GetIsAromatic()
|
| 182 |
+
and a.GetFormalCharge() == 0 and a.GetNumImplicitHs() == 0]
|
| 183 |
+
if not candidates:
|
| 184 |
+
return None
|
| 185 |
+
atom = random.choice(candidates)
|
| 186 |
+
idx = atom.GetIdx()
|
| 187 |
+
old_charge = 0
|
| 188 |
+
new_charge = random.choice([-1, 1])
|
| 189 |
+
result = change_charge(rw, atom_idx=idx, to_charge=new_charge)
|
| 190 |
+
if result is None:
|
| 191 |
+
return None
|
| 192 |
+
return result, {
|
| 193 |
+
"type": "change_charge",
|
| 194 |
+
"params": {"atom_idx": idx, "from_charge": new_charge, "to_charge": old_charge},
|
| 195 |
+
"description": f"Change charge at atom back from {new_charge:+d} to {old_charge:+d}",
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
def corrupt_change_bond_order(mol):
|
| 200 |
+
rw = Chem.RWMol(mol)
|
| 201 |
+
bonds = [b for b in rw.GetBonds()
|
| 202 |
+
if b.GetBondType() in (Chem.BondType.SINGLE, Chem.BondType.DOUBLE)
|
| 203 |
+
and not b.GetIsAromatic()]
|
| 204 |
+
if not bonds:
|
| 205 |
+
return None
|
| 206 |
+
bond = random.choice(bonds)
|
| 207 |
+
idx1, idx2 = bond.GetBeginAtomIdx(), bond.GetEndAtomIdx()
|
| 208 |
+
old_order = BOND_TYPE_NAME[bond.GetBondType()]
|
| 209 |
+
new_order = "DOUBLE" if old_order == "SINGLE" else "SINGLE"
|
| 210 |
+
result = change_bond_order(rw, atom_idx1=idx1, atom_idx2=idx2, to_order=new_order)
|
| 211 |
+
if result is None:
|
| 212 |
+
return None
|
| 213 |
+
return result, {
|
| 214 |
+
"type": "change_bond_order",
|
| 215 |
+
"params": {"atom_idx1": idx1, "atom_idx2": idx2,
|
| 216 |
+
"from_order": new_order, "to_order": old_order},
|
| 217 |
+
"description": f"Change bond ({idx1}-{idx2}) from {new_order} back to {old_order}",
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
def corrupt_add_bond(mol):
|
| 222 |
+
rw = Chem.RWMol(mol)
|
| 223 |
+
n = rw.GetNumAtoms()
|
| 224 |
+
if n < 4:
|
| 225 |
+
return None
|
| 226 |
+
pairs = [(i, j) for i in range(n) for j in range(i + 2, n)
|
| 227 |
+
if rw.GetBondBetweenAtoms(i, j) is None]
|
| 228 |
+
if not pairs:
|
| 229 |
+
return None
|
| 230 |
+
i, j = random.choice(pairs)
|
| 231 |
+
result = add_bond(rw, atom_idx1=i, atom_idx2=j, bond_type="SINGLE")
|
| 232 |
+
if result is None:
|
| 233 |
+
return None
|
| 234 |
+
return result, {
|
| 235 |
+
"type": "remove_bond",
|
| 236 |
+
"params": {"atom_idx1": i, "atom_idx2": j},
|
| 237 |
+
"description": f"Remove spurious bond between atoms {i} and {j}",
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
def corrupt_remove_bond(mol):
|
| 242 |
+
rw = Chem.RWMol(mol)
|
| 243 |
+
bonds = [b for b in rw.GetBonds() if not b.IsInRing()]
|
| 244 |
+
if not bonds:
|
| 245 |
+
return None
|
| 246 |
+
bond = random.choice(bonds)
|
| 247 |
+
idx1, idx2 = bond.GetBeginAtomIdx(), bond.GetEndAtomIdx()
|
| 248 |
+
order = BOND_TYPE_NAME.get(bond.GetBondType(), "SINGLE")
|
| 249 |
+
result = remove_bond(rw, atom_idx1=idx1, atom_idx2=idx2)
|
| 250 |
+
if result is None:
|
| 251 |
+
return None
|
| 252 |
+
return result, {
|
| 253 |
+
"type": "add_bond",
|
| 254 |
+
"params": {"atom_idx1": idx1, "atom_idx2": idx2, "bond_type": order},
|
| 255 |
+
"description": f"Add back {order} bond between atoms {idx1} and {idx2}",
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
def corrupt_add_functional_group(mol):
|
| 260 |
+
rw = Chem.RWMol(mol)
|
| 261 |
+
atoms = [a for a in rw.GetAtoms() if a.GetAtomicNum() == 6]
|
| 262 |
+
if not atoms:
|
| 263 |
+
return None
|
| 264 |
+
anchor = random.choice(atoms)
|
| 265 |
+
group = random.choice(["OH", "NH2", "F", "Cl", "Br", "CH3"])
|
| 266 |
+
result = add_functional_group(rw, anchor_idx=anchor.GetIdx(), group_name=group)
|
| 267 |
+
if result is None:
|
| 268 |
+
return None
|
| 269 |
+
# anchor idx unchanged after adding group atoms at the end
|
| 270 |
+
return result, {
|
| 271 |
+
"type": "remove_functional_group",
|
| 272 |
+
"params": {"anchor_idx": anchor.GetIdx(), "group_name": group},
|
| 273 |
+
"description": f"Remove extra -{group} group",
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
|
| 277 |
+
def corrupt_remove_functional_group(mol):
|
| 278 |
+
rw = Chem.RWMol(mol)
|
| 279 |
+
for group in ("OH", "NH2", "F", "Cl", "Br", "CH3"):
|
| 280 |
+
for atom in rw.GetAtoms():
|
| 281 |
+
if atom.GetAtomicNum() != 6:
|
| 282 |
+
continue
|
| 283 |
+
test = Chem.RWMol(mol)
|
| 284 |
+
result, removed = remove_functional_group(test, atom.GetIdx(), group)
|
| 285 |
+
if result is None:
|
| 286 |
+
continue
|
| 287 |
+
removed_idx = removed[0]
|
| 288 |
+
anchor_in_mol = atom.GetIdx()
|
| 289 |
+
# After removing atom at removed_idx, anchor shifts if removed_idx < anchor
|
| 290 |
+
adj_anchor = anchor_in_mol if removed_idx > anchor_in_mol else anchor_in_mol - 1
|
| 291 |
+
return result, {
|
| 292 |
+
"type": "add_functional_group",
|
| 293 |
+
"params": {"anchor_idx": adj_anchor, "group_name": group},
|
| 294 |
+
"description": f"Add -{group} back to anchor atom",
|
| 295 |
+
}
|
| 296 |
+
return None
|
| 297 |
+
|
| 298 |
+
|
| 299 |
+
def corrupt_flip_chirality(mol):
|
| 300 |
+
rw = Chem.RWMol(mol)
|
| 301 |
+
Chem.AssignStereochemistry(rw, cleanIt=True, force=True)
|
| 302 |
+
chiral = [a for a in rw.GetAtoms()
|
| 303 |
+
if a.GetChiralTag() != Chem.ChiralType.CHI_UNSPECIFIED]
|
| 304 |
+
if not chiral:
|
| 305 |
+
return None
|
| 306 |
+
atom = random.choice(chiral)
|
| 307 |
+
idx = atom.GetIdx()
|
| 308 |
+
result = flip_chirality(rw, atom_idx=idx)
|
| 309 |
+
if result is None:
|
| 310 |
+
return None
|
| 311 |
+
return result, {
|
| 312 |
+
"type": "flip_chirality",
|
| 313 |
+
"params": {"atom_idx": idx},
|
| 314 |
+
"description": f"Flip chirality back at atom {idx}",
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
|
| 318 |
+
def corrupt_flip_ez(mol):
|
| 319 |
+
"""SMILES-level; returns (wrong_smi, raw_correction) directly."""
|
| 320 |
+
smi = Chem.MolToSmiles(mol, isomericSmiles=True)
|
| 321 |
+
if "/" not in smi and "\\" not in smi:
|
| 322 |
+
return None
|
| 323 |
+
wrong_smi = flip_ez(smi)
|
| 324 |
+
if wrong_smi is None or wrong_smi == smi:
|
| 325 |
+
return None
|
| 326 |
+
return wrong_smi, {
|
| 327 |
+
"type": "flip_ez",
|
| 328 |
+
"params": {},
|
| 329 |
+
"description": "Flip E/Z configuration back",
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
|
| 333 |
+
def corrupt_move_substituent(mol):
|
| 334 |
+
"""
|
| 335 |
+
Move a non-ring substituent from one ring atom to a different ring atom
|
| 336 |
+
in the same ring (e.g. ortho→meta shift on benzene).
|
| 337 |
+
Operates in Kekulé form to avoid aromatic bond issues.
|
| 338 |
+
Correction: MoveSubstituent back.
|
| 339 |
+
"""
|
| 340 |
+
rw = Chem.RWMol(mol)
|
| 341 |
+
try:
|
| 342 |
+
Chem.Kekulize(rw, clearAromaticFlags=True)
|
| 343 |
+
except Exception:
|
| 344 |
+
return None
|
| 345 |
+
|
| 346 |
+
ri = rw.GetRingInfo()
|
| 347 |
+
rings = [set(r) for r in ri.AtomRings() if len(r) >= 5]
|
| 348 |
+
if not rings:
|
| 349 |
+
return None
|
| 350 |
+
|
| 351 |
+
# Build all (from_idx, sub_idx, to_idx) triples and shuffle
|
| 352 |
+
triples = []
|
| 353 |
+
for ring in rings:
|
| 354 |
+
ring_list = list(ring)
|
| 355 |
+
for from_idx in ring_list:
|
| 356 |
+
atom = rw.GetAtomWithIdx(from_idx)
|
| 357 |
+
subs = [nb for nb in atom.GetNeighbors()
|
| 358 |
+
if nb.GetIdx() not in ring and nb.GetAtomicNum() > 1]
|
| 359 |
+
for sub in subs:
|
| 360 |
+
sub_idx = sub.GetIdx()
|
| 361 |
+
for to_idx in ring_list:
|
| 362 |
+
if to_idx != from_idx and rw.GetBondBetweenAtoms(to_idx, sub_idx) is None:
|
| 363 |
+
triples.append((from_idx, sub_idx, to_idx))
|
| 364 |
+
random.shuffle(triples)
|
| 365 |
+
|
| 366 |
+
for from_idx, sub_idx, to_idx in triples:
|
| 367 |
+
rw2 = Chem.RWMol(copy.deepcopy(rw))
|
| 368 |
+
rw2.RemoveBond(from_idx, sub_idx)
|
| 369 |
+
rw2.AddBond(to_idx, sub_idx, Chem.BondType.SINGLE)
|
| 370 |
+
if not validate_mol(rw2):
|
| 371 |
+
continue
|
| 372 |
+
# Check it actually changed the molecule
|
| 373 |
+
wrong_smi = Chem.MolToSmiles(rw2)
|
| 374 |
+
orig_smi = Chem.MolToSmiles(mol)
|
| 375 |
+
if wrong_smi == orig_smi:
|
| 376 |
+
continue
|
| 377 |
+
return rw2, {
|
| 378 |
+
"type": "move_substituent",
|
| 379 |
+
"params": {
|
| 380 |
+
"substituent_idx": sub_idx,
|
| 381 |
+
"from_idx": to_idx, # correction reverses: from=to, to=from
|
| 382 |
+
"to_idx": from_idx,
|
| 383 |
+
},
|
| 384 |
+
"description": f"Move substituent {sub_idx} back from ring atom {to_idx} to {from_idx}",
|
| 385 |
+
}
|
| 386 |
+
return None
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
def corrupt_swap_substituents(mol):
|
| 390 |
+
"""
|
| 391 |
+
Swap the non-ring substituents of two ring atoms in the same ring.
|
| 392 |
+
Operates in Kekulé form to avoid aromatic bond issues.
|
| 393 |
+
Correction: SwapSubstituents back (same action).
|
| 394 |
+
"""
|
| 395 |
+
rw = Chem.RWMol(mol)
|
| 396 |
+
try:
|
| 397 |
+
Chem.Kekulize(rw, clearAromaticFlags=True)
|
| 398 |
+
except Exception:
|
| 399 |
+
return None
|
| 400 |
+
|
| 401 |
+
ri = rw.GetRingInfo()
|
| 402 |
+
rings = [list(r) for r in ri.AtomRings() if len(r) >= 5]
|
| 403 |
+
if not rings:
|
| 404 |
+
return None
|
| 405 |
+
|
| 406 |
+
random.shuffle(rings)
|
| 407 |
+
for ring in rings:
|
| 408 |
+
ring_set = set(ring)
|
| 409 |
+
substituted = []
|
| 410 |
+
for idx in ring:
|
| 411 |
+
subs = [nb.GetIdx() for nb in rw.GetAtomWithIdx(idx).GetNeighbors()
|
| 412 |
+
if nb.GetIdx() not in ring_set and nb.GetAtomicNum() > 1]
|
| 413 |
+
if subs:
|
| 414 |
+
substituted.append((idx, subs))
|
| 415 |
+
if len(substituted) < 2:
|
| 416 |
+
continue
|
| 417 |
+
|
| 418 |
+
random.shuffle(substituted)
|
| 419 |
+
(idx1, subs1), (idx2, subs2) = substituted[0], substituted[1]
|
| 420 |
+
|
| 421 |
+
def bonds_to(center, sub_list):
|
| 422 |
+
return [(s, rw.GetBondBetweenAtoms(center, s).GetBondType()) for s in sub_list]
|
| 423 |
+
|
| 424 |
+
b1 = bonds_to(idx1, subs1)
|
| 425 |
+
b2 = bonds_to(idx2, subs2)
|
| 426 |
+
|
| 427 |
+
if any(rw.GetBondBetweenAtoms(idx2, s) is not None for s, _ in b1):
|
| 428 |
+
continue
|
| 429 |
+
if any(rw.GetBondBetweenAtoms(idx1, s) is not None for s, _ in b2):
|
| 430 |
+
continue
|
| 431 |
+
|
| 432 |
+
rw2 = Chem.RWMol(copy.deepcopy(rw))
|
| 433 |
+
for s, _ in b1:
|
| 434 |
+
rw2.RemoveBond(idx1, s)
|
| 435 |
+
for s, _ in b2:
|
| 436 |
+
rw2.RemoveBond(idx2, s)
|
| 437 |
+
for s, bt in b1:
|
| 438 |
+
rw2.AddBond(idx2, s, Chem.BondType.SINGLE)
|
| 439 |
+
for s, bt in b2:
|
| 440 |
+
rw2.AddBond(idx1, s, Chem.BondType.SINGLE)
|
| 441 |
+
|
| 442 |
+
if not validate_mol(rw2):
|
| 443 |
+
continue
|
| 444 |
+
return rw2, {
|
| 445 |
+
"type": "swap_substituents",
|
| 446 |
+
"params": {
|
| 447 |
+
"ring_idx1": idx1,
|
| 448 |
+
"ring_idx2": idx2,
|
| 449 |
+
},
|
| 450 |
+
"description": f"Swap substituents back between ring atoms {idx1} and {idx2}",
|
| 451 |
+
}
|
| 452 |
+
return None
|
| 453 |
+
|
| 454 |
+
|
| 455 |
+
CORRUPT_FUNCS = {
|
| 456 |
+
"change_atom_element": corrupt_change_atom_element,
|
| 457 |
+
"add_atom": corrupt_add_atom,
|
| 458 |
+
"remove_atom": corrupt_remove_atom,
|
| 459 |
+
"change_charge": corrupt_change_charge,
|
| 460 |
+
"change_bond_order": corrupt_change_bond_order,
|
| 461 |
+
"add_bond": corrupt_add_bond,
|
| 462 |
+
"remove_bond": corrupt_remove_bond,
|
| 463 |
+
"add_functional_group": corrupt_add_functional_group,
|
| 464 |
+
"remove_functional_group": corrupt_remove_functional_group,
|
| 465 |
+
"flip_chirality": corrupt_flip_chirality,
|
| 466 |
+
"flip_ez": corrupt_flip_ez,
|
| 467 |
+
"move_substituent": corrupt_move_substituent,
|
| 468 |
+
"swap_substituents": corrupt_swap_substituents,
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
|
| 472 |
+
# ---------------------------------------------------------------------------
|
| 473 |
+
# Main API
|
| 474 |
+
# ---------------------------------------------------------------------------
|
| 475 |
+
|
| 476 |
+
def corrupt_molecule(smiles, op_type=None, max_retries=20):
|
| 477 |
+
"""
|
| 478 |
+
Returns (wrong_smiles, wrong_smiles_mapped, correction) or None.
|
| 479 |
+
|
| 480 |
+
wrong_smiles — clean SMILES (no atom maps), the erroneous input
|
| 481 |
+
wrong_smiles_mapped — SMILES with :[n] atom map tags for executor use
|
| 482 |
+
correction — dict with type, params (map_num-based), description
|
| 483 |
+
"""
|
| 484 |
+
mol = Chem.MolFromSmiles(smiles)
|
| 485 |
+
if mol is None:
|
| 486 |
+
return None
|
| 487 |
+
|
| 488 |
+
for _ in range(max_retries):
|
| 489 |
+
chosen_type = op_type or random.choice(CORRUPTION_TYPES)
|
| 490 |
+
func = CORRUPT_FUNCS[chosen_type]
|
| 491 |
+
raw = func(mol)
|
| 492 |
+
if raw is None:
|
| 493 |
+
continue
|
| 494 |
+
|
| 495 |
+
# flip_ez is SMILES-level — handle separately
|
| 496 |
+
if chosen_type == "flip_ez":
|
| 497 |
+
wrong_smi, raw_correction = raw
|
| 498 |
+
if wrong_smi == smiles:
|
| 499 |
+
continue
|
| 500 |
+
wrong_mol = Chem.MolFromSmiles(wrong_smi)
|
| 501 |
+
if wrong_mol is None:
|
| 502 |
+
continue
|
| 503 |
+
wrong_rw = Chem.RWMol(wrong_mol)
|
| 504 |
+
_assign_atom_maps(wrong_rw)
|
| 505 |
+
wrong_smiles_mapped = Chem.MolToSmiles(wrong_rw)
|
| 506 |
+
correction = {"type": "flip_ez", "params": {},
|
| 507 |
+
"description": raw_correction["description"]}
|
| 508 |
+
return wrong_smi, wrong_smiles_mapped, correction
|
| 509 |
+
|
| 510 |
+
wrong_rw, raw_correction = raw
|
| 511 |
+
if not validate_mol(wrong_rw):
|
| 512 |
+
continue
|
| 513 |
+
|
| 514 |
+
# Assign atom map numbers to wrong_rw (map_num = idx + 1)
|
| 515 |
+
_assign_atom_maps(wrong_rw)
|
| 516 |
+
|
| 517 |
+
# Translate index-based params → map-num-based params
|
| 518 |
+
try:
|
| 519 |
+
correction = _translate_correction(wrong_rw, raw_correction)
|
| 520 |
+
except (IndexError, RuntimeError):
|
| 521 |
+
continue
|
| 522 |
+
|
| 523 |
+
# Generate clean wrong SMILES (no maps)
|
| 524 |
+
wrong_smiles = Chem.MolToSmiles(_strip_atom_maps(wrong_rw))
|
| 525 |
+
if wrong_smiles == smiles:
|
| 526 |
+
continue
|
| 527 |
+
|
| 528 |
+
wrong_smiles_mapped = Chem.MolToSmiles(wrong_rw)
|
| 529 |
+
|
| 530 |
+
# ── Verify round-trip before accepting ──────────────────────────────
|
| 531 |
+
from action_executor import ActionExecutor as _AE
|
| 532 |
+
from validate_with_executor import translate_operation
|
| 533 |
+
try:
|
| 534 |
+
action = translate_operation(correction)
|
| 535 |
+
restored = _AE().execute(wrong_smiles_mapped, action)
|
| 536 |
+
except Exception:
|
| 537 |
+
continue
|
| 538 |
+
restored_mol = Chem.MolFromSmiles(restored) if restored else None
|
| 539 |
+
if restored_mol is None or Chem.MolToSmiles(restored_mol) != smiles:
|
| 540 |
+
continue # bad sample — discard and retry
|
| 541 |
+
|
| 542 |
+
return wrong_smiles, wrong_smiles_mapped, correction
|
| 543 |
+
|
| 544 |
+
return None
|
code/mol_ops.py
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Core molecular editing operations using RDKit's RWMol API.
|
| 3 |
+
|
| 4 |
+
Each operation takes an RWMol and parameters, returns the modified RWMol.
|
| 5 |
+
Each has a forward (corruption) and inverse (correction) form.
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
import copy
|
| 9 |
+
from rdkit import Chem
|
| 10 |
+
from rdkit.Chem import AllChem, rdmolops
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
BOND_TYPE_MAP = {
|
| 14 |
+
"SINGLE": Chem.BondType.SINGLE,
|
| 15 |
+
"DOUBLE": Chem.BondType.DOUBLE,
|
| 16 |
+
"TRIPLE": Chem.BondType.TRIPLE,
|
| 17 |
+
"AROMATIC": Chem.BondType.AROMATIC,
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
BOND_TYPE_NAME = {v: k for k, v in BOND_TYPE_MAP.items()}
|
| 21 |
+
|
| 22 |
+
ELEM_TO_NUM = {
|
| 23 |
+
"C": 6, "N": 7, "O": 8, "S": 16, "P": 15, "F": 9,
|
| 24 |
+
"Cl": 17, "Br": 35, "I": 53, "B": 5, "Si": 14, "Se": 34,
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
NUM_TO_ELEM = {v: k for k, v in ELEM_TO_NUM.items()}
|
| 28 |
+
|
| 29 |
+
FUNCTIONAL_GROUPS = {
|
| 30 |
+
"OH": "[OH]",
|
| 31 |
+
"NH2": "[NH2]",
|
| 32 |
+
"F": "[F]",
|
| 33 |
+
"Cl": "[Cl]",
|
| 34 |
+
"Br": "[Br]",
|
| 35 |
+
"CH3": "[CH3]",
|
| 36 |
+
"NO2": "[N+](=O)[O-]",
|
| 37 |
+
"COOH": "C(=O)[OH]",
|
| 38 |
+
"CHO": "[CH]=O",
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def validate_mol(mol):
|
| 43 |
+
if mol is None:
|
| 44 |
+
return False
|
| 45 |
+
try:
|
| 46 |
+
Chem.SanitizeMol(mol)
|
| 47 |
+
return True
|
| 48 |
+
except Exception:
|
| 49 |
+
return False
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def safe_apply(func):
|
| 53 |
+
"""Decorator: returns None if the operation produces an invalid molecule."""
|
| 54 |
+
def wrapper(mol, **kwargs):
|
| 55 |
+
rw = copy.deepcopy(mol)
|
| 56 |
+
try:
|
| 57 |
+
result = func(rw, **kwargs)
|
| 58 |
+
if result is None:
|
| 59 |
+
return None
|
| 60 |
+
if not validate_mol(result):
|
| 61 |
+
return None
|
| 62 |
+
return result
|
| 63 |
+
except Exception:
|
| 64 |
+
return None
|
| 65 |
+
return wrapper
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
# ---------------------------------------------------------------------------
|
| 69 |
+
# 1. change_atom_element
|
| 70 |
+
# ---------------------------------------------------------------------------
|
| 71 |
+
@safe_apply
|
| 72 |
+
def change_atom_element(mol, atom_idx, to_elem):
|
| 73 |
+
atom = mol.GetAtomWithIdx(atom_idx)
|
| 74 |
+
atom.SetAtomicNum(ELEM_TO_NUM[to_elem])
|
| 75 |
+
atom.SetNoImplicit(False)
|
| 76 |
+
atom.UpdatePropertyCache(strict=False)
|
| 77 |
+
return mol
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
# ---------------------------------------------------------------------------
|
| 81 |
+
# 2. add_atom — adds a new atom bonded to anchor
|
| 82 |
+
# ---------------------------------------------------------------------------
|
| 83 |
+
@safe_apply
|
| 84 |
+
def add_atom(mol, anchor_idx, new_elem, bond_type="SINGLE"):
|
| 85 |
+
new_idx = mol.AddAtom(Chem.Atom(ELEM_TO_NUM[new_elem]))
|
| 86 |
+
mol.AddBond(anchor_idx, new_idx, BOND_TYPE_MAP[bond_type])
|
| 87 |
+
return mol
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
# ---------------------------------------------------------------------------
|
| 91 |
+
# 3. remove_atom
|
| 92 |
+
# ---------------------------------------------------------------------------
|
| 93 |
+
@safe_apply
|
| 94 |
+
def remove_atom(mol, atom_idx):
|
| 95 |
+
mol.RemoveAtom(atom_idx)
|
| 96 |
+
return mol
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
# ---------------------------------------------------------------------------
|
| 100 |
+
# 4. change_charge
|
| 101 |
+
# ---------------------------------------------------------------------------
|
| 102 |
+
@safe_apply
|
| 103 |
+
def change_charge(mol, atom_idx, to_charge):
|
| 104 |
+
atom = mol.GetAtomWithIdx(atom_idx)
|
| 105 |
+
atom.SetFormalCharge(to_charge)
|
| 106 |
+
atom.UpdatePropertyCache(strict=False)
|
| 107 |
+
return mol
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
# ---------------------------------------------------------------------------
|
| 111 |
+
# 5. change_bond_order
|
| 112 |
+
# ---------------------------------------------------------------------------
|
| 113 |
+
@safe_apply
|
| 114 |
+
def change_bond_order(mol, atom_idx1, atom_idx2, to_order):
|
| 115 |
+
bond = mol.GetBondBetweenAtoms(atom_idx1, atom_idx2)
|
| 116 |
+
if bond is None:
|
| 117 |
+
return None
|
| 118 |
+
bond.SetBondType(BOND_TYPE_MAP[to_order])
|
| 119 |
+
return mol
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
# ---------------------------------------------------------------------------
|
| 123 |
+
# 6. add_bond
|
| 124 |
+
# ---------------------------------------------------------------------------
|
| 125 |
+
@safe_apply
|
| 126 |
+
def add_bond(mol, atom_idx1, atom_idx2, bond_type="SINGLE"):
|
| 127 |
+
existing = mol.GetBondBetweenAtoms(atom_idx1, atom_idx2)
|
| 128 |
+
if existing is not None:
|
| 129 |
+
return None
|
| 130 |
+
mol.AddBond(atom_idx1, atom_idx2, BOND_TYPE_MAP[bond_type])
|
| 131 |
+
return mol
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
# ---------------------------------------------------------------------------
|
| 135 |
+
# 7. remove_bond
|
| 136 |
+
# ---------------------------------------------------------------------------
|
| 137 |
+
@safe_apply
|
| 138 |
+
def remove_bond(mol, atom_idx1, atom_idx2):
|
| 139 |
+
bond = mol.GetBondBetweenAtoms(atom_idx1, atom_idx2)
|
| 140 |
+
if bond is None:
|
| 141 |
+
return None
|
| 142 |
+
mol.RemoveBond(atom_idx1, atom_idx2)
|
| 143 |
+
return mol
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
# ---------------------------------------------------------------------------
|
| 147 |
+
# 8. add_functional_group
|
| 148 |
+
# ---------------------------------------------------------------------------
|
| 149 |
+
@safe_apply
|
| 150 |
+
def add_functional_group(mol, anchor_idx, group_name):
|
| 151 |
+
group_smi = FUNCTIONAL_GROUPS.get(group_name)
|
| 152 |
+
if group_smi is None:
|
| 153 |
+
return None
|
| 154 |
+
group_mol = Chem.MolFromSmiles(group_smi)
|
| 155 |
+
if group_mol is None:
|
| 156 |
+
return None
|
| 157 |
+
|
| 158 |
+
combo = Chem.RWMol(rdmolops.CombineMols(mol, group_mol))
|
| 159 |
+
old_n = mol.GetNumAtoms()
|
| 160 |
+
anchor = combo.GetAtomWithIdx(anchor_idx)
|
| 161 |
+
anchor.SetNumExplicitHs(0)
|
| 162 |
+
anchor.SetNoImplicit(False)
|
| 163 |
+
anchor.SetNumRadicalElectrons(0)
|
| 164 |
+
combo.AddBond(anchor_idx, old_n, Chem.BondType.SINGLE)
|
| 165 |
+
return combo
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
# ---------------------------------------------------------------------------
|
| 169 |
+
# 9. remove_functional_group (removes a terminal substituent at anchor)
|
| 170 |
+
# ---------------------------------------------------------------------------
|
| 171 |
+
def remove_functional_group(mol, anchor_idx, group_name):
|
| 172 |
+
"""Remove atoms belonging to a terminal functional group attached at anchor_idx.
|
| 173 |
+
Returns (new_mol, removed_atom_indices) or (None, [])."""
|
| 174 |
+
rw = copy.deepcopy(mol)
|
| 175 |
+
anchor = rw.GetAtomWithIdx(anchor_idx)
|
| 176 |
+
neighbors = [n for n in anchor.GetNeighbors()]
|
| 177 |
+
|
| 178 |
+
if group_name in ("F", "Cl", "Br"):
|
| 179 |
+
target_num = ELEM_TO_NUM.get(group_name)
|
| 180 |
+
for n in neighbors:
|
| 181 |
+
if n.GetAtomicNum() == target_num and n.GetDegree() == 1:
|
| 182 |
+
idx = n.GetIdx()
|
| 183 |
+
rw.RemoveAtom(idx)
|
| 184 |
+
try:
|
| 185 |
+
Chem.SanitizeMol(rw)
|
| 186 |
+
return rw, [idx]
|
| 187 |
+
except Exception:
|
| 188 |
+
return None, []
|
| 189 |
+
return None, []
|
| 190 |
+
|
| 191 |
+
if group_name == "OH":
|
| 192 |
+
for n in neighbors:
|
| 193 |
+
if n.GetAtomicNum() == 8 and n.GetDegree() == 1:
|
| 194 |
+
bond = rw.GetBondBetweenAtoms(anchor_idx, n.GetIdx())
|
| 195 |
+
if bond and bond.GetBondType() == Chem.BondType.SINGLE:
|
| 196 |
+
idx = n.GetIdx()
|
| 197 |
+
rw.RemoveAtom(idx)
|
| 198 |
+
try:
|
| 199 |
+
Chem.SanitizeMol(rw)
|
| 200 |
+
return rw, [idx]
|
| 201 |
+
except Exception:
|
| 202 |
+
return None, []
|
| 203 |
+
return None, []
|
| 204 |
+
|
| 205 |
+
if group_name == "NH2":
|
| 206 |
+
for n in neighbors:
|
| 207 |
+
if n.GetAtomicNum() == 7 and n.GetDegree() == 1:
|
| 208 |
+
idx = n.GetIdx()
|
| 209 |
+
rw.RemoveAtom(idx)
|
| 210 |
+
try:
|
| 211 |
+
Chem.SanitizeMol(rw)
|
| 212 |
+
return rw, [idx]
|
| 213 |
+
except Exception:
|
| 214 |
+
return None, []
|
| 215 |
+
return None, []
|
| 216 |
+
|
| 217 |
+
if group_name == "CH3":
|
| 218 |
+
for n in neighbors:
|
| 219 |
+
if n.GetAtomicNum() == 6 and n.GetDegree() == 1 and n.GetTotalNumHs() == 3:
|
| 220 |
+
idx = n.GetIdx()
|
| 221 |
+
rw.RemoveAtom(idx)
|
| 222 |
+
try:
|
| 223 |
+
Chem.SanitizeMol(rw)
|
| 224 |
+
return rw, [idx]
|
| 225 |
+
except Exception:
|
| 226 |
+
return None, []
|
| 227 |
+
return None, []
|
| 228 |
+
|
| 229 |
+
return None, []
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
# ---------------------------------------------------------------------------
|
| 233 |
+
# 10. flip_chirality
|
| 234 |
+
# ---------------------------------------------------------------------------
|
| 235 |
+
@safe_apply
|
| 236 |
+
def flip_chirality(mol, atom_idx):
|
| 237 |
+
atom = mol.GetAtomWithIdx(atom_idx)
|
| 238 |
+
chi = atom.GetChiralTag()
|
| 239 |
+
if chi == Chem.ChiralType.CHI_TETRAHEDRAL_CW:
|
| 240 |
+
atom.SetChiralTag(Chem.ChiralType.CHI_TETRAHEDRAL_CCW)
|
| 241 |
+
elif chi == Chem.ChiralType.CHI_TETRAHEDRAL_CCW:
|
| 242 |
+
atom.SetChiralTag(Chem.ChiralType.CHI_TETRAHEDRAL_CW)
|
| 243 |
+
else:
|
| 244 |
+
return None
|
| 245 |
+
return mol
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
# ---------------------------------------------------------------------------
|
| 249 |
+
# 11. flip_ez — flip E/Z via SMILES-level slash inversion
|
| 250 |
+
# ---------------------------------------------------------------------------
|
| 251 |
+
def flip_ez(smiles):
|
| 252 |
+
"""Flip E/Z by inverting the first /-slash in the SMILES.
|
| 253 |
+
Works at the SMILES string level since RDKit mol-level stereo
|
| 254 |
+
doesn't round-trip reliably through MolToSmiles."""
|
| 255 |
+
if "/" not in smiles and "\\" not in smiles:
|
| 256 |
+
return None
|
| 257 |
+
chars = list(smiles)
|
| 258 |
+
for i, c in enumerate(chars):
|
| 259 |
+
if c == "/":
|
| 260 |
+
chars[i] = "\\"
|
| 261 |
+
break
|
| 262 |
+
elif c == "\\":
|
| 263 |
+
chars[i] = "/"
|
| 264 |
+
break
|
| 265 |
+
new_smi = "".join(chars)
|
| 266 |
+
mol = Chem.MolFromSmiles(new_smi)
|
| 267 |
+
if mol is None:
|
| 268 |
+
return None
|
| 269 |
+
return Chem.MolToSmiles(mol, isomericSmiles=True)
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
# ---------------------------------------------------------------------------
|
| 273 |
+
# Registry: maps operation type name → apply function
|
| 274 |
+
# ---------------------------------------------------------------------------
|
| 275 |
+
OP_REGISTRY = {
|
| 276 |
+
"change_atom_element": change_atom_element,
|
| 277 |
+
"add_atom": add_atom,
|
| 278 |
+
"remove_atom": remove_atom,
|
| 279 |
+
"change_charge": change_charge,
|
| 280 |
+
"change_bond_order": change_bond_order,
|
| 281 |
+
"add_bond": add_bond,
|
| 282 |
+
"remove_bond": remove_bond,
|
| 283 |
+
"add_functional_group": add_functional_group,
|
| 284 |
+
"remove_functional_group": lambda mol, **kw: remove_functional_group(mol, **kw)[0],
|
| 285 |
+
"flip_chirality": flip_chirality,
|
| 286 |
+
"flip_ez": flip_ez,
|
| 287 |
+
}
|
code/validate_with_executor.py
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Validate pubchem_dataset records using ActionExecutor.
|
| 3 |
+
|
| 4 |
+
Translates old-format operation dicts (raw atom_idx params) to the new
|
| 5 |
+
ActionExecutor JSON protocol, then checks that executing the action on
|
| 6 |
+
wrong_smiles reproduces correct_smiles.
|
| 7 |
+
|
| 8 |
+
Usage:
|
| 9 |
+
python validate_with_executor.py [--dataset ./data/pubchem_dataset] [--verbose]
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
import os, sys, json, argparse
|
| 13 |
+
from collections import Counter, defaultdict
|
| 14 |
+
sys.path.insert(0, os.path.dirname(__file__))
|
| 15 |
+
|
| 16 |
+
from rdkit import Chem, RDLogger
|
| 17 |
+
RDLogger.DisableLog("rdApp.*")
|
| 18 |
+
|
| 19 |
+
from action_executor import ActionExecutor, ActionError
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
# ---------------------------------------------------------------------------
|
| 23 |
+
# Old-format → ActionExecutor JSON translation
|
| 24 |
+
# ---------------------------------------------------------------------------
|
| 25 |
+
|
| 26 |
+
def translate_operation(op: dict) -> dict:
|
| 27 |
+
"""
|
| 28 |
+
Convert a mol_corrupt.py correction dict to an ActionExecutor action dict.
|
| 29 |
+
|
| 30 |
+
New format (atom_map / anchor_map / atom1_map / atom2_map) uses map_num refs.
|
| 31 |
+
Old format (atom_idx / anchor_idx / atom_idx1 / atom_idx2) uses idx refs.
|
| 32 |
+
Both are handled transparently.
|
| 33 |
+
"""
|
| 34 |
+
old_type = op["type"]
|
| 35 |
+
params = op.get("params", {})
|
| 36 |
+
|
| 37 |
+
# Determine ref style: map-num (new) or raw idx (old)
|
| 38 |
+
has_maps = any(k in params for k in ("atom_map", "anchor_map", "atom1_map", "atom2_map"))
|
| 39 |
+
|
| 40 |
+
def atom_ref(map_key, idx_key):
|
| 41 |
+
if has_maps and map_key in params:
|
| 42 |
+
return {"map_num": params[map_key]}
|
| 43 |
+
return {"idx": params[idx_key]}
|
| 44 |
+
|
| 45 |
+
def bond_ref(map1, idx1, map2, idx2):
|
| 46 |
+
return {"atom1": atom_ref(map1, idx1), "atom2": atom_ref(map2, idx2)}
|
| 47 |
+
|
| 48 |
+
if old_type == "change_atom_element":
|
| 49 |
+
return {
|
| 50 |
+
"type": "ChangeAtom",
|
| 51 |
+
"atom": atom_ref("atom_map", "atom_idx"),
|
| 52 |
+
"element": params["to_elem"],
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
if old_type == "change_charge":
|
| 56 |
+
return {
|
| 57 |
+
"type": "ChangeAtom",
|
| 58 |
+
"atom": atom_ref("atom_map", "atom_idx"),
|
| 59 |
+
"charge": params["to_charge"],
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
if old_type == "add_atom":
|
| 63 |
+
return {
|
| 64 |
+
"type": "AddAtom",
|
| 65 |
+
"anchor": atom_ref("anchor_map", "anchor_idx"),
|
| 66 |
+
"element": params["new_elem"],
|
| 67 |
+
"bond_order": params.get("bond_type", "SINGLE"),
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
if old_type == "remove_atom":
|
| 71 |
+
return {
|
| 72 |
+
"type": "RemoveAtom",
|
| 73 |
+
"atom": atom_ref("atom_map", "atom_idx"),
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
if old_type == "change_bond_order":
|
| 77 |
+
return {
|
| 78 |
+
"type": "ChangeBond",
|
| 79 |
+
"bond": bond_ref("atom1_map", "atom_idx1", "atom2_map", "atom_idx2"),
|
| 80 |
+
"order": params["to_order"],
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
if old_type == "add_bond":
|
| 84 |
+
return {
|
| 85 |
+
"type": "AddBond",
|
| 86 |
+
"bond": bond_ref("atom1_map", "atom_idx1", "atom2_map", "atom_idx2"),
|
| 87 |
+
"order": params.get("bond_type", "SINGLE"),
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
if old_type == "remove_bond":
|
| 91 |
+
return {
|
| 92 |
+
"type": "RemoveBond",
|
| 93 |
+
"bond": bond_ref("atom1_map", "atom_idx1", "atom2_map", "atom_idx2"),
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
if old_type == "add_functional_group":
|
| 97 |
+
return {
|
| 98 |
+
"type": "AddGroup",
|
| 99 |
+
"anchor": atom_ref("anchor_map", "anchor_idx"),
|
| 100 |
+
"group": params["group_name"],
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
if old_type == "remove_functional_group":
|
| 104 |
+
return {
|
| 105 |
+
"type": "RemoveGroup",
|
| 106 |
+
"anchor": atom_ref("anchor_map", "anchor_idx"),
|
| 107 |
+
"group": params["group_name"],
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
if old_type == "flip_chirality":
|
| 111 |
+
return {
|
| 112 |
+
"type": "FlipChirality",
|
| 113 |
+
"atom": atom_ref("atom_map", "atom_idx"),
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
if old_type == "flip_ez":
|
| 117 |
+
# SMILES-level op — find the double bond automatically
|
| 118 |
+
return {"type": "FlipEZ"}
|
| 119 |
+
|
| 120 |
+
if old_type == "move_substituent":
|
| 121 |
+
return {
|
| 122 |
+
"type": "MoveSubstituent",
|
| 123 |
+
"substituent": {"map_num": params["substituent_map"]},
|
| 124 |
+
"from_atom": {"map_num": params["from_map"]},
|
| 125 |
+
"to_atom": {"map_num": params["to_map"]},
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
if old_type == "swap_substituents":
|
| 129 |
+
return {
|
| 130 |
+
"type": "SwapSubstituents",
|
| 131 |
+
"atom1": {"map_num": params["ring1_map"]},
|
| 132 |
+
"atom2": {"map_num": params["ring2_map"]},
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
raise ValueError(f"Unhandled old type: {old_type!r}")
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
# ---------------------------------------------------------------------------
|
| 139 |
+
# Validation
|
| 140 |
+
# ---------------------------------------------------------------------------
|
| 141 |
+
|
| 142 |
+
def validate(records, verbose=False):
|
| 143 |
+
ex = ActionExecutor()
|
| 144 |
+
results = defaultdict(lambda: {"pass": 0, "fail": 0, "error": 0})
|
| 145 |
+
failures = []
|
| 146 |
+
|
| 147 |
+
for r in records:
|
| 148 |
+
op_type = r["operation"]["type"]
|
| 149 |
+
# Prefer mapped SMILES (new format) so map_num refs work correctly
|
| 150 |
+
wrong = r.get("wrong_smiles_mapped") or r.get("wrong_smiles", "")
|
| 151 |
+
correct = r["correct_smiles"]
|
| 152 |
+
|
| 153 |
+
try:
|
| 154 |
+
action = translate_operation(r["operation"])
|
| 155 |
+
except Exception as e:
|
| 156 |
+
results[op_type]["error"] += 1
|
| 157 |
+
failures.append({"id": r.get("id"), "op": op_type, "kind": "translate_error", "msg": str(e)})
|
| 158 |
+
continue
|
| 159 |
+
|
| 160 |
+
try:
|
| 161 |
+
restored = ex.execute(wrong, action)
|
| 162 |
+
except ActionError as e:
|
| 163 |
+
results[op_type]["error"] += 1
|
| 164 |
+
failures.append({
|
| 165 |
+
"id": r.get("id"), "op": op_type, "kind": "executor_error",
|
| 166 |
+
"msg": str(e), "wrong": wrong, "action": action,
|
| 167 |
+
})
|
| 168 |
+
continue
|
| 169 |
+
except Exception as e:
|
| 170 |
+
results[op_type]["error"] += 1
|
| 171 |
+
failures.append({
|
| 172 |
+
"id": r.get("id"), "op": op_type, "kind": "unexpected_error",
|
| 173 |
+
"msg": str(e), "wrong": wrong,
|
| 174 |
+
})
|
| 175 |
+
continue
|
| 176 |
+
|
| 177 |
+
# Canonicalize both for fair comparison
|
| 178 |
+
mol_r = Chem.MolFromSmiles(restored) if restored else None
|
| 179 |
+
mol_c = Chem.MolFromSmiles(correct)
|
| 180 |
+
canon_r = Chem.MolToSmiles(mol_r) if mol_r else None
|
| 181 |
+
canon_c = Chem.MolToSmiles(mol_c) if mol_c else None
|
| 182 |
+
|
| 183 |
+
if canon_r == canon_c:
|
| 184 |
+
results[op_type]["pass"] += 1
|
| 185 |
+
else:
|
| 186 |
+
results[op_type]["fail"] += 1
|
| 187 |
+
failures.append({
|
| 188 |
+
"id": r.get("id"), "op": op_type, "kind": "mismatch",
|
| 189 |
+
"wrong": wrong, "expected": correct, "got": restored,
|
| 190 |
+
"action": action,
|
| 191 |
+
})
|
| 192 |
+
|
| 193 |
+
return results, failures
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
# ---------------------------------------------------------------------------
|
| 197 |
+
# Report
|
| 198 |
+
# ---------------------------------------------------------------------------
|
| 199 |
+
|
| 200 |
+
def report(results, failures, verbose=False):
|
| 201 |
+
print("=" * 76)
|
| 202 |
+
print(f"{'Op Type':<35} {'Total':>6} {'Pass':>5} {'Fail':>5} {'Error':>6} {'Rate':>6}")
|
| 203 |
+
print("-" * 76)
|
| 204 |
+
|
| 205 |
+
total_p = total_f = total_e = 0
|
| 206 |
+
for op in sorted(results):
|
| 207 |
+
r = results[op]
|
| 208 |
+
p, f, e = r["pass"], r["fail"], r["error"]
|
| 209 |
+
n = p + f + e
|
| 210 |
+
rate = p / n * 100 if n else 0
|
| 211 |
+
mark = "" if (f + e) == 0 else " ✗"
|
| 212 |
+
print(f"{op:<35} {n:>6} {p:>5} {f:>5} {e:>6} {rate:>5.0f}%{mark}")
|
| 213 |
+
total_p += p; total_f += f; total_e += e
|
| 214 |
+
|
| 215 |
+
total = total_p + total_f + total_e
|
| 216 |
+
print("-" * 76)
|
| 217 |
+
rate = total_p / total * 100 if total else 0
|
| 218 |
+
print(f"{'TOTAL':<35} {total:>6} {total_p:>5} {total_f:>5} {total_e:>6} {rate:>5.0f}%")
|
| 219 |
+
print("=" * 76)
|
| 220 |
+
|
| 221 |
+
if failures:
|
| 222 |
+
show = failures if verbose else failures[:5]
|
| 223 |
+
print(f"\n--- {len(failures)} failure(s){' (showing first 5)' if not verbose and len(failures) > 5 else ''} ---")
|
| 224 |
+
for fl in show:
|
| 225 |
+
print(f"\n [{fl['op']}] id={fl.get('id')} kind={fl['kind']}")
|
| 226 |
+
if fl["kind"] == "mismatch":
|
| 227 |
+
print(f" wrong : {fl['wrong']}")
|
| 228 |
+
print(f" action : {fl['action']}")
|
| 229 |
+
print(f" expected : {fl['expected']}")
|
| 230 |
+
print(f" got : {fl['got']}")
|
| 231 |
+
elif fl["kind"] in ("executor_error", "translate_error", "unexpected_error"):
|
| 232 |
+
print(f" wrong : {fl.get('wrong', '')}")
|
| 233 |
+
print(f" action : {fl.get('action', '')}")
|
| 234 |
+
print(f" error : {fl['msg']}")
|
| 235 |
+
else:
|
| 236 |
+
print("\n✓ All records pass validation.")
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
def main():
|
| 240 |
+
parser = argparse.ArgumentParser()
|
| 241 |
+
parser.add_argument("--dataset", default="./data/pubchem_dataset")
|
| 242 |
+
parser.add_argument("--verbose", action="store_true", help="Show all failures")
|
| 243 |
+
args = parser.parse_args()
|
| 244 |
+
|
| 245 |
+
for name in ("dataset.json", "roundtrip_test.json"):
|
| 246 |
+
p = os.path.join(args.dataset, name)
|
| 247 |
+
if os.path.exists(p):
|
| 248 |
+
json_path = p
|
| 249 |
+
break
|
| 250 |
+
else:
|
| 251 |
+
print(f"No dataset JSON found in {args.dataset}")
|
| 252 |
+
sys.exit(1)
|
| 253 |
+
|
| 254 |
+
with open(json_path) as f:
|
| 255 |
+
records = json.load(f)
|
| 256 |
+
print(f"Loaded {len(records)} records from {json_path}\n")
|
| 257 |
+
|
| 258 |
+
results, failures = validate(records, verbose=args.verbose)
|
| 259 |
+
report(results, failures, verbose=args.verbose)
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
if __name__ == "__main__":
|
| 263 |
+
main()
|
data/benchmark_results_claude_opus46.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/benchmark_results_gemini3.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/benchmark_results_gemini31.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/benchmark_results_gpt54.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/benchmark_results_gpt55.json
ADDED
|
@@ -0,0 +1,1901 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"id": "000005",
|
| 4 |
+
"op_type": "remove_functional_group",
|
| 5 |
+
"image_path": "images/000005.png",
|
| 6 |
+
"wrong_smiles_mapped": "[CH3:1][C:2]([CH3:3])([CH3:4])[c:5]1[cH:6][c:7]([F:13])[c:8]([OH:9])[c:10]([OH:11])[cH:12]1",
|
| 7 |
+
"correct_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 8 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":13}}",
|
| 9 |
+
"predicted_action": {
|
| 10 |
+
"type": "RemoveAtom",
|
| 11 |
+
"atom": {
|
| 12 |
+
"map_num": 13
|
| 13 |
+
}
|
| 14 |
+
},
|
| 15 |
+
"restored_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 16 |
+
"exec_match": true,
|
| 17 |
+
"type_match": false,
|
| 18 |
+
"parse_error": false,
|
| 19 |
+
"exec_error": null
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"id": "000004",
|
| 23 |
+
"op_type": "add_bond",
|
| 24 |
+
"image_path": "images/000004.png",
|
| 25 |
+
"wrong_smiles_mapped": "[CH3:1][C:2]([CH3:3])([CH3:4])[c:5]1[cH:6][cH:7][c:8]([OH:9])[cH:10][cH:12]1.[OH2:11]",
|
| 26 |
+
"correct_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 27 |
+
"predicted_raw": "{\"type\":\"AddBond\",\"bond\":{\"atom1\":{\"map_num\":10},\"atom2\":{\"map_num\":11}},\"order\":\"SINGLE\"}",
|
| 28 |
+
"predicted_action": {
|
| 29 |
+
"type": "AddBond",
|
| 30 |
+
"bond": {
|
| 31 |
+
"atom1": {
|
| 32 |
+
"map_num": 10
|
| 33 |
+
},
|
| 34 |
+
"atom2": {
|
| 35 |
+
"map_num": 11
|
| 36 |
+
}
|
| 37 |
+
},
|
| 38 |
+
"order": "SINGLE"
|
| 39 |
+
},
|
| 40 |
+
"restored_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 41 |
+
"exec_match": true,
|
| 42 |
+
"type_match": true,
|
| 43 |
+
"parse_error": false,
|
| 44 |
+
"exec_error": null
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"id": "000006",
|
| 48 |
+
"op_type": "add_functional_group",
|
| 49 |
+
"image_path": "images/000006.png",
|
| 50 |
+
"wrong_smiles_mapped": "[CH3:1][C:2]([CH3:3])([CH3:4])[c:5]1[cH:6][cH:7][cH:8][c:9]([OH:10])[cH:11]1",
|
| 51 |
+
"correct_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 52 |
+
"predicted_raw": "{\"type\":\"AddGroup\",\"anchor\":{\"map_num\":8},\"group\":\"OH\"}",
|
| 53 |
+
"predicted_action": {
|
| 54 |
+
"type": "AddGroup",
|
| 55 |
+
"anchor": {
|
| 56 |
+
"map_num": 8
|
| 57 |
+
},
|
| 58 |
+
"group": "OH"
|
| 59 |
+
},
|
| 60 |
+
"restored_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 61 |
+
"exec_match": true,
|
| 62 |
+
"type_match": true,
|
| 63 |
+
"parse_error": false,
|
| 64 |
+
"exec_error": null
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"id": "000003",
|
| 68 |
+
"op_type": "remove_bond",
|
| 69 |
+
"image_path": "images/000003.png",
|
| 70 |
+
"wrong_smiles_mapped": "[CH3:1][C:2]1([CH3:4])[CH2:3][O:9][c:8]2[cH:7][cH:6][c:5]1[cH:12][c:10]2[OH:11]",
|
| 71 |
+
"correct_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 72 |
+
"predicted_raw": "{\"type\":\"RemoveBond\",\"bond\":{\"atom1\":{\"map_num\":3},\"atom2\":{\"map_num\":9}}}",
|
| 73 |
+
"predicted_action": {
|
| 74 |
+
"type": "RemoveBond",
|
| 75 |
+
"bond": {
|
| 76 |
+
"atom1": {
|
| 77 |
+
"map_num": 3
|
| 78 |
+
},
|
| 79 |
+
"atom2": {
|
| 80 |
+
"map_num": 9
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
"restored_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 85 |
+
"exec_match": true,
|
| 86 |
+
"type_match": true,
|
| 87 |
+
"parse_error": false,
|
| 88 |
+
"exec_error": null
|
| 89 |
+
},
|
| 90 |
+
{
|
| 91 |
+
"id": "000002",
|
| 92 |
+
"op_type": "add_atom",
|
| 93 |
+
"image_path": "images/000002.png",
|
| 94 |
+
"wrong_smiles_mapped": "[CH:1]([CH3:2])([CH3:3])[c:4]1[cH:5][cH:6][c:7]([OH:8])[c:9]([OH:10])[cH:11]1",
|
| 95 |
+
"correct_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 96 |
+
"predicted_raw": "{\"type\":\"AddGroup\",\"anchor\":{\"map_num\":1},\"group\":\"CH3\"}",
|
| 97 |
+
"predicted_action": {
|
| 98 |
+
"type": "AddGroup",
|
| 99 |
+
"anchor": {
|
| 100 |
+
"map_num": 1
|
| 101 |
+
},
|
| 102 |
+
"group": "CH3"
|
| 103 |
+
},
|
| 104 |
+
"restored_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 105 |
+
"exec_match": true,
|
| 106 |
+
"type_match": false,
|
| 107 |
+
"parse_error": false,
|
| 108 |
+
"exec_error": null
|
| 109 |
+
},
|
| 110 |
+
{
|
| 111 |
+
"id": "000007",
|
| 112 |
+
"op_type": "move_substituent",
|
| 113 |
+
"image_path": "images/000007.png",
|
| 114 |
+
"wrong_smiles_mapped": "[CH3:1][C:2]([CH3:3])([CH3:4])[c:7]1[cH:6][cH:5][cH:12][c:10]([OH:11])[c:8]1[OH:9]",
|
| 115 |
+
"correct_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 116 |
+
"predicted_raw": "",
|
| 117 |
+
"predicted_action": null,
|
| 118 |
+
"restored_smiles": null,
|
| 119 |
+
"exec_match": false,
|
| 120 |
+
"type_match": false,
|
| 121 |
+
"parse_error": true,
|
| 122 |
+
"exec_error": null
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"id": "000012",
|
| 126 |
+
"op_type": "change_charge",
|
| 127 |
+
"image_path": "images/000012.png",
|
| 128 |
+
"wrong_smiles_mapped": "[NH2:1][CH:2]([CH2:3][c:4]1[cH:5][cH:6][cH:7][c:8]([OH:9])[cH:10]1)[C:11](=[OH+:12])[OH:13]",
|
| 129 |
+
"correct_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 130 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":12},\"element\":\"O\",\"charge\":0}",
|
| 131 |
+
"predicted_action": {
|
| 132 |
+
"type": "ChangeAtom",
|
| 133 |
+
"atom": {
|
| 134 |
+
"map_num": 12
|
| 135 |
+
},
|
| 136 |
+
"element": "O",
|
| 137 |
+
"charge": 0
|
| 138 |
+
},
|
| 139 |
+
"restored_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 140 |
+
"exec_match": true,
|
| 141 |
+
"type_match": true,
|
| 142 |
+
"parse_error": false,
|
| 143 |
+
"exec_error": null
|
| 144 |
+
},
|
| 145 |
+
{
|
| 146 |
+
"id": "000010",
|
| 147 |
+
"op_type": "remove_atom",
|
| 148 |
+
"image_path": "images/000010.png",
|
| 149 |
+
"wrong_smiles_mapped": "[NH2:1][CH:2]([CH2:3][c:4]1[cH:5][cH:6][cH:7][c:8]([O:9][NH2:14])[cH:10]1)[C:11](=[O:12])[OH:13]",
|
| 150 |
+
"correct_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 151 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":14}}",
|
| 152 |
+
"predicted_action": {
|
| 153 |
+
"type": "RemoveAtom",
|
| 154 |
+
"atom": {
|
| 155 |
+
"map_num": 14
|
| 156 |
+
}
|
| 157 |
+
},
|
| 158 |
+
"restored_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 159 |
+
"exec_match": true,
|
| 160 |
+
"type_match": true,
|
| 161 |
+
"parse_error": false,
|
| 162 |
+
"exec_error": null
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"id": "000009",
|
| 166 |
+
"op_type": "change_atom_element",
|
| 167 |
+
"image_path": "images/000009.png",
|
| 168 |
+
"wrong_smiles_mapped": "[NH2:1][N:2]([CH2:3][c:4]1[cH:5][cH:6][cH:7][c:8]([OH:9])[cH:10]1)[C:11](=[O:12])[OH:13]",
|
| 169 |
+
"correct_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 170 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":2},\"element\":\"C\",\"charge\":0}",
|
| 171 |
+
"predicted_action": {
|
| 172 |
+
"type": "ChangeAtom",
|
| 173 |
+
"atom": {
|
| 174 |
+
"map_num": 2
|
| 175 |
+
},
|
| 176 |
+
"element": "C",
|
| 177 |
+
"charge": 0
|
| 178 |
+
},
|
| 179 |
+
"restored_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 180 |
+
"exec_match": true,
|
| 181 |
+
"type_match": true,
|
| 182 |
+
"parse_error": false,
|
| 183 |
+
"exec_error": null
|
| 184 |
+
},
|
| 185 |
+
{
|
| 186 |
+
"id": "000001",
|
| 187 |
+
"op_type": "remove_atom",
|
| 188 |
+
"image_path": "images/000001.png",
|
| 189 |
+
"wrong_smiles_mapped": "[CH3:1][C:2]([CH3:3])([CH3:4])[c:5]1[cH:6][cH:7][c:8]([OH:9])[c:10]([O:11][CH3:13])[cH:12]1",
|
| 190 |
+
"correct_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 191 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":13}}",
|
| 192 |
+
"predicted_action": {
|
| 193 |
+
"type": "RemoveAtom",
|
| 194 |
+
"atom": {
|
| 195 |
+
"map_num": 13
|
| 196 |
+
}
|
| 197 |
+
},
|
| 198 |
+
"restored_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 199 |
+
"exec_match": true,
|
| 200 |
+
"type_match": true,
|
| 201 |
+
"parse_error": false,
|
| 202 |
+
"exec_error": null
|
| 203 |
+
},
|
| 204 |
+
{
|
| 205 |
+
"id": "000000",
|
| 206 |
+
"op_type": "change_atom_element",
|
| 207 |
+
"image_path": "images/000000.png",
|
| 208 |
+
"wrong_smiles_mapped": "[CH3:1][C:2]([SH:3])([CH3:4])[c:5]1[cH:6][cH:7][c:8]([OH:9])[c:10]([OH:11])[cH:12]1",
|
| 209 |
+
"correct_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 210 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":3},\"element\":\"C\",\"charge\":0}",
|
| 211 |
+
"predicted_action": {
|
| 212 |
+
"type": "ChangeAtom",
|
| 213 |
+
"atom": {
|
| 214 |
+
"map_num": 3
|
| 215 |
+
},
|
| 216 |
+
"element": "C",
|
| 217 |
+
"charge": 0
|
| 218 |
+
},
|
| 219 |
+
"restored_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 220 |
+
"exec_match": true,
|
| 221 |
+
"type_match": true,
|
| 222 |
+
"parse_error": false,
|
| 223 |
+
"exec_error": null
|
| 224 |
+
},
|
| 225 |
+
{
|
| 226 |
+
"id": "000011",
|
| 227 |
+
"op_type": "add_atom",
|
| 228 |
+
"image_path": "images/000011.png",
|
| 229 |
+
"wrong_smiles_mapped": "[NH2:1][CH:2]([CH2:3][c:4]1[cH:5][cH:6][cH:7][c:8]([OH:9])[cH:10]1)[CH:11]=[O:12]",
|
| 230 |
+
"correct_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 231 |
+
"predicted_raw": "{\"type\":\"AddGroup\",\"anchor\":{\"map_num\":11},\"group\":\"OH\"}",
|
| 232 |
+
"predicted_action": {
|
| 233 |
+
"type": "AddGroup",
|
| 234 |
+
"anchor": {
|
| 235 |
+
"map_num": 11
|
| 236 |
+
},
|
| 237 |
+
"group": "OH"
|
| 238 |
+
},
|
| 239 |
+
"restored_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 240 |
+
"exec_match": true,
|
| 241 |
+
"type_match": false,
|
| 242 |
+
"parse_error": false,
|
| 243 |
+
"exec_error": null
|
| 244 |
+
},
|
| 245 |
+
{
|
| 246 |
+
"id": "000008",
|
| 247 |
+
"op_type": "swap_substituents",
|
| 248 |
+
"image_path": "images/000008.png",
|
| 249 |
+
"wrong_smiles_mapped": "[CH3:1][C:2]([CH3:3])([CH3:4])[c:10]1[c:8]([OH:9])[cH:7][cH:6][c:5]([OH:11])[cH:12]1",
|
| 250 |
+
"correct_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 251 |
+
"predicted_raw": "{\"type\":\"MoveSubstituent\",\"substituent\":{\"map_num\":9},\"from_atom\":{\"map_num\":8},\"to_atom\":{\"map_num\":6}}",
|
| 252 |
+
"predicted_action": {
|
| 253 |
+
"type": "MoveSubstituent",
|
| 254 |
+
"substituent": {
|
| 255 |
+
"map_num": 9
|
| 256 |
+
},
|
| 257 |
+
"from_atom": {
|
| 258 |
+
"map_num": 8
|
| 259 |
+
},
|
| 260 |
+
"to_atom": {
|
| 261 |
+
"map_num": 6
|
| 262 |
+
}
|
| 263 |
+
},
|
| 264 |
+
"restored_smiles": "CC(C)(C)c1ccc(O)c(O)c1",
|
| 265 |
+
"exec_match": true,
|
| 266 |
+
"type_match": false,
|
| 267 |
+
"parse_error": false,
|
| 268 |
+
"exec_error": null
|
| 269 |
+
},
|
| 270 |
+
{
|
| 271 |
+
"id": "000014",
|
| 272 |
+
"op_type": "remove_bond",
|
| 273 |
+
"image_path": "images/000014.png",
|
| 274 |
+
"wrong_smiles_mapped": "[NH2:1][CH:2]([CH2:3][c:4]1[cH:5][cH:6][c:7]2[c:8]([cH:10]1)[O:9]2)[C:11](=[O:12])[OH:13]",
|
| 275 |
+
"correct_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 276 |
+
"predicted_raw": "{\"type\":\"RemoveBond\",\"bond\":{\"atom1\":{\"map_num\":8},\"atom2\":{\"map_num\":9}}}",
|
| 277 |
+
"predicted_action": {
|
| 278 |
+
"type": "RemoveBond",
|
| 279 |
+
"bond": {
|
| 280 |
+
"atom1": {
|
| 281 |
+
"map_num": 8
|
| 282 |
+
},
|
| 283 |
+
"atom2": {
|
| 284 |
+
"map_num": 9
|
| 285 |
+
}
|
| 286 |
+
}
|
| 287 |
+
},
|
| 288 |
+
"restored_smiles": "NC(Cc1ccc(O)cc1)C(=O)O",
|
| 289 |
+
"exec_match": false,
|
| 290 |
+
"type_match": true,
|
| 291 |
+
"parse_error": false,
|
| 292 |
+
"exec_error": null
|
| 293 |
+
},
|
| 294 |
+
{
|
| 295 |
+
"id": "000015",
|
| 296 |
+
"op_type": "add_bond",
|
| 297 |
+
"image_path": "images/000015.png",
|
| 298 |
+
"wrong_smiles_mapped": "[NH2:1][CH:2]([CH2:3][c:4]1[cH:5][cH:6][cH:7][c:8]([OH:9])[cH:10]1)[CH:11]=[O:12].[OH2:13]",
|
| 299 |
+
"correct_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 300 |
+
"predicted_raw": "{\"type\":\"AddBond\",\"bond\":{\"atom1\":{\"map_num\":11},\"atom2\":{\"map_num\":13}},\"order\":\"SINGLE\"}",
|
| 301 |
+
"predicted_action": {
|
| 302 |
+
"type": "AddBond",
|
| 303 |
+
"bond": {
|
| 304 |
+
"atom1": {
|
| 305 |
+
"map_num": 11
|
| 306 |
+
},
|
| 307 |
+
"atom2": {
|
| 308 |
+
"map_num": 13
|
| 309 |
+
}
|
| 310 |
+
},
|
| 311 |
+
"order": "SINGLE"
|
| 312 |
+
},
|
| 313 |
+
"restored_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 314 |
+
"exec_match": true,
|
| 315 |
+
"type_match": true,
|
| 316 |
+
"parse_error": false,
|
| 317 |
+
"exec_error": null
|
| 318 |
+
},
|
| 319 |
+
{
|
| 320 |
+
"id": "000013",
|
| 321 |
+
"op_type": "change_bond_order",
|
| 322 |
+
"image_path": "images/000013.png",
|
| 323 |
+
"wrong_smiles_mapped": "[NH:1]=[C:2]([CH2:3][c:4]1[cH:5][cH:6][cH:7][c:8]([OH:9])[cH:10]1)[C:11](=[O:12])[OH:13]",
|
| 324 |
+
"correct_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 325 |
+
"predicted_raw": "{\"type\":\"ChangeBond\",\"bond\":{\"atom1\":{\"map_num\":1},\"atom2\":{\"map_num\":2}},\"order\":\"SINGLE\"}",
|
| 326 |
+
"predicted_action": {
|
| 327 |
+
"type": "ChangeBond",
|
| 328 |
+
"bond": {
|
| 329 |
+
"atom1": {
|
| 330 |
+
"map_num": 1
|
| 331 |
+
},
|
| 332 |
+
"atom2": {
|
| 333 |
+
"map_num": 2
|
| 334 |
+
}
|
| 335 |
+
},
|
| 336 |
+
"order": "SINGLE"
|
| 337 |
+
},
|
| 338 |
+
"restored_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 339 |
+
"exec_match": true,
|
| 340 |
+
"type_match": true,
|
| 341 |
+
"parse_error": false,
|
| 342 |
+
"exec_error": null
|
| 343 |
+
},
|
| 344 |
+
{
|
| 345 |
+
"id": "000019",
|
| 346 |
+
"op_type": "change_atom_element",
|
| 347 |
+
"image_path": "images/000019.png",
|
| 348 |
+
"wrong_smiles_mapped": "[CH3:1][c:2]1[cH:3][cH:4][c:5]2[cH:6][c:7]3[c:8]([cH:9][cH:10][c:11]4[cH:12][c:13]([SH:14])[cH:15][cH:16][c:17]34)[cH:18][c:19]2[cH:20]1",
|
| 349 |
+
"correct_smiles": "Cc1ccc2cc3c(ccc4cc(C)ccc43)cc2c1",
|
| 350 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":14},\"element\":\"C\",\"charge\":0}",
|
| 351 |
+
"predicted_action": {
|
| 352 |
+
"type": "ChangeAtom",
|
| 353 |
+
"atom": {
|
| 354 |
+
"map_num": 14
|
| 355 |
+
},
|
| 356 |
+
"element": "C",
|
| 357 |
+
"charge": 0
|
| 358 |
+
},
|
| 359 |
+
"restored_smiles": "Cc1ccc2cc3c(ccc4cc(C)ccc43)cc2c1",
|
| 360 |
+
"exec_match": true,
|
| 361 |
+
"type_match": true,
|
| 362 |
+
"parse_error": false,
|
| 363 |
+
"exec_error": null
|
| 364 |
+
},
|
| 365 |
+
{
|
| 366 |
+
"id": "000017",
|
| 367 |
+
"op_type": "add_functional_group",
|
| 368 |
+
"image_path": "images/000017.png",
|
| 369 |
+
"wrong_smiles_mapped": "[NH2:1][CH:2]([CH2:3][c:4]1[cH:5][cH:6][cH:7][cH:8][cH:9]1)[C:10](=[O:11])[OH:12]",
|
| 370 |
+
"correct_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 371 |
+
"predicted_raw": "{\"type\":\"AddGroup\",\"anchor\":{\"map_num\":7},\"group\":\"OH\"}",
|
| 372 |
+
"predicted_action": {
|
| 373 |
+
"type": "AddGroup",
|
| 374 |
+
"anchor": {
|
| 375 |
+
"map_num": 7
|
| 376 |
+
},
|
| 377 |
+
"group": "OH"
|
| 378 |
+
},
|
| 379 |
+
"restored_smiles": "NC(Cc1ccc(O)cc1)C(=O)O",
|
| 380 |
+
"exec_match": false,
|
| 381 |
+
"type_match": true,
|
| 382 |
+
"parse_error": false,
|
| 383 |
+
"exec_error": null
|
| 384 |
+
},
|
| 385 |
+
{
|
| 386 |
+
"id": "000016",
|
| 387 |
+
"op_type": "remove_functional_group",
|
| 388 |
+
"image_path": "images/000016.png",
|
| 389 |
+
"wrong_smiles_mapped": "[NH2:1][CH:2]([CH2:3][c:4]1[cH:5][cH:6][c:7]([F:14])[c:8]([OH:9])[cH:10]1)[C:11](=[O:12])[OH:13]",
|
| 390 |
+
"correct_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 391 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":14}}",
|
| 392 |
+
"predicted_action": {
|
| 393 |
+
"type": "RemoveAtom",
|
| 394 |
+
"atom": {
|
| 395 |
+
"map_num": 14
|
| 396 |
+
}
|
| 397 |
+
},
|
| 398 |
+
"restored_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 399 |
+
"exec_match": true,
|
| 400 |
+
"type_match": false,
|
| 401 |
+
"parse_error": false,
|
| 402 |
+
"exec_error": null
|
| 403 |
+
},
|
| 404 |
+
{
|
| 405 |
+
"id": "000018",
|
| 406 |
+
"op_type": "move_substituent",
|
| 407 |
+
"image_path": "images/000018.png",
|
| 408 |
+
"wrong_smiles_mapped": "[NH2:1][CH:2]([CH2:3][c:4]1[cH:5][cH:6][cH:7][cH:8][c:10]1[OH:9])[C:11](=[O:12])[OH:13]",
|
| 409 |
+
"correct_smiles": "NC(Cc1cccc(O)c1)C(=O)O",
|
| 410 |
+
"predicted_raw": "{\"type\":\"MoveSubstituent\",\"substituent\":{\"map_num\":9},\"from_atom\":{\"map_num\":10},\"to_atom\":{\"map_num\":7}}",
|
| 411 |
+
"predicted_action": {
|
| 412 |
+
"type": "MoveSubstituent",
|
| 413 |
+
"substituent": {
|
| 414 |
+
"map_num": 9
|
| 415 |
+
},
|
| 416 |
+
"from_atom": {
|
| 417 |
+
"map_num": 10
|
| 418 |
+
},
|
| 419 |
+
"to_atom": {
|
| 420 |
+
"map_num": 7
|
| 421 |
+
}
|
| 422 |
+
},
|
| 423 |
+
"restored_smiles": "NC(Cc1ccc(O)cc1)C(=O)O",
|
| 424 |
+
"exec_match": false,
|
| 425 |
+
"type_match": true,
|
| 426 |
+
"parse_error": false,
|
| 427 |
+
"exec_error": null
|
| 428 |
+
},
|
| 429 |
+
{
|
| 430 |
+
"id": "000023",
|
| 431 |
+
"op_type": "add_bond",
|
| 432 |
+
"image_path": "images/000023.png",
|
| 433 |
+
"wrong_smiles_mapped": "[CH4:1].[cH:2]1[cH:3][cH:4][c:5]2[cH:6][c:7]3[c:8]([cH:9][cH:10][c:11]4[cH:12][c:13]([CH3:14])[cH:15][cH:16][c:17]34)[cH:18][c:19]2[cH:20]1",
|
| 434 |
+
"correct_smiles": "Cc1ccc2cc3c(ccc4cc(C)ccc43)cc2c1",
|
| 435 |
+
"predicted_raw": "{\"type\":\"AddBond\",\"bond\":{\"atom1\":{\"map_num\":1},\"atom2\":{\"map_num\":2}},\"order\":\"SINGLE\"}",
|
| 436 |
+
"predicted_action": {
|
| 437 |
+
"type": "AddBond",
|
| 438 |
+
"bond": {
|
| 439 |
+
"atom1": {
|
| 440 |
+
"map_num": 1
|
| 441 |
+
},
|
| 442 |
+
"atom2": {
|
| 443 |
+
"map_num": 2
|
| 444 |
+
}
|
| 445 |
+
},
|
| 446 |
+
"order": "SINGLE"
|
| 447 |
+
},
|
| 448 |
+
"restored_smiles": "Cc1ccc2cc3c(ccc4cc(C)ccc43)cc2c1",
|
| 449 |
+
"exec_match": true,
|
| 450 |
+
"type_match": true,
|
| 451 |
+
"parse_error": false,
|
| 452 |
+
"exec_error": null
|
| 453 |
+
},
|
| 454 |
+
{
|
| 455 |
+
"id": "000024",
|
| 456 |
+
"op_type": "remove_functional_group",
|
| 457 |
+
"image_path": "images/000024.png",
|
| 458 |
+
"wrong_smiles_mapped": "[CH3:1][c:2]1[cH:3][cH:4][c:5]2[c:6]([CH3:21])[c:7]3[c:8]([cH:9][cH:10][c:11]4[cH:12][c:13]([CH3:14])[cH:15][cH:16][c:17]34)[cH:18][c:19]2[cH:20]1",
|
| 459 |
+
"correct_smiles": "Cc1ccc2cc3c(ccc4cc(C)ccc43)cc2c1",
|
| 460 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":21}}",
|
| 461 |
+
"predicted_action": {
|
| 462 |
+
"type": "RemoveAtom",
|
| 463 |
+
"atom": {
|
| 464 |
+
"map_num": 21
|
| 465 |
+
}
|
| 466 |
+
},
|
| 467 |
+
"restored_smiles": "Cc1ccc2cc3c(ccc4cc(C)ccc43)cc2c1",
|
| 468 |
+
"exec_match": true,
|
| 469 |
+
"type_match": false,
|
| 470 |
+
"parse_error": false,
|
| 471 |
+
"exec_error": null
|
| 472 |
+
},
|
| 473 |
+
{
|
| 474 |
+
"id": "000022",
|
| 475 |
+
"op_type": "remove_bond",
|
| 476 |
+
"image_path": "images/000022.png",
|
| 477 |
+
"wrong_smiles_mapped": "[CH3:1][c:2]1[cH:3][c:4]2[c:5]3[c:6]-2[c:7]2[c:8]([cH:9][cH:10][c:11]4[cH:12][c:13]([CH3:14])[cH:15][cH:16][c:17]24)[cH:18][c:19]3[cH:20]1",
|
| 478 |
+
"correct_smiles": "Cc1ccc2cc3c(ccc4cc(C)ccc43)cc2c1",
|
| 479 |
+
"predicted_raw": "",
|
| 480 |
+
"predicted_action": null,
|
| 481 |
+
"restored_smiles": null,
|
| 482 |
+
"exec_match": false,
|
| 483 |
+
"type_match": false,
|
| 484 |
+
"parse_error": true,
|
| 485 |
+
"exec_error": null
|
| 486 |
+
},
|
| 487 |
+
{
|
| 488 |
+
"id": "000020",
|
| 489 |
+
"op_type": "remove_atom",
|
| 490 |
+
"image_path": "images/000020.png",
|
| 491 |
+
"wrong_smiles_mapped": "[CH3:1][c:2]1[cH:3][cH:4][c:5]2[cH:6][c:7]3[c:8]([cH:9][cH:10][c:11]4[cH:12][c:13]([CH2:14][OH:21])[cH:15][cH:16][c:17]34)[cH:18][c:19]2[cH:20]1",
|
| 492 |
+
"correct_smiles": "Cc1ccc2cc3c(ccc4cc(C)ccc43)cc2c1",
|
| 493 |
+
"predicted_raw": "{\"type\":\"RemoveGroup\",\"anchor\":{\"map_num\":14},\"group\":\"OH\"}",
|
| 494 |
+
"predicted_action": {
|
| 495 |
+
"type": "RemoveGroup",
|
| 496 |
+
"anchor": {
|
| 497 |
+
"map_num": 14
|
| 498 |
+
},
|
| 499 |
+
"group": "OH"
|
| 500 |
+
},
|
| 501 |
+
"restored_smiles": "Cc1ccc2cc3c(ccc4cc(C)ccc43)cc2c1",
|
| 502 |
+
"exec_match": true,
|
| 503 |
+
"type_match": false,
|
| 504 |
+
"parse_error": false,
|
| 505 |
+
"exec_error": null
|
| 506 |
+
},
|
| 507 |
+
{
|
| 508 |
+
"id": "000028",
|
| 509 |
+
"op_type": "remove_atom",
|
| 510 |
+
"image_path": "images/000028.png",
|
| 511 |
+
"wrong_smiles_mapped": "[O:1]=[S:2](=[O:3])([OH:4])[c:5]1[cH:6][cH:7][cH:8][c:9]([N:10]=[N:11][c:12]2[cH:13][cH:14][c:15]([N:16]=[N:17][c:18]3[cH:19][cH:20][c:21]([NH:22][c:23]4[cH:24][cH:25][cH:26][cH:27][c:28]4[OH:46])[c:29]4[c:30]([S:31](=[O:32])(=[O:33])[OH:34])[cH:35][cH:36][cH:37][c:38]34)[c:39]3[cH:40][cH:41][cH:42][cH:43][c:44]23)[cH:45]1",
|
| 512 |
+
"correct_smiles": "O=S(=O)(O)c1cccc(N=Nc2ccc(N=Nc3ccc(Nc4ccccc4)c4c(S(=O)(=O)O)cccc34)c3ccccc23)c1",
|
| 513 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":46}}",
|
| 514 |
+
"predicted_action": {
|
| 515 |
+
"type": "RemoveAtom",
|
| 516 |
+
"atom": {
|
| 517 |
+
"map_num": 46
|
| 518 |
+
}
|
| 519 |
+
},
|
| 520 |
+
"restored_smiles": "O=S(=O)(O)c1cccc(N=Nc2ccc(N=Nc3ccc(Nc4ccccc4)c4c(S(=O)(=O)O)cccc34)c3ccccc23)c1",
|
| 521 |
+
"exec_match": true,
|
| 522 |
+
"type_match": true,
|
| 523 |
+
"parse_error": false,
|
| 524 |
+
"exec_error": null
|
| 525 |
+
},
|
| 526 |
+
{
|
| 527 |
+
"id": "000025",
|
| 528 |
+
"op_type": "add_functional_group",
|
| 529 |
+
"image_path": "images/000025.png",
|
| 530 |
+
"wrong_smiles_mapped": "[cH:1]1[cH:2][cH:3][c:4]2[cH:5][c:6]3[c:7]([cH:8][cH:9][c:10]4[cH:11][c:12]([CH3:13])[cH:14][cH:15][c:16]34)[cH:17][c:18]2[cH:19]1",
|
| 531 |
+
"correct_smiles": "Cc1ccc2cc3c(ccc4cc(C)ccc43)cc2c1",
|
| 532 |
+
"predicted_raw": "{\"type\":\"AddGroup\",\"anchor\":{\"map_num\":2},\"group\":\"CH3\"}",
|
| 533 |
+
"predicted_action": {
|
| 534 |
+
"type": "AddGroup",
|
| 535 |
+
"anchor": {
|
| 536 |
+
"map_num": 2
|
| 537 |
+
},
|
| 538 |
+
"group": "CH3"
|
| 539 |
+
},
|
| 540 |
+
"restored_smiles": "Cc1ccc2cc3ccc4cc(C)ccc4c3cc2c1",
|
| 541 |
+
"exec_match": false,
|
| 542 |
+
"type_match": true,
|
| 543 |
+
"parse_error": false,
|
| 544 |
+
"exec_error": null
|
| 545 |
+
},
|
| 546 |
+
{
|
| 547 |
+
"id": "000029",
|
| 548 |
+
"op_type": "add_atom",
|
| 549 |
+
"image_path": "images/000029.png",
|
| 550 |
+
"wrong_smiles_mapped": "[O:1]=[S:2](=[O:3])([OH:4])[c:5]1[cH:6][cH:7][cH:8][c:9]([N:10]=[N:11][c:12]2[cH:13][cH:14][c:15]([N:16]=[N:17][c:18]3[cH:19][cH:20][c:21]([NH:22][c:23]4[cH:24][cH:25][cH:26][cH:27][cH:28]4)[c:29]4[c:30]([S:31](=[O:32])[OH:33])[cH:34][cH:35][cH:36][c:37]34)[c:38]3[cH:39][cH:40][cH:41][cH:42][c:43]23)[cH:44]1",
|
| 551 |
+
"correct_smiles": "O=S(=O)(O)c1cccc(N=Nc2ccc(N=Nc3ccc(Nc4ccccc4)c4c(S(=O)(=O)O)cccc34)c3ccccc23)c1",
|
| 552 |
+
"predicted_raw": "{\"type\":\"AddAtom\",\"anchor\":{\"map_num\":31},\"element\":\"O\",\"bond_order\":\"DOUBLE\"}",
|
| 553 |
+
"predicted_action": {
|
| 554 |
+
"type": "AddAtom",
|
| 555 |
+
"anchor": {
|
| 556 |
+
"map_num": 31
|
| 557 |
+
},
|
| 558 |
+
"element": "O",
|
| 559 |
+
"bond_order": "DOUBLE"
|
| 560 |
+
},
|
| 561 |
+
"restored_smiles": "O=S(=O)(O)c1cccc(N=Nc2ccc(N=Nc3ccc(Nc4ccccc4)c4c(S(=O)(=O)O)cccc34)c3ccccc23)c1",
|
| 562 |
+
"exec_match": true,
|
| 563 |
+
"type_match": true,
|
| 564 |
+
"parse_error": false,
|
| 565 |
+
"exec_error": null
|
| 566 |
+
},
|
| 567 |
+
{
|
| 568 |
+
"id": "000021",
|
| 569 |
+
"op_type": "add_atom",
|
| 570 |
+
"image_path": "images/000021.png",
|
| 571 |
+
"wrong_smiles_mapped": "[CH3:1][c:2]1[cH:3][cH:4][c:5]2[cH:6][c:7]3[c:8]([cH:9][cH:10][c:11]4[cH:12][cH:13][cH:14][cH:15][c:16]34)[cH:17][c:18]2[cH:19]1",
|
| 572 |
+
"correct_smiles": "Cc1ccc2cc3c(ccc4cc(C)ccc43)cc2c1",
|
| 573 |
+
"predicted_raw": "",
|
| 574 |
+
"predicted_action": null,
|
| 575 |
+
"restored_smiles": null,
|
| 576 |
+
"exec_match": false,
|
| 577 |
+
"type_match": false,
|
| 578 |
+
"parse_error": true,
|
| 579 |
+
"exec_error": null
|
| 580 |
+
},
|
| 581 |
+
{
|
| 582 |
+
"id": "000033",
|
| 583 |
+
"op_type": "add_bond",
|
| 584 |
+
"image_path": "images/000033.png",
|
| 585 |
+
"wrong_smiles_mapped": "[O:1]=[S:2]([OH:4])[c:5]1[cH:6][cH:7][cH:8][c:9]([N:10]=[N:11][c:12]2[cH:13][cH:14][c:15]([N:16]=[N:17][c:18]3[cH:19][cH:20][c:21]([NH:22][c:23]4[cH:24][cH:25][cH:26][cH:27][cH:28]4)[c:29]4[c:30]([S:31](=[O:32])(=[O:33])[OH:34])[cH:35][cH:36][cH:37][c:38]34)[c:39]3[cH:40][cH:41][cH:42][cH:43][c:44]23)[cH:45]1.[OH2:3]",
|
| 586 |
+
"correct_smiles": "O=S(=O)(O)c1cccc(N=Nc2ccc(N=Nc3ccc(Nc4ccccc4)c4c(S(=O)(=O)O)cccc34)c3ccccc23)c1",
|
| 587 |
+
"predicted_raw": "{\"type\":\"AddBond\",\"bond\":{\"atom1\":{\"map_num\":2},\"atom2\":{\"map_num\":3}},\"order\":\"DOUBLE\"}",
|
| 588 |
+
"predicted_action": {
|
| 589 |
+
"type": "AddBond",
|
| 590 |
+
"bond": {
|
| 591 |
+
"atom1": {
|
| 592 |
+
"map_num": 2
|
| 593 |
+
},
|
| 594 |
+
"atom2": {
|
| 595 |
+
"map_num": 3
|
| 596 |
+
}
|
| 597 |
+
},
|
| 598 |
+
"order": "DOUBLE"
|
| 599 |
+
},
|
| 600 |
+
"restored_smiles": "O=S(=O)(O)c1cccc(N=Nc2ccc(N=Nc3ccc(Nc4ccccc4)c4c(S(=O)(=O)O)cccc34)c3ccccc23)c1",
|
| 601 |
+
"exec_match": true,
|
| 602 |
+
"type_match": true,
|
| 603 |
+
"parse_error": false,
|
| 604 |
+
"exec_error": null
|
| 605 |
+
},
|
| 606 |
+
{
|
| 607 |
+
"id": "000027",
|
| 608 |
+
"op_type": "swap_substituents",
|
| 609 |
+
"image_path": "images/000027.png",
|
| 610 |
+
"wrong_smiles_mapped": "[CH3:1][C:2]1=[CH:20][c:19]2[c:5]3[cH:6][c:7]([c:8]([cH:18]2)[CH:4]=[CH:3]1)-[c:17]1[c:11]([cH:12][c:13]([CH3:14])[cH:15][cH:16]1)[CH:10]=[CH:9]3",
|
| 611 |
+
"correct_smiles": "Cc1ccc2cc3c(ccc4cc(C)ccc43)cc2c1",
|
| 612 |
+
"predicted_raw": "",
|
| 613 |
+
"predicted_action": null,
|
| 614 |
+
"restored_smiles": null,
|
| 615 |
+
"exec_match": false,
|
| 616 |
+
"type_match": false,
|
| 617 |
+
"parse_error": true,
|
| 618 |
+
"exec_error": null
|
| 619 |
+
},
|
| 620 |
+
{
|
| 621 |
+
"id": "000030",
|
| 622 |
+
"op_type": "change_charge",
|
| 623 |
+
"image_path": "images/000030.png",
|
| 624 |
+
"wrong_smiles_mapped": "[O:1]=[S:2](=[O:3])([OH:4])[c:5]1[cH:6][cH:7][cH:8][c:9]([N:10]=[N:11][c:12]2[cH:13][cH:14][c:15]([N:16]=[NH+:17][c:18]3[cH:19][cH:20][c:21]([NH:22][c:23]4[cH:24][cH:25][cH:26][cH:27][cH:28]4)[c:29]4[c:30]([S:31](=[O:32])(=[O:33])[OH:34])[cH:35][cH:36][cH:37][c:38]34)[c:39]3[cH:40][cH:41][cH:42][cH:43][c:44]23)[cH:45]1",
|
| 625 |
+
"correct_smiles": "O=S(=O)(O)c1cccc(N=Nc2ccc(N=Nc3ccc(Nc4ccccc4)c4c(S(=O)(=O)O)cccc34)c3ccccc23)c1",
|
| 626 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":17},\"element\":\"N\",\"charge\":0}",
|
| 627 |
+
"predicted_action": {
|
| 628 |
+
"type": "ChangeAtom",
|
| 629 |
+
"atom": {
|
| 630 |
+
"map_num": 17
|
| 631 |
+
},
|
| 632 |
+
"element": "N",
|
| 633 |
+
"charge": 0
|
| 634 |
+
},
|
| 635 |
+
"restored_smiles": "O=S(=O)(O)c1cccc(N=Nc2ccc(N=Nc3ccc(Nc4ccccc4)c4c(S(=O)(=O)O)cccc34)c3ccccc23)c1",
|
| 636 |
+
"exec_match": true,
|
| 637 |
+
"type_match": true,
|
| 638 |
+
"parse_error": false,
|
| 639 |
+
"exec_error": null
|
| 640 |
+
},
|
| 641 |
+
{
|
| 642 |
+
"id": "000031",
|
| 643 |
+
"op_type": "change_bond_order",
|
| 644 |
+
"image_path": "images/000031.png",
|
| 645 |
+
"wrong_smiles_mapped": "[OH:1][SH:2](=[O:3])([OH:4])[c:5]1[cH:6][cH:7][cH:8][c:9]([N:10]=[N:11][c:12]2[cH:13][cH:14][c:15]([N:16]=[N:17][c:18]3[cH:19][cH:20][c:21]([NH:22][c:23]4[cH:24][cH:25][cH:26][cH:27][cH:28]4)[c:29]4[c:30]([S:31](=[O:32])(=[O:33])[OH:34])[cH:35][cH:36][cH:37][c:38]34)[c:39]3[cH:40][cH:41][cH:42][cH:43][c:44]23)[cH:45]1",
|
| 646 |
+
"correct_smiles": "O=S(=O)(O)c1cccc(N=Nc2ccc(N=Nc3ccc(Nc4ccccc4)c4c(S(=O)(=O)O)cccc34)c3ccccc23)c1",
|
| 647 |
+
"predicted_raw": "{\"type\":\"ChangeBond\",\"bond\":{\"atom1\":{\"map_num\":2},\"atom2\":{\"map_num\":4}},\"order\":\"DOUBLE\"}",
|
| 648 |
+
"predicted_action": {
|
| 649 |
+
"type": "ChangeBond",
|
| 650 |
+
"bond": {
|
| 651 |
+
"atom1": {
|
| 652 |
+
"map_num": 2
|
| 653 |
+
},
|
| 654 |
+
"atom2": {
|
| 655 |
+
"map_num": 4
|
| 656 |
+
}
|
| 657 |
+
},
|
| 658 |
+
"order": "DOUBLE"
|
| 659 |
+
},
|
| 660 |
+
"restored_smiles": "O=S(=O)(O)c1cccc(N=Nc2ccc(N=Nc3ccc(Nc4ccccc4)c4c(S(=O)(=O)O)cccc34)c3ccccc23)c1",
|
| 661 |
+
"exec_match": true,
|
| 662 |
+
"type_match": true,
|
| 663 |
+
"parse_error": false,
|
| 664 |
+
"exec_error": null
|
| 665 |
+
},
|
| 666 |
+
{
|
| 667 |
+
"id": "000034",
|
| 668 |
+
"op_type": "remove_functional_group",
|
| 669 |
+
"image_path": "images/000034.png",
|
| 670 |
+
"wrong_smiles_mapped": "[O:1]=[S:2](=[O:3])([OH:4])[c:5]1[cH:6][cH:7][cH:8][c:9]([N:10]=[N:11][c:12]2[c:13]([Cl:46])[cH:14][c:15]([N:16]=[N:17][c:18]3[cH:19][cH:20][c:21]([NH:22][c:23]4[cH:24][cH:25][cH:26][cH:27][cH:28]4)[c:29]4[c:30]([S:31](=[O:32])(=[O:33])[OH:34])[cH:35][cH:36][cH:37][c:38]34)[c:39]3[cH:40][cH:41][cH:42][cH:43][c:44]23)[cH:45]1",
|
| 671 |
+
"correct_smiles": "O=S(=O)(O)c1cccc(N=Nc2ccc(N=Nc3ccc(Nc4ccccc4)c4c(S(=O)(=O)O)cccc34)c3ccccc23)c1",
|
| 672 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":46}}",
|
| 673 |
+
"predicted_action": {
|
| 674 |
+
"type": "RemoveAtom",
|
| 675 |
+
"atom": {
|
| 676 |
+
"map_num": 46
|
| 677 |
+
}
|
| 678 |
+
},
|
| 679 |
+
"restored_smiles": "O=S(=O)(O)c1cccc(N=Nc2ccc(N=Nc3ccc(Nc4ccccc4)c4c(S(=O)(=O)O)cccc34)c3ccccc23)c1",
|
| 680 |
+
"exec_match": true,
|
| 681 |
+
"type_match": false,
|
| 682 |
+
"parse_error": false,
|
| 683 |
+
"exec_error": null
|
| 684 |
+
},
|
| 685 |
+
{
|
| 686 |
+
"id": "000036",
|
| 687 |
+
"op_type": "change_atom_element",
|
| 688 |
+
"image_path": "images/000036.png",
|
| 689 |
+
"wrong_smiles_mapped": "[NH2:1][NH:2][CH2:3][S:4][S:5][c:6]1[cH:7][cH:8][cH:9][cH:10][cH:11]1",
|
| 690 |
+
"correct_smiles": "NCCSSc1ccccc1",
|
| 691 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":2},\"element\":\"C\",\"charge\":0}",
|
| 692 |
+
"predicted_action": {
|
| 693 |
+
"type": "ChangeAtom",
|
| 694 |
+
"atom": {
|
| 695 |
+
"map_num": 2
|
| 696 |
+
},
|
| 697 |
+
"element": "C",
|
| 698 |
+
"charge": 0
|
| 699 |
+
},
|
| 700 |
+
"restored_smiles": "NCCSSc1ccccc1",
|
| 701 |
+
"exec_match": true,
|
| 702 |
+
"type_match": true,
|
| 703 |
+
"parse_error": false,
|
| 704 |
+
"exec_error": null
|
| 705 |
+
},
|
| 706 |
+
{
|
| 707 |
+
"id": "000038",
|
| 708 |
+
"op_type": "add_atom",
|
| 709 |
+
"image_path": "images/000038.png",
|
| 710 |
+
"wrong_smiles_mapped": "[CH3:1][CH2:2][S:3][S:4][c:5]1[cH:6][cH:7][cH:8][cH:9][cH:10]1",
|
| 711 |
+
"correct_smiles": "NCCSSc1ccccc1",
|
| 712 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":1},\"element\":\"N\",\"charge\":0}",
|
| 713 |
+
"predicted_action": {
|
| 714 |
+
"type": "ChangeAtom",
|
| 715 |
+
"atom": {
|
| 716 |
+
"map_num": 1
|
| 717 |
+
},
|
| 718 |
+
"element": "N",
|
| 719 |
+
"charge": 0
|
| 720 |
+
},
|
| 721 |
+
"restored_smiles": "NCSSc1ccccc1",
|
| 722 |
+
"exec_match": false,
|
| 723 |
+
"type_match": false,
|
| 724 |
+
"parse_error": false,
|
| 725 |
+
"exec_error": null
|
| 726 |
+
},
|
| 727 |
+
{
|
| 728 |
+
"id": "000037",
|
| 729 |
+
"op_type": "remove_atom",
|
| 730 |
+
"image_path": "images/000037.png",
|
| 731 |
+
"wrong_smiles_mapped": "[NH2:1][CH2:2][CH2:3][S:4][S:5][c:6]1[cH:7][cH:8][cH:9][cH:10][c:11]1[OH:12]",
|
| 732 |
+
"correct_smiles": "NCCSSc1ccccc1",
|
| 733 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":12}}",
|
| 734 |
+
"predicted_action": {
|
| 735 |
+
"type": "RemoveAtom",
|
| 736 |
+
"atom": {
|
| 737 |
+
"map_num": 12
|
| 738 |
+
}
|
| 739 |
+
},
|
| 740 |
+
"restored_smiles": "NCCSSc1ccccc1",
|
| 741 |
+
"exec_match": true,
|
| 742 |
+
"type_match": true,
|
| 743 |
+
"parse_error": false,
|
| 744 |
+
"exec_error": null
|
| 745 |
+
},
|
| 746 |
+
{
|
| 747 |
+
"id": "000032",
|
| 748 |
+
"op_type": "remove_bond",
|
| 749 |
+
"image_path": "images/000032.png",
|
| 750 |
+
"wrong_smiles_mapped": "[O:1]=[S:2](=[O:3])([OH:4])[c:5]1[cH:6][cH:7][cH:8][c:9]([N:10]=[N:11][c:12]2[cH:13][cH:14][c:15]3[c:39]4[cH:40][cH:41][cH:42][c:43]([c:44]24)-[c:37]2[cH:36][cH:35][c:30]([S:31](=[O:32])(=[O:33])[OH:34])[c:29]4[c:21]([NH:22][c:23]5[cH:24][cH:25][cH:26][cH:27][cH:28]5)[cH:20][cH:19][c:18]([c:38]42)[N:17]=[N:16]3)[cH:45]1",
|
| 751 |
+
"correct_smiles": "O=S(=O)(O)c1cccc(N=Nc2ccc(N=Nc3ccc(Nc4ccccc4)c4c(S(=O)(=O)O)cccc34)c3ccccc23)c1",
|
| 752 |
+
"predicted_raw": "{\"type\":\"RemoveBond\",\"bond\":{\"atom1\":{\"map_num\":43},\"atom2\":{\"map_num\":37}}}",
|
| 753 |
+
"predicted_action": {
|
| 754 |
+
"type": "RemoveBond",
|
| 755 |
+
"bond": {
|
| 756 |
+
"atom1": {
|
| 757 |
+
"map_num": 43
|
| 758 |
+
},
|
| 759 |
+
"atom2": {
|
| 760 |
+
"map_num": 37
|
| 761 |
+
}
|
| 762 |
+
}
|
| 763 |
+
},
|
| 764 |
+
"restored_smiles": "O=S(=O)(O)c1cccc(N=Nc2ccc(N=Nc3ccc(Nc4ccccc4)c4c(S(=O)(=O)O)cccc34)c3ccccc23)c1",
|
| 765 |
+
"exec_match": true,
|
| 766 |
+
"type_match": true,
|
| 767 |
+
"parse_error": false,
|
| 768 |
+
"exec_error": null
|
| 769 |
+
},
|
| 770 |
+
{
|
| 771 |
+
"id": "000039",
|
| 772 |
+
"op_type": "change_bond_order",
|
| 773 |
+
"image_path": "images/000039.png",
|
| 774 |
+
"wrong_smiles_mapped": "[NH2:1][CH2:2][CH:3]=[SH:4][S:5][c:6]1[cH:7][cH:8][cH:9][cH:10][cH:11]1",
|
| 775 |
+
"correct_smiles": "NCCSSc1ccccc1",
|
| 776 |
+
"predicted_raw": "{\"type\":\"ChangeBond\",\"bond\":{\"atom1\":{\"map_num\":3},\"atom2\":{\"map_num\":4}},\"order\":\"SINGLE\"}",
|
| 777 |
+
"predicted_action": {
|
| 778 |
+
"type": "ChangeBond",
|
| 779 |
+
"bond": {
|
| 780 |
+
"atom1": {
|
| 781 |
+
"map_num": 3
|
| 782 |
+
},
|
| 783 |
+
"atom2": {
|
| 784 |
+
"map_num": 4
|
| 785 |
+
}
|
| 786 |
+
},
|
| 787 |
+
"order": "SINGLE"
|
| 788 |
+
},
|
| 789 |
+
"restored_smiles": "NCCSSc1ccccc1",
|
| 790 |
+
"exec_match": true,
|
| 791 |
+
"type_match": true,
|
| 792 |
+
"parse_error": false,
|
| 793 |
+
"exec_error": null
|
| 794 |
+
},
|
| 795 |
+
{
|
| 796 |
+
"id": "000035",
|
| 797 |
+
"op_type": "move_substituent",
|
| 798 |
+
"image_path": "images/000035.png",
|
| 799 |
+
"wrong_smiles_mapped": "[O:1]=[S:2](=[O:3])([OH:4])[c:5]1[cH:6][cH:7][cH:8][c:9]([N:10]=[N:11][C:12]2=[CH:13][CH:14]=[C:15]([N:16]=[N:17][c:18]3[cH:19][cH:20][c:21]([NH:22][c:23]4[cH:24][cH:25][cH:26][cH:27][cH:28]4)[c:29]4[c:30]([S:31](=[O:32])(=[O:33])[OH:34])[cH:35][cH:36][cH:37][c:38]34)[c:41]3[cH:40][cH:39][c:44]2[cH:43][cH:42]3)[cH:45]1",
|
| 800 |
+
"correct_smiles": "O=S(=O)(O)c1cccc(N=Nc2ccc(N=Nc3ccc(Nc4ccccc4)c4c(S(=O)(=O)O)cccc34)c3ccccc23)c1",
|
| 801 |
+
"predicted_raw": "",
|
| 802 |
+
"predicted_action": null,
|
| 803 |
+
"restored_smiles": null,
|
| 804 |
+
"exec_match": false,
|
| 805 |
+
"type_match": false,
|
| 806 |
+
"parse_error": true,
|
| 807 |
+
"exec_error": null
|
| 808 |
+
},
|
| 809 |
+
{
|
| 810 |
+
"id": "000026",
|
| 811 |
+
"op_type": "move_substituent",
|
| 812 |
+
"image_path": "images/000026.png",
|
| 813 |
+
"wrong_smiles_mapped": "[CH3:1][c:2]1[cH:3][cH:4][c:5]2[cH:6][c:7]3[c:8]([cH:9][cH:10][c:11]4[cH:12][cH:13][c:15]([CH3:14])[cH:16][c:17]34)[cH:18][c:19]2[cH:20]1",
|
| 814 |
+
"correct_smiles": "Cc1ccc2cc3c(ccc4cc(C)ccc43)cc2c1",
|
| 815 |
+
"predicted_raw": "",
|
| 816 |
+
"predicted_action": null,
|
| 817 |
+
"restored_smiles": null,
|
| 818 |
+
"exec_match": false,
|
| 819 |
+
"type_match": false,
|
| 820 |
+
"parse_error": true,
|
| 821 |
+
"exec_error": null
|
| 822 |
+
},
|
| 823 |
+
{
|
| 824 |
+
"id": "000043",
|
| 825 |
+
"op_type": "add_functional_group",
|
| 826 |
+
"image_path": "images/000043.png",
|
| 827 |
+
"wrong_smiles_mapped": "[CH3:1][CH2:2][S:3][S:4][c:5]1[cH:6][cH:7][cH:8][cH:9][cH:10]1",
|
| 828 |
+
"correct_smiles": "NCCSSc1ccccc1",
|
| 829 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":1},\"element\":\"N\",\"charge\":0}",
|
| 830 |
+
"predicted_action": {
|
| 831 |
+
"type": "ChangeAtom",
|
| 832 |
+
"atom": {
|
| 833 |
+
"map_num": 1
|
| 834 |
+
},
|
| 835 |
+
"element": "N",
|
| 836 |
+
"charge": 0
|
| 837 |
+
},
|
| 838 |
+
"restored_smiles": "NCSSc1ccccc1",
|
| 839 |
+
"exec_match": false,
|
| 840 |
+
"type_match": false,
|
| 841 |
+
"parse_error": false,
|
| 842 |
+
"exec_error": null
|
| 843 |
+
},
|
| 844 |
+
{
|
| 845 |
+
"id": "000042",
|
| 846 |
+
"op_type": "remove_functional_group",
|
| 847 |
+
"image_path": "images/000042.png",
|
| 848 |
+
"wrong_smiles_mapped": "[NH2:1][CH2:2][CH:3]([S:4][S:5][c:6]1[cH:7][cH:8][cH:9][cH:10][cH:11]1)[Cl:12]",
|
| 849 |
+
"correct_smiles": "NCCSSc1ccccc1",
|
| 850 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":12}}",
|
| 851 |
+
"predicted_action": {
|
| 852 |
+
"type": "RemoveAtom",
|
| 853 |
+
"atom": {
|
| 854 |
+
"map_num": 12
|
| 855 |
+
}
|
| 856 |
+
},
|
| 857 |
+
"restored_smiles": "NCCSSc1ccccc1",
|
| 858 |
+
"exec_match": true,
|
| 859 |
+
"type_match": false,
|
| 860 |
+
"parse_error": false,
|
| 861 |
+
"exec_error": null
|
| 862 |
+
},
|
| 863 |
+
{
|
| 864 |
+
"id": "000041",
|
| 865 |
+
"op_type": "add_bond",
|
| 866 |
+
"image_path": "images/000041.png",
|
| 867 |
+
"wrong_smiles_mapped": "[CH3:3][S:4][S:5][c:6]1[cH:7][cH:8][cH:9][cH:10][cH:11]1.[NH2:1][CH3:2]",
|
| 868 |
+
"correct_smiles": "NCCSSc1ccccc1",
|
| 869 |
+
"predicted_raw": "{\"type\":\"AddBond\",\"bond\":{\"atom1\":{\"map_num\":2},\"atom2\":{\"map_num\":3}},\"order\":\"SINGLE\"}",
|
| 870 |
+
"predicted_action": {
|
| 871 |
+
"type": "AddBond",
|
| 872 |
+
"bond": {
|
| 873 |
+
"atom1": {
|
| 874 |
+
"map_num": 2
|
| 875 |
+
},
|
| 876 |
+
"atom2": {
|
| 877 |
+
"map_num": 3
|
| 878 |
+
}
|
| 879 |
+
},
|
| 880 |
+
"order": "SINGLE"
|
| 881 |
+
},
|
| 882 |
+
"restored_smiles": "NCCSSc1ccccc1",
|
| 883 |
+
"exec_match": true,
|
| 884 |
+
"type_match": true,
|
| 885 |
+
"parse_error": false,
|
| 886 |
+
"exec_error": null
|
| 887 |
+
},
|
| 888 |
+
{
|
| 889 |
+
"id": "000044",
|
| 890 |
+
"op_type": "change_atom_element",
|
| 891 |
+
"image_path": "images/000044.png",
|
| 892 |
+
"wrong_smiles_mapped": "[NH2:1][CH2:2][CH2:3][CH2:4][NH:5][CH2:6][CH2:7][O:8][P:9](=[O:10])([OH:11])[OH:12]",
|
| 893 |
+
"correct_smiles": "NCCCNCCSP(=O)(O)O",
|
| 894 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":8},\"element\":\"S\",\"charge\":0}",
|
| 895 |
+
"predicted_action": {
|
| 896 |
+
"type": "ChangeAtom",
|
| 897 |
+
"atom": {
|
| 898 |
+
"map_num": 8
|
| 899 |
+
},
|
| 900 |
+
"element": "S",
|
| 901 |
+
"charge": 0
|
| 902 |
+
},
|
| 903 |
+
"restored_smiles": "NCCCNCCSP(=O)(O)O",
|
| 904 |
+
"exec_match": true,
|
| 905 |
+
"type_match": true,
|
| 906 |
+
"parse_error": false,
|
| 907 |
+
"exec_error": null
|
| 908 |
+
},
|
| 909 |
+
{
|
| 910 |
+
"id": "000045",
|
| 911 |
+
"op_type": "remove_atom",
|
| 912 |
+
"image_path": "images/000045.png",
|
| 913 |
+
"wrong_smiles_mapped": "[NH2:1][CH:2]([CH2:3][CH2:4][NH:5][CH2:6][CH2:7][S:8][P:9](=[O:10])([OH:11])[OH:12])[OH:13]",
|
| 914 |
+
"correct_smiles": "NCCCNCCSP(=O)(O)O",
|
| 915 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":13}}",
|
| 916 |
+
"predicted_action": {
|
| 917 |
+
"type": "RemoveAtom",
|
| 918 |
+
"atom": {
|
| 919 |
+
"map_num": 13
|
| 920 |
+
}
|
| 921 |
+
},
|
| 922 |
+
"restored_smiles": "NCCCNCCSP(=O)(O)O",
|
| 923 |
+
"exec_match": true,
|
| 924 |
+
"type_match": true,
|
| 925 |
+
"parse_error": false,
|
| 926 |
+
"exec_error": null
|
| 927 |
+
},
|
| 928 |
+
{
|
| 929 |
+
"id": "000046",
|
| 930 |
+
"op_type": "add_atom",
|
| 931 |
+
"image_path": "images/000046.png",
|
| 932 |
+
"wrong_smiles_mapped": "[NH2:1][CH2:2][CH2:3][CH2:4][NH:5][CH2:6][CH2:7][S:8][PH:9](=[O:10])[OH:11]",
|
| 933 |
+
"correct_smiles": "NCCCNCCSP(=O)(O)O",
|
| 934 |
+
"predicted_raw": "{\"type\":\"AddGroup\",\"anchor\":{\"map_num\":9},\"group\":\"OH\"}",
|
| 935 |
+
"predicted_action": {
|
| 936 |
+
"type": "AddGroup",
|
| 937 |
+
"anchor": {
|
| 938 |
+
"map_num": 9
|
| 939 |
+
},
|
| 940 |
+
"group": "OH"
|
| 941 |
+
},
|
| 942 |
+
"restored_smiles": "NCCCNCCSP(=O)(O)O",
|
| 943 |
+
"exec_match": true,
|
| 944 |
+
"type_match": false,
|
| 945 |
+
"parse_error": false,
|
| 946 |
+
"exec_error": null
|
| 947 |
+
},
|
| 948 |
+
{
|
| 949 |
+
"id": "000040",
|
| 950 |
+
"op_type": "remove_bond",
|
| 951 |
+
"image_path": "images/000040.png",
|
| 952 |
+
"wrong_smiles_mapped": "[NH2:1][CH2:2][CH2:3][S:4][S:5][c:6]1[c:7]2[cH:8][cH:9][cH:10][c:11]1-2",
|
| 953 |
+
"correct_smiles": "NCCSSc1ccccc1",
|
| 954 |
+
"predicted_raw": "{\"type\":\"RemoveBond\",\"bond\":{\"atom1\":{\"map_num\":7},\"atom2\":{\"map_num\":11}}}",
|
| 955 |
+
"predicted_action": {
|
| 956 |
+
"type": "RemoveBond",
|
| 957 |
+
"bond": {
|
| 958 |
+
"atom1": {
|
| 959 |
+
"map_num": 7
|
| 960 |
+
},
|
| 961 |
+
"atom2": {
|
| 962 |
+
"map_num": 11
|
| 963 |
+
}
|
| 964 |
+
}
|
| 965 |
+
},
|
| 966 |
+
"restored_smiles": "NCCSSc1ccccc1",
|
| 967 |
+
"exec_match": true,
|
| 968 |
+
"type_match": true,
|
| 969 |
+
"parse_error": false,
|
| 970 |
+
"exec_error": null
|
| 971 |
+
},
|
| 972 |
+
{
|
| 973 |
+
"id": "000049",
|
| 974 |
+
"op_type": "remove_bond",
|
| 975 |
+
"image_path": "images/000049.png",
|
| 976 |
+
"wrong_smiles_mapped": "[NH2:1][CH2:2][CH:3]1[CH2:4][NH:5][CH2:6][CH2:7][S:8][P:9](=[O:10])([OH:11])[O:12]1",
|
| 977 |
+
"correct_smiles": "NCCCNCCSP(=O)(O)O",
|
| 978 |
+
"predicted_raw": "{\"type\":\"RemoveBond\",\"bond\":{\"atom1\":{\"map_num\":3},\"atom2\":{\"map_num\":12}}}",
|
| 979 |
+
"predicted_action": {
|
| 980 |
+
"type": "RemoveBond",
|
| 981 |
+
"bond": {
|
| 982 |
+
"atom1": {
|
| 983 |
+
"map_num": 3
|
| 984 |
+
},
|
| 985 |
+
"atom2": {
|
| 986 |
+
"map_num": 12
|
| 987 |
+
}
|
| 988 |
+
}
|
| 989 |
+
},
|
| 990 |
+
"restored_smiles": "NCCCNCCSP(=O)(O)O",
|
| 991 |
+
"exec_match": true,
|
| 992 |
+
"type_match": true,
|
| 993 |
+
"parse_error": false,
|
| 994 |
+
"exec_error": null
|
| 995 |
+
},
|
| 996 |
+
{
|
| 997 |
+
"id": "000048",
|
| 998 |
+
"op_type": "change_bond_order",
|
| 999 |
+
"image_path": "images/000048.png",
|
| 1000 |
+
"wrong_smiles_mapped": "[NH2:1][CH2:2][CH2:3][CH2:4][NH:5][CH2:6][CH2:7][S:8][PH:9]([OH:10])([OH:11])[OH:12]",
|
| 1001 |
+
"correct_smiles": "NCCCNCCSP(=O)(O)O",
|
| 1002 |
+
"predicted_raw": "{\"type\":\"ChangeBond\",\"bond\":{\"atom1\":{\"map_num\":9},\"atom2\":{\"map_num\":12}},\"order\":\"DOUBLE\"}",
|
| 1003 |
+
"predicted_action": {
|
| 1004 |
+
"type": "ChangeBond",
|
| 1005 |
+
"bond": {
|
| 1006 |
+
"atom1": {
|
| 1007 |
+
"map_num": 9
|
| 1008 |
+
},
|
| 1009 |
+
"atom2": {
|
| 1010 |
+
"map_num": 12
|
| 1011 |
+
}
|
| 1012 |
+
},
|
| 1013 |
+
"order": "DOUBLE"
|
| 1014 |
+
},
|
| 1015 |
+
"restored_smiles": "NCCCNCCSP(=O)(O)O",
|
| 1016 |
+
"exec_match": true,
|
| 1017 |
+
"type_match": true,
|
| 1018 |
+
"parse_error": false,
|
| 1019 |
+
"exec_error": null
|
| 1020 |
+
},
|
| 1021 |
+
{
|
| 1022 |
+
"id": "000047",
|
| 1023 |
+
"op_type": "change_charge",
|
| 1024 |
+
"image_path": "images/000047.png",
|
| 1025 |
+
"wrong_smiles_mapped": "[NH2:1][CH2:2][CH2:3][CH2:4][NH:5][CH2:6][CH2:7][S:8][P:9](=[OH+:10])([OH:11])[OH:12]",
|
| 1026 |
+
"correct_smiles": "NCCCNCCSP(=O)(O)O",
|
| 1027 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":10},\"element\":\"O\",\"charge\":0}",
|
| 1028 |
+
"predicted_action": {
|
| 1029 |
+
"type": "ChangeAtom",
|
| 1030 |
+
"atom": {
|
| 1031 |
+
"map_num": 10
|
| 1032 |
+
},
|
| 1033 |
+
"element": "O",
|
| 1034 |
+
"charge": 0
|
| 1035 |
+
},
|
| 1036 |
+
"restored_smiles": "NCCCNCCSP(=O)(O)O",
|
| 1037 |
+
"exec_match": true,
|
| 1038 |
+
"type_match": true,
|
| 1039 |
+
"parse_error": false,
|
| 1040 |
+
"exec_error": null
|
| 1041 |
+
},
|
| 1042 |
+
{
|
| 1043 |
+
"id": "000051",
|
| 1044 |
+
"op_type": "remove_functional_group",
|
| 1045 |
+
"image_path": "images/000051.png",
|
| 1046 |
+
"wrong_smiles_mapped": "[NH2:1][CH:2]([CH2:3][CH2:4][NH:5][CH2:6][CH2:7][S:8][P:9](=[O:10])([OH:11])[OH:12])[F:13]",
|
| 1047 |
+
"correct_smiles": "NCCCNCCSP(=O)(O)O",
|
| 1048 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":13}}",
|
| 1049 |
+
"predicted_action": {
|
| 1050 |
+
"type": "RemoveAtom",
|
| 1051 |
+
"atom": {
|
| 1052 |
+
"map_num": 13
|
| 1053 |
+
}
|
| 1054 |
+
},
|
| 1055 |
+
"restored_smiles": "NCCCNCCSP(=O)(O)O",
|
| 1056 |
+
"exec_match": true,
|
| 1057 |
+
"type_match": false,
|
| 1058 |
+
"parse_error": false,
|
| 1059 |
+
"exec_error": null
|
| 1060 |
+
},
|
| 1061 |
+
{
|
| 1062 |
+
"id": "000054",
|
| 1063 |
+
"op_type": "remove_atom",
|
| 1064 |
+
"image_path": "images/000054.png",
|
| 1065 |
+
"wrong_smiles_mapped": "[CH:1]1=[C:2]([NH2:7])[NH:3][CH2:4][N:5]=[CH:6]1",
|
| 1066 |
+
"correct_smiles": "C1=CNCN=C1",
|
| 1067 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":7}}",
|
| 1068 |
+
"predicted_action": {
|
| 1069 |
+
"type": "RemoveAtom",
|
| 1070 |
+
"atom": {
|
| 1071 |
+
"map_num": 7
|
| 1072 |
+
}
|
| 1073 |
+
},
|
| 1074 |
+
"restored_smiles": "C1=CNCN=C1",
|
| 1075 |
+
"exec_match": true,
|
| 1076 |
+
"type_match": true,
|
| 1077 |
+
"parse_error": false,
|
| 1078 |
+
"exec_error": null
|
| 1079 |
+
},
|
| 1080 |
+
{
|
| 1081 |
+
"id": "000052",
|
| 1082 |
+
"op_type": "add_functional_group",
|
| 1083 |
+
"image_path": "images/000052.png",
|
| 1084 |
+
"wrong_smiles_mapped": "[CH3:1][CH2:2][CH2:3][NH:4][CH2:5][CH2:6][S:7][P:8](=[O:9])([OH:10])[OH:11]",
|
| 1085 |
+
"correct_smiles": "NCCCNCCSP(=O)(O)O",
|
| 1086 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":1},\"element\":\"N\",\"charge\":0}",
|
| 1087 |
+
"predicted_action": {
|
| 1088 |
+
"type": "ChangeAtom",
|
| 1089 |
+
"atom": {
|
| 1090 |
+
"map_num": 1
|
| 1091 |
+
},
|
| 1092 |
+
"element": "N",
|
| 1093 |
+
"charge": 0
|
| 1094 |
+
},
|
| 1095 |
+
"restored_smiles": "NCCNCCSP(=O)(O)O",
|
| 1096 |
+
"exec_match": false,
|
| 1097 |
+
"type_match": false,
|
| 1098 |
+
"parse_error": false,
|
| 1099 |
+
"exec_error": null
|
| 1100 |
+
},
|
| 1101 |
+
{
|
| 1102 |
+
"id": "000053",
|
| 1103 |
+
"op_type": "change_atom_element",
|
| 1104 |
+
"image_path": "images/000053.png",
|
| 1105 |
+
"wrong_smiles_mapped": "[CH:1]1=[CH:2][NH:3][CH2:4][N:5]=[N:6]1",
|
| 1106 |
+
"correct_smiles": "C1=CNCN=C1",
|
| 1107 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":6},\"element\":\"C\",\"charge\":0}",
|
| 1108 |
+
"predicted_action": {
|
| 1109 |
+
"type": "ChangeAtom",
|
| 1110 |
+
"atom": {
|
| 1111 |
+
"map_num": 6
|
| 1112 |
+
},
|
| 1113 |
+
"element": "C",
|
| 1114 |
+
"charge": 0
|
| 1115 |
+
},
|
| 1116 |
+
"restored_smiles": "C1=CNCN=C1",
|
| 1117 |
+
"exec_match": true,
|
| 1118 |
+
"type_match": true,
|
| 1119 |
+
"parse_error": false,
|
| 1120 |
+
"exec_error": null
|
| 1121 |
+
},
|
| 1122 |
+
{
|
| 1123 |
+
"id": "000055",
|
| 1124 |
+
"op_type": "change_charge",
|
| 1125 |
+
"image_path": "images/000055.png",
|
| 1126 |
+
"wrong_smiles_mapped": "[CH:1]1=[CH:2][NH:3][CH2:4][NH+:5]=[CH:6]1",
|
| 1127 |
+
"correct_smiles": "C1=CNCN=C1",
|
| 1128 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":5},\"element\":\"N\",\"charge\":0}",
|
| 1129 |
+
"predicted_action": {
|
| 1130 |
+
"type": "ChangeAtom",
|
| 1131 |
+
"atom": {
|
| 1132 |
+
"map_num": 5
|
| 1133 |
+
},
|
| 1134 |
+
"element": "N",
|
| 1135 |
+
"charge": 0
|
| 1136 |
+
},
|
| 1137 |
+
"restored_smiles": "C1=CNCN=C1",
|
| 1138 |
+
"exec_match": true,
|
| 1139 |
+
"type_match": true,
|
| 1140 |
+
"parse_error": false,
|
| 1141 |
+
"exec_error": null
|
| 1142 |
+
},
|
| 1143 |
+
{
|
| 1144 |
+
"id": "000056",
|
| 1145 |
+
"op_type": "change_bond_order",
|
| 1146 |
+
"image_path": "images/000056.png",
|
| 1147 |
+
"wrong_smiles_mapped": "[C:1]1=[CH:2][NH:3][CH2:4][N:5]=[C:6]=1",
|
| 1148 |
+
"correct_smiles": "C1=CNCN=C1",
|
| 1149 |
+
"predicted_raw": "{\"type\":\"ChangeBond\",\"bond\":{\"atom1\":{\"map_num\":6},\"atom2\":{\"map_num\":1}},\"order\":\"SINGLE\"}",
|
| 1150 |
+
"predicted_action": {
|
| 1151 |
+
"type": "ChangeBond",
|
| 1152 |
+
"bond": {
|
| 1153 |
+
"atom1": {
|
| 1154 |
+
"map_num": 6
|
| 1155 |
+
},
|
| 1156 |
+
"atom2": {
|
| 1157 |
+
"map_num": 1
|
| 1158 |
+
}
|
| 1159 |
+
},
|
| 1160 |
+
"order": "SINGLE"
|
| 1161 |
+
},
|
| 1162 |
+
"restored_smiles": "C1=CNCN=C1",
|
| 1163 |
+
"exec_match": true,
|
| 1164 |
+
"type_match": true,
|
| 1165 |
+
"parse_error": false,
|
| 1166 |
+
"exec_error": null
|
| 1167 |
+
},
|
| 1168 |
+
{
|
| 1169 |
+
"id": "000050",
|
| 1170 |
+
"op_type": "add_bond",
|
| 1171 |
+
"image_path": "images/000050.png",
|
| 1172 |
+
"wrong_smiles_mapped": "[CH3:3][CH2:4][NH:5][CH2:6][CH2:7][S:8][P:9](=[O:10])([OH:11])[OH:12].[NH2:1][CH3:2]",
|
| 1173 |
+
"correct_smiles": "NCCCNCCSP(=O)(O)O",
|
| 1174 |
+
"predicted_raw": "{\"type\":\"AddBond\",\"bond\":{\"atom1\":{\"map_num\":2},\"atom2\":{\"map_num\":3}},\"order\":\"SINGLE\"}",
|
| 1175 |
+
"predicted_action": {
|
| 1176 |
+
"type": "AddBond",
|
| 1177 |
+
"bond": {
|
| 1178 |
+
"atom1": {
|
| 1179 |
+
"map_num": 2
|
| 1180 |
+
},
|
| 1181 |
+
"atom2": {
|
| 1182 |
+
"map_num": 3
|
| 1183 |
+
}
|
| 1184 |
+
},
|
| 1185 |
+
"order": "SINGLE"
|
| 1186 |
+
},
|
| 1187 |
+
"restored_smiles": "NCCCNCCSP(=O)(O)O",
|
| 1188 |
+
"exec_match": true,
|
| 1189 |
+
"type_match": true,
|
| 1190 |
+
"parse_error": false,
|
| 1191 |
+
"exec_error": null
|
| 1192 |
+
},
|
| 1193 |
+
{
|
| 1194 |
+
"id": "000059",
|
| 1195 |
+
"op_type": "change_atom_element",
|
| 1196 |
+
"image_path": "images/000059.png",
|
| 1197 |
+
"wrong_smiles_mapped": "[CH3:1][CH2:2][CH2:3][CH2:4][CH2:5][CH2:6][CH2:7][CH2:8][CH2:9][CH2:10][N:11]([CH3:12])[c:13]1[cH:14][c:15]([CH2:16][SH:17])[cH:18][c:19]([NH:20][C:21]([CH3:22])=[O:23])[cH:24]1",
|
| 1198 |
+
"correct_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1199 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":17},\"element\":\"O\",\"charge\":0}",
|
| 1200 |
+
"predicted_action": {
|
| 1201 |
+
"type": "ChangeAtom",
|
| 1202 |
+
"atom": {
|
| 1203 |
+
"map_num": 17
|
| 1204 |
+
},
|
| 1205 |
+
"element": "O",
|
| 1206 |
+
"charge": 0
|
| 1207 |
+
},
|
| 1208 |
+
"restored_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1209 |
+
"exec_match": true,
|
| 1210 |
+
"type_match": true,
|
| 1211 |
+
"parse_error": false,
|
| 1212 |
+
"exec_error": null
|
| 1213 |
+
},
|
| 1214 |
+
{
|
| 1215 |
+
"id": "000058",
|
| 1216 |
+
"op_type": "remove_functional_group",
|
| 1217 |
+
"image_path": "images/000058.png",
|
| 1218 |
+
"wrong_smiles_mapped": "[CH:1]1=[C:2]([CH3:7])[NH:3][CH2:4][N:5]=[CH:6]1",
|
| 1219 |
+
"correct_smiles": "C1=CNCN=C1",
|
| 1220 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":7}}",
|
| 1221 |
+
"predicted_action": {
|
| 1222 |
+
"type": "RemoveAtom",
|
| 1223 |
+
"atom": {
|
| 1224 |
+
"map_num": 7
|
| 1225 |
+
}
|
| 1226 |
+
},
|
| 1227 |
+
"restored_smiles": "C1=CNCN=C1",
|
| 1228 |
+
"exec_match": true,
|
| 1229 |
+
"type_match": false,
|
| 1230 |
+
"parse_error": false,
|
| 1231 |
+
"exec_error": null
|
| 1232 |
+
},
|
| 1233 |
+
{
|
| 1234 |
+
"id": "000061",
|
| 1235 |
+
"op_type": "add_atom",
|
| 1236 |
+
"image_path": "images/000061.png",
|
| 1237 |
+
"wrong_smiles_mapped": "[CH3:1][CH2:2][CH2:3][CH2:4][CH2:5][CH2:6][CH2:7][CH2:8][CH2:9][CH2:10][N:11]([CH3:12])[c:13]1[cH:14][c:15]([CH3:16])[cH:17][c:18]([NH:19][C:20]([CH3:21])=[O:22])[cH:23]1",
|
| 1238 |
+
"correct_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1239 |
+
"predicted_raw": "{\"type\":\"AddGroup\",\"anchor\":{\"map_num\":16},\"group\":\"OH\"}",
|
| 1240 |
+
"predicted_action": {
|
| 1241 |
+
"type": "AddGroup",
|
| 1242 |
+
"anchor": {
|
| 1243 |
+
"map_num": 16
|
| 1244 |
+
},
|
| 1245 |
+
"group": "OH"
|
| 1246 |
+
},
|
| 1247 |
+
"restored_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1248 |
+
"exec_match": true,
|
| 1249 |
+
"type_match": false,
|
| 1250 |
+
"parse_error": false,
|
| 1251 |
+
"exec_error": null
|
| 1252 |
+
},
|
| 1253 |
+
{
|
| 1254 |
+
"id": "000057",
|
| 1255 |
+
"op_type": "remove_bond",
|
| 1256 |
+
"image_path": "images/000057.png",
|
| 1257 |
+
"wrong_smiles_mapped": "[CH:1]1=[CH:2][NH:3][CH:4]2[N:5]=[C:6]12",
|
| 1258 |
+
"correct_smiles": "C1=CNCN=C1",
|
| 1259 |
+
"predicted_raw": "{\"type\":\"RemoveBond\",\"bond\":{\"atom1\":{\"map_num\":4},\"atom2\":{\"map_num\":6}}}",
|
| 1260 |
+
"predicted_action": {
|
| 1261 |
+
"type": "RemoveBond",
|
| 1262 |
+
"bond": {
|
| 1263 |
+
"atom1": {
|
| 1264 |
+
"map_num": 4
|
| 1265 |
+
},
|
| 1266 |
+
"atom2": {
|
| 1267 |
+
"map_num": 6
|
| 1268 |
+
}
|
| 1269 |
+
}
|
| 1270 |
+
},
|
| 1271 |
+
"restored_smiles": "C1=CNCN=C1",
|
| 1272 |
+
"exec_match": true,
|
| 1273 |
+
"type_match": true,
|
| 1274 |
+
"parse_error": false,
|
| 1275 |
+
"exec_error": null
|
| 1276 |
+
},
|
| 1277 |
+
{
|
| 1278 |
+
"id": "000060",
|
| 1279 |
+
"op_type": "remove_atom",
|
| 1280 |
+
"image_path": "images/000060.png",
|
| 1281 |
+
"wrong_smiles_mapped": "[CH3:1][CH:2]([CH2:3][CH2:4][CH2:5][CH2:6][CH2:7][CH2:8][CH2:9][CH2:10][N:11]([CH3:12])[c:13]1[cH:14][c:15]([CH2:16][OH:17])[cH:18][c:19]([NH:20][C:21]([CH3:22])=[O:23])[cH:24]1)[NH2:25]",
|
| 1282 |
+
"correct_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1283 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":25}}",
|
| 1284 |
+
"predicted_action": {
|
| 1285 |
+
"type": "RemoveAtom",
|
| 1286 |
+
"atom": {
|
| 1287 |
+
"map_num": 25
|
| 1288 |
+
}
|
| 1289 |
+
},
|
| 1290 |
+
"restored_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1291 |
+
"exec_match": true,
|
| 1292 |
+
"type_match": true,
|
| 1293 |
+
"parse_error": false,
|
| 1294 |
+
"exec_error": null
|
| 1295 |
+
},
|
| 1296 |
+
{
|
| 1297 |
+
"id": "000065",
|
| 1298 |
+
"op_type": "add_bond",
|
| 1299 |
+
"image_path": "images/000065.png",
|
| 1300 |
+
"wrong_smiles_mapped": "[CH3:1][CH2:2][CH2:3][CH2:4][CH2:5][CH2:6][CH2:7][CH2:8][CH2:9][CH2:10][N:11]([CH3:12])[c:13]1[cH:14][c:15]([CH2:16][OH:17])[cH:18][c:19]([NH2:20])[cH:24]1.[CH:21]([CH3:22])=[O:23]",
|
| 1301 |
+
"correct_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1302 |
+
"predicted_raw": "{\"type\":\"AddBond\",\"bond\":{\"atom1\":{\"map_num\":20},\"atom2\":{\"map_num\":21}},\"order\":\"SINGLE\"}",
|
| 1303 |
+
"predicted_action": {
|
| 1304 |
+
"type": "AddBond",
|
| 1305 |
+
"bond": {
|
| 1306 |
+
"atom1": {
|
| 1307 |
+
"map_num": 20
|
| 1308 |
+
},
|
| 1309 |
+
"atom2": {
|
| 1310 |
+
"map_num": 21
|
| 1311 |
+
}
|
| 1312 |
+
},
|
| 1313 |
+
"order": "SINGLE"
|
| 1314 |
+
},
|
| 1315 |
+
"restored_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1316 |
+
"exec_match": true,
|
| 1317 |
+
"type_match": true,
|
| 1318 |
+
"parse_error": false,
|
| 1319 |
+
"exec_error": null
|
| 1320 |
+
},
|
| 1321 |
+
{
|
| 1322 |
+
"id": "000063",
|
| 1323 |
+
"op_type": "change_bond_order",
|
| 1324 |
+
"image_path": "images/000063.png",
|
| 1325 |
+
"wrong_smiles_mapped": "[CH3:1][CH2:2][CH2:3][CH2:4][CH2:5][CH:6]=[CH:7][CH2:8][CH2:9][CH2:10][N:11]([CH3:12])[c:13]1[cH:14][c:15]([CH2:16][OH:17])[cH:18][c:19]([NH:20][C:21]([CH3:22])=[O:23])[cH:24]1",
|
| 1326 |
+
"correct_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1327 |
+
"predicted_raw": "{\"type\":\"ChangeBond\",\"bond\":{\"atom1\":{\"map_num\":6},\"atom2\":{\"map_num\":7}},\"order\":\"SINGLE\"}",
|
| 1328 |
+
"predicted_action": {
|
| 1329 |
+
"type": "ChangeBond",
|
| 1330 |
+
"bond": {
|
| 1331 |
+
"atom1": {
|
| 1332 |
+
"map_num": 6
|
| 1333 |
+
},
|
| 1334 |
+
"atom2": {
|
| 1335 |
+
"map_num": 7
|
| 1336 |
+
}
|
| 1337 |
+
},
|
| 1338 |
+
"order": "SINGLE"
|
| 1339 |
+
},
|
| 1340 |
+
"restored_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1341 |
+
"exec_match": true,
|
| 1342 |
+
"type_match": true,
|
| 1343 |
+
"parse_error": false,
|
| 1344 |
+
"exec_error": null
|
| 1345 |
+
},
|
| 1346 |
+
{
|
| 1347 |
+
"id": "000066",
|
| 1348 |
+
"op_type": "remove_functional_group",
|
| 1349 |
+
"image_path": "images/000066.png",
|
| 1350 |
+
"wrong_smiles_mapped": "[CH3:1][CH:2]([CH2:3][CH2:4][CH2:5][CH2:6][CH2:7][CH2:8][CH2:9][CH2:10][N:11]([CH3:12])[c:13]1[cH:14][c:15]([CH2:16][OH:17])[cH:18][c:19]([NH:20][C:21]([CH3:22])=[O:23])[cH:24]1)[OH:25]",
|
| 1351 |
+
"correct_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1352 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":25}}",
|
| 1353 |
+
"predicted_action": {
|
| 1354 |
+
"type": "RemoveAtom",
|
| 1355 |
+
"atom": {
|
| 1356 |
+
"map_num": 25
|
| 1357 |
+
}
|
| 1358 |
+
},
|
| 1359 |
+
"restored_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1360 |
+
"exec_match": true,
|
| 1361 |
+
"type_match": false,
|
| 1362 |
+
"parse_error": false,
|
| 1363 |
+
"exec_error": null
|
| 1364 |
+
},
|
| 1365 |
+
{
|
| 1366 |
+
"id": "000064",
|
| 1367 |
+
"op_type": "remove_bond",
|
| 1368 |
+
"image_path": "images/000064.png",
|
| 1369 |
+
"wrong_smiles_mapped": "[CH3:1][CH2:2][CH2:3][CH2:4][CH2:5][CH2:6][CH:7]1[CH2:8][CH2:9][CH2:10][N:11]([CH3:12])[c:13]2[cH:14][c:15]([CH2:16][OH:17])[c:18]1[c:19]([NH:20][C:21]([CH3:22])=[O:23])[cH:24]2",
|
| 1370 |
+
"correct_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1371 |
+
"predicted_raw": "{\"type\":\"RemoveBond\",\"bond\":{\"atom1\":{\"map_num\":7},\"atom2\":{\"map_num\":18}}}",
|
| 1372 |
+
"predicted_action": {
|
| 1373 |
+
"type": "RemoveBond",
|
| 1374 |
+
"bond": {
|
| 1375 |
+
"atom1": {
|
| 1376 |
+
"map_num": 7
|
| 1377 |
+
},
|
| 1378 |
+
"atom2": {
|
| 1379 |
+
"map_num": 18
|
| 1380 |
+
}
|
| 1381 |
+
}
|
| 1382 |
+
},
|
| 1383 |
+
"restored_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1384 |
+
"exec_match": true,
|
| 1385 |
+
"type_match": true,
|
| 1386 |
+
"parse_error": false,
|
| 1387 |
+
"exec_error": null
|
| 1388 |
+
},
|
| 1389 |
+
{
|
| 1390 |
+
"id": "000062",
|
| 1391 |
+
"op_type": "change_charge",
|
| 1392 |
+
"image_path": "images/000062.png",
|
| 1393 |
+
"wrong_smiles_mapped": "[CH3:1][CH2:2][CH2:3][CH2:4][CH2:5][CH2:6][CH2:7][CH2:8][CH2:9][CH2:10][NH+:11]([CH3:12])[c:13]1[cH:14][c:15]([CH2:16][OH:17])[cH:18][c:19]([NH:20][C:21]([CH3:22])=[O:23])[cH:24]1",
|
| 1394 |
+
"correct_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1395 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":11},\"element\":\"N\",\"charge\":0}",
|
| 1396 |
+
"predicted_action": {
|
| 1397 |
+
"type": "ChangeAtom",
|
| 1398 |
+
"atom": {
|
| 1399 |
+
"map_num": 11
|
| 1400 |
+
},
|
| 1401 |
+
"element": "N",
|
| 1402 |
+
"charge": 0
|
| 1403 |
+
},
|
| 1404 |
+
"restored_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1405 |
+
"exec_match": true,
|
| 1406 |
+
"type_match": true,
|
| 1407 |
+
"parse_error": false,
|
| 1408 |
+
"exec_error": null
|
| 1409 |
+
},
|
| 1410 |
+
{
|
| 1411 |
+
"id": "000067",
|
| 1412 |
+
"op_type": "add_functional_group",
|
| 1413 |
+
"image_path": "images/000067.png",
|
| 1414 |
+
"wrong_smiles_mapped": "[CH3:1][CH2:2][CH2:3][CH2:4][CH2:5][CH2:6][CH2:7][CH2:8][CH2:9][CH2:10][N:11]([CH3:12])[c:13]1[cH:14][c:15]([CH3:16])[cH:17][c:18]([NH:19][C:20]([CH3:21])=[O:22])[cH:23]1",
|
| 1415 |
+
"correct_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1416 |
+
"predicted_raw": "{\"type\":\"AddGroup\",\"anchor\":{\"map_num\":16},\"group\":\"OH\"}",
|
| 1417 |
+
"predicted_action": {
|
| 1418 |
+
"type": "AddGroup",
|
| 1419 |
+
"anchor": {
|
| 1420 |
+
"map_num": 16
|
| 1421 |
+
},
|
| 1422 |
+
"group": "OH"
|
| 1423 |
+
},
|
| 1424 |
+
"restored_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1425 |
+
"exec_match": true,
|
| 1426 |
+
"type_match": true,
|
| 1427 |
+
"parse_error": false,
|
| 1428 |
+
"exec_error": null
|
| 1429 |
+
},
|
| 1430 |
+
{
|
| 1431 |
+
"id": "000072",
|
| 1432 |
+
"op_type": "change_charge",
|
| 1433 |
+
"image_path": "images/000072.png",
|
| 1434 |
+
"wrong_smiles_mapped": "[O:1]=[C:2]([CH2:3][CH2:4][CH2:5][NH+:6]1[CH2:7][CH2:8][C:9]2([CH2:10][CH2:11]1)[C:12](=[O:13])[NH:14][CH2:15][N:16]2[c:17]1[cH:18][cH:19][cH:20][cH:21][cH:22]1)[c:23]1[cH:24][cH:25][c:26]([F:27])[cH:28][cH:29]1",
|
| 1435 |
+
"correct_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1436 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":6},\"element\":\"N\",\"charge\":0}",
|
| 1437 |
+
"predicted_action": {
|
| 1438 |
+
"type": "ChangeAtom",
|
| 1439 |
+
"atom": {
|
| 1440 |
+
"map_num": 6
|
| 1441 |
+
},
|
| 1442 |
+
"element": "N",
|
| 1443 |
+
"charge": 0
|
| 1444 |
+
},
|
| 1445 |
+
"restored_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1446 |
+
"exec_match": true,
|
| 1447 |
+
"type_match": true,
|
| 1448 |
+
"parse_error": false,
|
| 1449 |
+
"exec_error": null
|
| 1450 |
+
},
|
| 1451 |
+
{
|
| 1452 |
+
"id": "000069",
|
| 1453 |
+
"op_type": "change_atom_element",
|
| 1454 |
+
"image_path": "images/000069.png",
|
| 1455 |
+
"wrong_smiles_mapped": "[O:1]=[C:2]([CH2:3][CH2:4][CH2:5][N:6]1[CH2:7][CH2:8][C:9]2([CH2:10][O:11]1)[C:12](=[O:13])[NH:14][CH2:15][N:16]2[c:17]1[cH:18][cH:19][cH:20][cH:21][cH:22]1)[c:23]1[cH:24][cH:25][c:26]([F:27])[cH:28][cH:29]1",
|
| 1456 |
+
"correct_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1457 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":11},\"element\":\"C\",\"charge\":0}",
|
| 1458 |
+
"predicted_action": {
|
| 1459 |
+
"type": "ChangeAtom",
|
| 1460 |
+
"atom": {
|
| 1461 |
+
"map_num": 11
|
| 1462 |
+
},
|
| 1463 |
+
"element": "C",
|
| 1464 |
+
"charge": 0
|
| 1465 |
+
},
|
| 1466 |
+
"restored_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1467 |
+
"exec_match": true,
|
| 1468 |
+
"type_match": true,
|
| 1469 |
+
"parse_error": false,
|
| 1470 |
+
"exec_error": null
|
| 1471 |
+
},
|
| 1472 |
+
{
|
| 1473 |
+
"id": "000071",
|
| 1474 |
+
"op_type": "add_atom",
|
| 1475 |
+
"image_path": "images/000071.png",
|
| 1476 |
+
"wrong_smiles_mapped": "[CH2:1]([CH2:2][CH2:3][CH2:4][N:5]1[CH2:6][CH2:7][C:8]2([CH2:9][CH2:10]1)[C:11](=[O:12])[NH:13][CH2:14][N:15]2[c:16]1[cH:17][cH:18][cH:19][cH:20][cH:21]1)[c:22]1[cH:23][cH:24][c:25]([F:26])[cH:27][cH:28]1",
|
| 1477 |
+
"correct_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1478 |
+
"predicted_raw": "{\"type\":\"AddAtom\",\"anchor\":{\"map_num\":1},\"element\":\"O\",\"bond_order\":\"DOUBLE\"}",
|
| 1479 |
+
"predicted_action": {
|
| 1480 |
+
"type": "AddAtom",
|
| 1481 |
+
"anchor": {
|
| 1482 |
+
"map_num": 1
|
| 1483 |
+
},
|
| 1484 |
+
"element": "O",
|
| 1485 |
+
"bond_order": "DOUBLE"
|
| 1486 |
+
},
|
| 1487 |
+
"restored_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1488 |
+
"exec_match": true,
|
| 1489 |
+
"type_match": true,
|
| 1490 |
+
"parse_error": false,
|
| 1491 |
+
"exec_error": null
|
| 1492 |
+
},
|
| 1493 |
+
{
|
| 1494 |
+
"id": "000073",
|
| 1495 |
+
"op_type": "change_bond_order",
|
| 1496 |
+
"image_path": "images/000073.png",
|
| 1497 |
+
"wrong_smiles_mapped": "[O:1]=[C:2]([CH:3]=[CH:4][CH2:5][N:6]1[CH2:7][CH2:8][C:9]2([CH2:10][CH2:11]1)[C:12](=[O:13])[NH:14][CH2:15][N:16]2[c:17]1[cH:18][cH:19][cH:20][cH:21][cH:22]1)[c:23]1[cH:24][cH:25][c:26]([F:27])[cH:28][cH:29]1",
|
| 1498 |
+
"correct_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1499 |
+
"predicted_raw": "{\"type\":\"ChangeBond\",\"bond\":{\"atom1\":{\"map_num\":3},\"atom2\":{\"map_num\":4}},\"order\":\"SINGLE\"}",
|
| 1500 |
+
"predicted_action": {
|
| 1501 |
+
"type": "ChangeBond",
|
| 1502 |
+
"bond": {
|
| 1503 |
+
"atom1": {
|
| 1504 |
+
"map_num": 3
|
| 1505 |
+
},
|
| 1506 |
+
"atom2": {
|
| 1507 |
+
"map_num": 4
|
| 1508 |
+
}
|
| 1509 |
+
},
|
| 1510 |
+
"order": "SINGLE"
|
| 1511 |
+
},
|
| 1512 |
+
"restored_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1513 |
+
"exec_match": true,
|
| 1514 |
+
"type_match": true,
|
| 1515 |
+
"parse_error": false,
|
| 1516 |
+
"exec_error": null
|
| 1517 |
+
},
|
| 1518 |
+
{
|
| 1519 |
+
"id": "000075",
|
| 1520 |
+
"op_type": "add_bond",
|
| 1521 |
+
"image_path": "images/000075.png",
|
| 1522 |
+
"wrong_smiles_mapped": "[CH3:3][CH2:4][CH2:5][N:6]1[CH2:7][CH2:8][C:9]2([CH2:10][CH2:11]1)[C:12](=[O:13])[NH:14][CH2:15][N:16]2[c:17]1[cH:18][cH:19][cH:20][cH:21][cH:22]1.[O:1]=[CH:2][c:23]1[cH:24][cH:25][c:26]([F:27])[cH:28][cH:29]1",
|
| 1523 |
+
"correct_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1524 |
+
"predicted_raw": "{\"type\":\"AddBond\",\"bond\":{\"atom1\":{\"map_num\":2},\"atom2\":{\"map_num\":3}},\"order\":\"SINGLE\"}",
|
| 1525 |
+
"predicted_action": {
|
| 1526 |
+
"type": "AddBond",
|
| 1527 |
+
"bond": {
|
| 1528 |
+
"atom1": {
|
| 1529 |
+
"map_num": 2
|
| 1530 |
+
},
|
| 1531 |
+
"atom2": {
|
| 1532 |
+
"map_num": 3
|
| 1533 |
+
}
|
| 1534 |
+
},
|
| 1535 |
+
"order": "SINGLE"
|
| 1536 |
+
},
|
| 1537 |
+
"restored_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1538 |
+
"exec_match": true,
|
| 1539 |
+
"type_match": true,
|
| 1540 |
+
"parse_error": false,
|
| 1541 |
+
"exec_error": null
|
| 1542 |
+
},
|
| 1543 |
+
{
|
| 1544 |
+
"id": "000070",
|
| 1545 |
+
"op_type": "remove_atom",
|
| 1546 |
+
"image_path": "images/000070.png",
|
| 1547 |
+
"wrong_smiles_mapped": "[O:1]=[C:2]([CH2:3][CH2:4][CH2:5][N:6]1[CH:7]([OH:30])[CH2:8][C:9]2([CH2:10][CH2:11]1)[C:12](=[O:13])[NH:14][CH2:15][N:16]2[c:17]1[cH:18][cH:19][cH:20][cH:21][cH:22]1)[c:23]1[cH:24][cH:25][c:26]([F:27])[cH:28][cH:29]1",
|
| 1548 |
+
"correct_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1549 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":30}}",
|
| 1550 |
+
"predicted_action": {
|
| 1551 |
+
"type": "RemoveAtom",
|
| 1552 |
+
"atom": {
|
| 1553 |
+
"map_num": 30
|
| 1554 |
+
}
|
| 1555 |
+
},
|
| 1556 |
+
"restored_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1557 |
+
"exec_match": true,
|
| 1558 |
+
"type_match": true,
|
| 1559 |
+
"parse_error": false,
|
| 1560 |
+
"exec_error": null
|
| 1561 |
+
},
|
| 1562 |
+
{
|
| 1563 |
+
"id": "000074",
|
| 1564 |
+
"op_type": "remove_bond",
|
| 1565 |
+
"image_path": "images/000074.png",
|
| 1566 |
+
"wrong_smiles_mapped": "[O:1]=[C:2]([CH:3]1[CH2:4][CH2:5][N:6]2[CH2:7][CH2:8][C:9]3([CH:10]1[CH2:11]2)[C:12](=[O:13])[NH:14][CH2:15][N:16]3[c:17]1[cH:18][cH:19][cH:20][cH:21][cH:22]1)[c:23]1[cH:24][cH:25][c:26]([F:27])[cH:28][cH:29]1",
|
| 1567 |
+
"correct_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1568 |
+
"predicted_raw": "{\"type\":\"RemoveBond\",\"bond\":{\"atom1\":{\"map_num\":3},\"atom2\":{\"map_num\":10}}}",
|
| 1569 |
+
"predicted_action": {
|
| 1570 |
+
"type": "RemoveBond",
|
| 1571 |
+
"bond": {
|
| 1572 |
+
"atom1": {
|
| 1573 |
+
"map_num": 3
|
| 1574 |
+
},
|
| 1575 |
+
"atom2": {
|
| 1576 |
+
"map_num": 10
|
| 1577 |
+
}
|
| 1578 |
+
}
|
| 1579 |
+
},
|
| 1580 |
+
"restored_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1581 |
+
"exec_match": true,
|
| 1582 |
+
"type_match": true,
|
| 1583 |
+
"parse_error": false,
|
| 1584 |
+
"exec_error": null
|
| 1585 |
+
},
|
| 1586 |
+
{
|
| 1587 |
+
"id": "000076",
|
| 1588 |
+
"op_type": "remove_functional_group",
|
| 1589 |
+
"image_path": "images/000076.png",
|
| 1590 |
+
"wrong_smiles_mapped": "[O:1]=[C:2]([CH2:3][CH2:4][CH2:5][N:6]1[CH2:7][CH2:8][C:9]2([CH2:10][CH2:11]1)[C:12](=[O:13])[NH:14][CH2:15][N:16]2[c:17]1[cH:18][cH:19][cH:20][cH:21][cH:22]1)[c:23]1[cH:24][cH:25][c:26]([F:27])[c:28]([F:30])[cH:29]1",
|
| 1591 |
+
"correct_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1592 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":30}}",
|
| 1593 |
+
"predicted_action": {
|
| 1594 |
+
"type": "RemoveAtom",
|
| 1595 |
+
"atom": {
|
| 1596 |
+
"map_num": 30
|
| 1597 |
+
}
|
| 1598 |
+
},
|
| 1599 |
+
"restored_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1600 |
+
"exec_match": true,
|
| 1601 |
+
"type_match": false,
|
| 1602 |
+
"parse_error": false,
|
| 1603 |
+
"exec_error": null
|
| 1604 |
+
},
|
| 1605 |
+
{
|
| 1606 |
+
"id": "000077",
|
| 1607 |
+
"op_type": "add_functional_group",
|
| 1608 |
+
"image_path": "images/000077.png",
|
| 1609 |
+
"wrong_smiles_mapped": "[O:1]=[C:2]([CH2:3][CH2:4][CH2:5][N:6]1[CH2:7][CH2:8][C:9]2([CH2:10][CH2:11]1)[C:12](=[O:13])[NH:14][CH2:15][N:16]2[c:17]1[cH:18][cH:19][cH:20][cH:21][cH:22]1)[c:23]1[cH:24][cH:25][cH:26][cH:27][cH:28]1",
|
| 1610 |
+
"correct_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1611 |
+
"predicted_raw": "{\"type\":\"AddGroup\",\"anchor\":{\"map_num\":26},\"group\":\"F\"}",
|
| 1612 |
+
"predicted_action": {
|
| 1613 |
+
"type": "AddGroup",
|
| 1614 |
+
"anchor": {
|
| 1615 |
+
"map_num": 26
|
| 1616 |
+
},
|
| 1617 |
+
"group": "F"
|
| 1618 |
+
},
|
| 1619 |
+
"restored_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1620 |
+
"exec_match": true,
|
| 1621 |
+
"type_match": true,
|
| 1622 |
+
"parse_error": false,
|
| 1623 |
+
"exec_error": null
|
| 1624 |
+
},
|
| 1625 |
+
{
|
| 1626 |
+
"id": "000068",
|
| 1627 |
+
"op_type": "move_substituent",
|
| 1628 |
+
"image_path": "images/000068.png",
|
| 1629 |
+
"wrong_smiles_mapped": "[CH3:1][CH2:2][CH2:3][CH2:4][CH2:5][CH2:6][CH2:7][CH2:8][CH2:9][CH2:10][N:11]([CH3:12])[c:13]1[cH:14][cH:15][cH:18][c:19]([NH:20][C:21]([CH3:22])=[O:23])[c:24]1[CH2:16][OH:17]",
|
| 1630 |
+
"correct_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1631 |
+
"predicted_raw": "{\"type\":\"MoveSubstituent\",\"substituent\":{\"map_num\":16},\"from_atom\":{\"map_num\":24},\"to_atom\":{\"map_num\":15}}",
|
| 1632 |
+
"predicted_action": {
|
| 1633 |
+
"type": "MoveSubstituent",
|
| 1634 |
+
"substituent": {
|
| 1635 |
+
"map_num": 16
|
| 1636 |
+
},
|
| 1637 |
+
"from_atom": {
|
| 1638 |
+
"map_num": 24
|
| 1639 |
+
},
|
| 1640 |
+
"to_atom": {
|
| 1641 |
+
"map_num": 15
|
| 1642 |
+
}
|
| 1643 |
+
},
|
| 1644 |
+
"restored_smiles": "CCCCCCCCCCN(C)c1cc(CO)cc(NC(C)=O)c1",
|
| 1645 |
+
"exec_match": true,
|
| 1646 |
+
"type_match": true,
|
| 1647 |
+
"parse_error": false,
|
| 1648 |
+
"exec_error": null
|
| 1649 |
+
},
|
| 1650 |
+
{
|
| 1651 |
+
"id": "000078",
|
| 1652 |
+
"op_type": "move_substituent",
|
| 1653 |
+
"image_path": "images/000078.png",
|
| 1654 |
+
"wrong_smiles_mapped": "[O:1]=[C:2]([CH2:3][CH2:4][CH2:5][N:6]1[CH2:7][CH2:8][C:9]2([CH2:10][CH2:11]1)[C:12](=[O:13])[NH:14][CH2:15][N:16]2[c:17]1[cH:18][cH:19][cH:20][cH:21][cH:22]1)[c:23]1[cH:24][c:25]([F:27])[cH:26][cH:28][cH:29]1",
|
| 1655 |
+
"correct_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1656 |
+
"predicted_raw": "{\"type\":\"MoveSubstituent\",\"substituent\":{\"map_num\":27},\"from_atom\":{\"map_num\":25},\"to_atom\":{\"map_num\":26}}",
|
| 1657 |
+
"predicted_action": {
|
| 1658 |
+
"type": "MoveSubstituent",
|
| 1659 |
+
"substituent": {
|
| 1660 |
+
"map_num": 27
|
| 1661 |
+
},
|
| 1662 |
+
"from_atom": {
|
| 1663 |
+
"map_num": 25
|
| 1664 |
+
},
|
| 1665 |
+
"to_atom": {
|
| 1666 |
+
"map_num": 26
|
| 1667 |
+
}
|
| 1668 |
+
},
|
| 1669 |
+
"restored_smiles": "O=C(CCCN1CCC2(CC1)C(=O)NCN2c1ccccc1)c1ccc(F)cc1",
|
| 1670 |
+
"exec_match": true,
|
| 1671 |
+
"type_match": true,
|
| 1672 |
+
"parse_error": false,
|
| 1673 |
+
"exec_error": null
|
| 1674 |
+
},
|
| 1675 |
+
{
|
| 1676 |
+
"id": "000079",
|
| 1677 |
+
"op_type": "change_atom_element",
|
| 1678 |
+
"image_path": "images/000079.png",
|
| 1679 |
+
"wrong_smiles_mapped": "[CH3:1][O:2][c:3]1[cH:4][c:5]2[c:6]([c:7]([O:8][CH3:9])[c:10]1[O:11][CH3:12])-[c:13]1[cH:14][c:15]3[c:16]([cH:17][c:18]1[C:19](=[O:20])[CH:21]1[CH2:22][S:23][C:24](=[O:25])[CH:26]1[CH2:27]2)[O:28][CH2:29][O:30]3",
|
| 1680 |
+
"correct_smiles": "COc1cc2c(c(OC)c1OC)-c1cc3c(cc1C(=O)C1COC(=O)C1C2)OCO3",
|
| 1681 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":23},\"element\":\"O\",\"charge\":0}",
|
| 1682 |
+
"predicted_action": {
|
| 1683 |
+
"type": "ChangeAtom",
|
| 1684 |
+
"atom": {
|
| 1685 |
+
"map_num": 23
|
| 1686 |
+
},
|
| 1687 |
+
"element": "O",
|
| 1688 |
+
"charge": 0
|
| 1689 |
+
},
|
| 1690 |
+
"restored_smiles": "COc1cc2c(c(OC)c1OC)-c1cc3c(cc1C(=O)C1COC(=O)C1C2)OCO3",
|
| 1691 |
+
"exec_match": true,
|
| 1692 |
+
"type_match": true,
|
| 1693 |
+
"parse_error": false,
|
| 1694 |
+
"exec_error": null
|
| 1695 |
+
},
|
| 1696 |
+
{
|
| 1697 |
+
"id": "000081",
|
| 1698 |
+
"op_type": "add_atom",
|
| 1699 |
+
"image_path": "images/000081.png",
|
| 1700 |
+
"wrong_smiles_mapped": "[OH:1][c:2]1[cH:3][c:4]2[c:5]([c:6]([O:7][CH3:8])[c:9]1[O:10][CH3:11])-[c:12]1[cH:13][c:14]3[c:15]([cH:16][c:17]1[C:18](=[O:19])[CH:20]1[CH2:21][O:22][C:23](=[O:24])[CH:25]1[CH2:26]2)[O:27][CH2:28][O:29]3",
|
| 1701 |
+
"correct_smiles": "COc1cc2c(c(OC)c1OC)-c1cc3c(cc1C(=O)C1COC(=O)C1C2)OCO3",
|
| 1702 |
+
"predicted_raw": "{\"type\":\"AddAtom\",\"anchor\":{\"map_num\":1},\"element\":\"C\",\"bond_order\":\"SINGLE\"}",
|
| 1703 |
+
"predicted_action": {
|
| 1704 |
+
"type": "AddAtom",
|
| 1705 |
+
"anchor": {
|
| 1706 |
+
"map_num": 1
|
| 1707 |
+
},
|
| 1708 |
+
"element": "C",
|
| 1709 |
+
"bond_order": "SINGLE"
|
| 1710 |
+
},
|
| 1711 |
+
"restored_smiles": "COc1cc2c(c(OC)c1OC)-c1cc3c(cc1C(=O)C1COC(=O)C1C2)OCO3",
|
| 1712 |
+
"exec_match": true,
|
| 1713 |
+
"type_match": true,
|
| 1714 |
+
"parse_error": false,
|
| 1715 |
+
"exec_error": null
|
| 1716 |
+
},
|
| 1717 |
+
{
|
| 1718 |
+
"id": "000082",
|
| 1719 |
+
"op_type": "change_charge",
|
| 1720 |
+
"image_path": "images/000082.png",
|
| 1721 |
+
"wrong_smiles_mapped": "[CH3:1][O:2][c:3]1[cH:4][c:5]2[c:6]([c:7]([O:8][CH3:9])[c:10]1[O:11][CH3:12])-[c:13]1[cH:14][c:15]3[c:16]([cH:17][c:18]1[C:19](=[O:20])[CH:21]1[CH2:22][O:23][C:24](=[OH+:25])[CH:26]1[CH2:27]2)[O:28][CH2:29][O:30]3",
|
| 1722 |
+
"correct_smiles": "COc1cc2c(c(OC)c1OC)-c1cc3c(cc1C(=O)C1COC(=O)C1C2)OCO3",
|
| 1723 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":25},\"element\":\"O\",\"charge\":0}",
|
| 1724 |
+
"predicted_action": {
|
| 1725 |
+
"type": "ChangeAtom",
|
| 1726 |
+
"atom": {
|
| 1727 |
+
"map_num": 25
|
| 1728 |
+
},
|
| 1729 |
+
"element": "O",
|
| 1730 |
+
"charge": 0
|
| 1731 |
+
},
|
| 1732 |
+
"restored_smiles": "COc1cc2c(c(OC)c1OC)-c1cc3c(cc1C(=O)C1COC(=O)C1C2)OCO3",
|
| 1733 |
+
"exec_match": true,
|
| 1734 |
+
"type_match": true,
|
| 1735 |
+
"parse_error": false,
|
| 1736 |
+
"exec_error": null
|
| 1737 |
+
},
|
| 1738 |
+
{
|
| 1739 |
+
"id": "000085",
|
| 1740 |
+
"op_type": "add_bond",
|
| 1741 |
+
"image_path": "images/000085.png",
|
| 1742 |
+
"wrong_smiles_mapped": "[CH3:1][O:2][c:3]1[cH:4][c:5]2[c:6]([cH:7][c:10]1[O:11][CH3:12])-[c:13]1[cH:14][c:15]3[c:16]([cH:17][c:18]1[C:19](=[O:20])[CH:21]1[CH2:22][O:23][C:24](=[O:25])[CH:26]1[CH2:27]2)[O:28][CH2:29][O:30]3.[OH:8][CH3:9]",
|
| 1743 |
+
"correct_smiles": "COc1cc2c(c(OC)c1OC)-c1cc3c(cc1C(=O)C1COC(=O)C1C2)OCO3",
|
| 1744 |
+
"predicted_raw": "{\"type\":\"AddBond\",\"bond\":{\"atom1\":{\"map_num\":7},\"atom2\":{\"map_num\":8}},\"order\":\"SINGLE\"}",
|
| 1745 |
+
"predicted_action": {
|
| 1746 |
+
"type": "AddBond",
|
| 1747 |
+
"bond": {
|
| 1748 |
+
"atom1": {
|
| 1749 |
+
"map_num": 7
|
| 1750 |
+
},
|
| 1751 |
+
"atom2": {
|
| 1752 |
+
"map_num": 8
|
| 1753 |
+
}
|
| 1754 |
+
},
|
| 1755 |
+
"order": "SINGLE"
|
| 1756 |
+
},
|
| 1757 |
+
"restored_smiles": "COc1cc2c(c(OC)c1OC)-c1cc3c(cc1C(=O)C1COC(=O)C1C2)OCO3",
|
| 1758 |
+
"exec_match": true,
|
| 1759 |
+
"type_match": true,
|
| 1760 |
+
"parse_error": false,
|
| 1761 |
+
"exec_error": null
|
| 1762 |
+
},
|
| 1763 |
+
{
|
| 1764 |
+
"id": "000080",
|
| 1765 |
+
"op_type": "remove_atom",
|
| 1766 |
+
"image_path": "images/000080.png",
|
| 1767 |
+
"wrong_smiles_mapped": "[CH3:1][O:2][c:3]1[cH:4][c:5]2[c:6]([c:7]([O:8][CH3:9])[c:10]1[O:11][CH3:12])-[c:13]1[cH:14][c:15]3[c:16]([cH:17][c:18]1[C:19](=[O:20])[CH:21]1[CH:22]([OH:31])[O:23][C:24](=[O:25])[CH:26]1[CH2:27]2)[O:28][CH2:29][O:30]3",
|
| 1768 |
+
"correct_smiles": "COc1cc2c(c(OC)c1OC)-c1cc3c(cc1C(=O)C1COC(=O)C1C2)OCO3",
|
| 1769 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":31}}",
|
| 1770 |
+
"predicted_action": {
|
| 1771 |
+
"type": "RemoveAtom",
|
| 1772 |
+
"atom": {
|
| 1773 |
+
"map_num": 31
|
| 1774 |
+
}
|
| 1775 |
+
},
|
| 1776 |
+
"restored_smiles": "COc1cc2c(c(OC)c1OC)-c1cc3c(cc1C(=O)C1COC(=O)C1C2)OCO3",
|
| 1777 |
+
"exec_match": true,
|
| 1778 |
+
"type_match": true,
|
| 1779 |
+
"parse_error": false,
|
| 1780 |
+
"exec_error": null
|
| 1781 |
+
},
|
| 1782 |
+
{
|
| 1783 |
+
"id": "000086",
|
| 1784 |
+
"op_type": "remove_functional_group",
|
| 1785 |
+
"image_path": "images/000086.png",
|
| 1786 |
+
"wrong_smiles_mapped": "[CH3:1][O:2][c:3]1[cH:4][c:5]2[c:6]([c:7]([O:8][CH3:9])[c:10]1[O:11][CH3:12])-[c:13]1[cH:14][c:15]3[c:16]([cH:17][c:18]1[C:19](=[O:20])[C:21]1([NH2:31])[CH2:22][O:23][C:24](=[O:25])[CH:26]1[CH2:27]2)[O:28][CH2:29][O:30]3",
|
| 1787 |
+
"correct_smiles": "COc1cc2c(c(OC)c1OC)-c1cc3c(cc1C(=O)C1COC(=O)C1C2)OCO3",
|
| 1788 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":31}}",
|
| 1789 |
+
"predicted_action": {
|
| 1790 |
+
"type": "RemoveAtom",
|
| 1791 |
+
"atom": {
|
| 1792 |
+
"map_num": 31
|
| 1793 |
+
}
|
| 1794 |
+
},
|
| 1795 |
+
"restored_smiles": "COc1cc2c(c(OC)c1OC)-c1cc3c(cc1C(=O)C1COC(=O)C1C2)OCO3",
|
| 1796 |
+
"exec_match": true,
|
| 1797 |
+
"type_match": false,
|
| 1798 |
+
"parse_error": false,
|
| 1799 |
+
"exec_error": null
|
| 1800 |
+
},
|
| 1801 |
+
{
|
| 1802 |
+
"id": "000083",
|
| 1803 |
+
"op_type": "change_bond_order",
|
| 1804 |
+
"image_path": "images/000083.png",
|
| 1805 |
+
"wrong_smiles_mapped": "[CH3:1][O:2][c:3]1[cH:4][c:5]2[c:6]([c:7]([O:8][CH3:9])[c:10]1[O:11][CH3:12])-[c:13]1[cH:14][c:15]3[c:16]([cH:17][c:18]1[CH:19]([OH:20])[CH:21]1[CH2:22][O:23][C:24](=[O:25])[CH:26]1[CH2:27]2)[O:28][CH2:29][O:30]3",
|
| 1806 |
+
"correct_smiles": "COc1cc2c(c(OC)c1OC)-c1cc3c(cc1C(=O)C1COC(=O)C1C2)OCO3",
|
| 1807 |
+
"predicted_raw": "{\"type\":\"ChangeBond\",\"bond\":{\"atom1\":{\"map_num\":19},\"atom2\":{\"map_num\":20}},\"order\":\"DOUBLE\"}",
|
| 1808 |
+
"predicted_action": {
|
| 1809 |
+
"type": "ChangeBond",
|
| 1810 |
+
"bond": {
|
| 1811 |
+
"atom1": {
|
| 1812 |
+
"map_num": 19
|
| 1813 |
+
},
|
| 1814 |
+
"atom2": {
|
| 1815 |
+
"map_num": 20
|
| 1816 |
+
}
|
| 1817 |
+
},
|
| 1818 |
+
"order": "DOUBLE"
|
| 1819 |
+
},
|
| 1820 |
+
"restored_smiles": "COc1cc2c(c(OC)c1OC)-c1cc3c(cc1C(=O)C1COC(=O)C1C2)OCO3",
|
| 1821 |
+
"exec_match": true,
|
| 1822 |
+
"type_match": true,
|
| 1823 |
+
"parse_error": false,
|
| 1824 |
+
"exec_error": null
|
| 1825 |
+
},
|
| 1826 |
+
{
|
| 1827 |
+
"id": "000088",
|
| 1828 |
+
"op_type": "change_atom_element",
|
| 1829 |
+
"image_path": "images/000088.png",
|
| 1830 |
+
"wrong_smiles_mapped": "[F:1][c:2]1[cH:3][cH:4][c:5]([CH:6]([c:7]2[cH:8][cH:9][c:10]([F:11])[cH:12][cH:13]2)[N:14]2[CH2:15][CH2:16][N:17]([NH:18][CH:19]=[CH:20][c:21]3[cH:22][cH:23][cH:24][cH:25][cH:26]3)[CH2:27][CH2:28]2)[cH:29][cH:30]1",
|
| 1831 |
+
"correct_smiles": "Fc1ccc(C(c2ccc(F)cc2)N2CCN(CC=Cc3ccccc3)CC2)cc1",
|
| 1832 |
+
"predicted_raw": "{\"type\":\"ChangeAtom\",\"atom\":{\"map_num\":18},\"element\":\"C\",\"charge\":0}",
|
| 1833 |
+
"predicted_action": {
|
| 1834 |
+
"type": "ChangeAtom",
|
| 1835 |
+
"atom": {
|
| 1836 |
+
"map_num": 18
|
| 1837 |
+
},
|
| 1838 |
+
"element": "C",
|
| 1839 |
+
"charge": 0
|
| 1840 |
+
},
|
| 1841 |
+
"restored_smiles": "Fc1ccc(C(c2ccc(F)cc2)N2CCN(CC=Cc3ccccc3)CC2)cc1",
|
| 1842 |
+
"exec_match": true,
|
| 1843 |
+
"type_match": true,
|
| 1844 |
+
"parse_error": false,
|
| 1845 |
+
"exec_error": null
|
| 1846 |
+
},
|
| 1847 |
+
{
|
| 1848 |
+
"id": "000084",
|
| 1849 |
+
"op_type": "remove_bond",
|
| 1850 |
+
"image_path": "images/000084.png",
|
| 1851 |
+
"wrong_smiles_mapped": "[CH3:1][O:2][c:3]1[cH:4][c:5]2[c:6]([c:7]([O:8][CH3:9])[c:10]1[O:11][CH3:12])-[c:13]1[cH:14][c:15]3[c:16]([c:17]4[c:18]1[C:19](=[O:20])[CH:21]1[CH2:22][O:23][C:24](=[O:25])[C:26]41[CH2:27]2)[O:28][CH2:29][O:30]3",
|
| 1852 |
+
"correct_smiles": "COc1cc2c(c(OC)c1OC)-c1cc3c(cc1C(=O)C1COC(=O)C1C2)OCO3",
|
| 1853 |
+
"predicted_raw": "",
|
| 1854 |
+
"predicted_action": null,
|
| 1855 |
+
"restored_smiles": null,
|
| 1856 |
+
"exec_match": false,
|
| 1857 |
+
"type_match": false,
|
| 1858 |
+
"parse_error": true,
|
| 1859 |
+
"exec_error": null
|
| 1860 |
+
},
|
| 1861 |
+
{
|
| 1862 |
+
"id": "000090",
|
| 1863 |
+
"op_type": "add_atom",
|
| 1864 |
+
"image_path": "images/000090.png",
|
| 1865 |
+
"wrong_smiles_mapped": "[cH:1]1[cH:2][cH:3][c:4]([CH:5]([c:6]2[cH:7][cH:8][c:9]([F:10])[cH:11][cH:12]2)[N:13]2[CH2:14][CH2:15][N:16]([CH2:17][CH:18]=[CH:19][c:20]3[cH:21][cH:22][cH:23][cH:24][cH:25]3)[CH2:26][CH2:27]2)[cH:28][cH:29]1",
|
| 1866 |
+
"correct_smiles": "Fc1ccc(C(c2ccc(F)cc2)N2CCN(CC=Cc3ccccc3)CC2)cc1",
|
| 1867 |
+
"predicted_raw": "{\"type\":\"AddAtom\",\"anchor\":{\"map_num\":1},\"element\":\"F\",\"bond_order\":\"SINGLE\"}",
|
| 1868 |
+
"predicted_action": {
|
| 1869 |
+
"type": "AddAtom",
|
| 1870 |
+
"anchor": {
|
| 1871 |
+
"map_num": 1
|
| 1872 |
+
},
|
| 1873 |
+
"element": "F",
|
| 1874 |
+
"bond_order": "SINGLE"
|
| 1875 |
+
},
|
| 1876 |
+
"restored_smiles": "Fc1ccc(C(c2ccc(F)cc2)N2CCN(CC=Cc3ccccc3)CC2)cc1",
|
| 1877 |
+
"exec_match": true,
|
| 1878 |
+
"type_match": true,
|
| 1879 |
+
"parse_error": false,
|
| 1880 |
+
"exec_error": null
|
| 1881 |
+
},
|
| 1882 |
+
{
|
| 1883 |
+
"id": "000089",
|
| 1884 |
+
"op_type": "remove_atom",
|
| 1885 |
+
"image_path": "images/000089.png",
|
| 1886 |
+
"wrong_smiles_mapped": "[F:1][c:2]1[cH:3][cH:4][c:5]([CH:6]([c:7]2[cH:8][cH:9][c:10]([F:11])[cH:12][cH:13]2)[N:14]2[CH2:15][CH2:16][N:17]([CH2:18][CH:19]=[CH:20][c:21]3[cH:22][cH:23][cH:24][cH:25][cH:26]3)[CH:27]([CH3:31])[CH2:28]2)[cH:29][cH:30]1",
|
| 1887 |
+
"correct_smiles": "Fc1ccc(C(c2ccc(F)cc2)N2CCN(CC=Cc3ccccc3)CC2)cc1",
|
| 1888 |
+
"predicted_raw": "{\"type\":\"RemoveAtom\",\"atom\":{\"map_num\":31}}",
|
| 1889 |
+
"predicted_action": {
|
| 1890 |
+
"type": "RemoveAtom",
|
| 1891 |
+
"atom": {
|
| 1892 |
+
"map_num": 31
|
| 1893 |
+
}
|
| 1894 |
+
},
|
| 1895 |
+
"restored_smiles": "Fc1ccc(C(c2ccc(F)cc2)N2CCN(CC=Cc3ccccc3)CC2)cc1",
|
| 1896 |
+
"exec_match": true,
|
| 1897 |
+
"type_match": true,
|
| 1898 |
+
"parse_error": false,
|
| 1899 |
+
"exec_error": null
|
| 1900 |
+
}
|
| 1901 |
+
]
|
data/benchmark_summary.json
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"gpt-5.4": {
|
| 3 |
+
"total": 245,
|
| 4 |
+
"exec_match": 63,
|
| 5 |
+
"type_match": 66,
|
| 6 |
+
"parse_error": 0,
|
| 7 |
+
"exec_error": 45,
|
| 8 |
+
"by_op": {
|
| 9 |
+
"add_atom": {
|
| 10 |
+
"n": 20,
|
| 11 |
+
"exec_match": 1,
|
| 12 |
+
"type_match": 0,
|
| 13 |
+
"parse_error": 0,
|
| 14 |
+
"exec_error": 5
|
| 15 |
+
},
|
| 16 |
+
"add_bond": {
|
| 17 |
+
"n": 20,
|
| 18 |
+
"exec_match": 0,
|
| 19 |
+
"type_match": 3,
|
| 20 |
+
"parse_error": 0,
|
| 21 |
+
"exec_error": 6
|
| 22 |
+
},
|
| 23 |
+
"add_functional_group": {
|
| 24 |
+
"n": 20,
|
| 25 |
+
"exec_match": 2,
|
| 26 |
+
"type_match": 6,
|
| 27 |
+
"parse_error": 0,
|
| 28 |
+
"exec_error": 3
|
| 29 |
+
},
|
| 30 |
+
"change_atom_element": {
|
| 31 |
+
"n": 20,
|
| 32 |
+
"exec_match": 4,
|
| 33 |
+
"type_match": 5,
|
| 34 |
+
"parse_error": 0,
|
| 35 |
+
"exec_error": 3
|
| 36 |
+
},
|
| 37 |
+
"change_bond_order": {
|
| 38 |
+
"n": 20,
|
| 39 |
+
"exec_match": 9,
|
| 40 |
+
"type_match": 14,
|
| 41 |
+
"parse_error": 0,
|
| 42 |
+
"exec_error": 2
|
| 43 |
+
},
|
| 44 |
+
"change_charge": {
|
| 45 |
+
"n": 20,
|
| 46 |
+
"exec_match": 10,
|
| 47 |
+
"type_match": 10,
|
| 48 |
+
"parse_error": 0,
|
| 49 |
+
"exec_error": 0
|
| 50 |
+
},
|
| 51 |
+
"flip_chirality": {
|
| 52 |
+
"n": 20,
|
| 53 |
+
"exec_match": 2,
|
| 54 |
+
"type_match": 4,
|
| 55 |
+
"parse_error": 0,
|
| 56 |
+
"exec_error": 4
|
| 57 |
+
},
|
| 58 |
+
"flip_ez": {
|
| 59 |
+
"n": 5,
|
| 60 |
+
"exec_match": 0,
|
| 61 |
+
"type_match": 0,
|
| 62 |
+
"parse_error": 0,
|
| 63 |
+
"exec_error": 1
|
| 64 |
+
},
|
| 65 |
+
"move_substituent": {
|
| 66 |
+
"n": 20,
|
| 67 |
+
"exec_match": 2,
|
| 68 |
+
"type_match": 7,
|
| 69 |
+
"parse_error": 0,
|
| 70 |
+
"exec_error": 6
|
| 71 |
+
},
|
| 72 |
+
"remove_atom": {
|
| 73 |
+
"n": 20,
|
| 74 |
+
"exec_match": 13,
|
| 75 |
+
"type_match": 3,
|
| 76 |
+
"parse_error": 0,
|
| 77 |
+
"exec_error": 2
|
| 78 |
+
},
|
| 79 |
+
"remove_bond": {
|
| 80 |
+
"n": 20,
|
| 81 |
+
"exec_match": 3,
|
| 82 |
+
"type_match": 4,
|
| 83 |
+
"parse_error": 0,
|
| 84 |
+
"exec_error": 6
|
| 85 |
+
},
|
| 86 |
+
"remove_functional_group": {
|
| 87 |
+
"n": 20,
|
| 88 |
+
"exec_match": 17,
|
| 89 |
+
"type_match": 10,
|
| 90 |
+
"parse_error": 0,
|
| 91 |
+
"exec_error": 1
|
| 92 |
+
},
|
| 93 |
+
"swap_substituents": {
|
| 94 |
+
"n": 20,
|
| 95 |
+
"exec_match": 0,
|
| 96 |
+
"type_match": 0,
|
| 97 |
+
"parse_error": 0,
|
| 98 |
+
"exec_error": 6
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
},
|
| 102 |
+
"gemini-3.1-pro-preview": {
|
| 103 |
+
"total": 245,
|
| 104 |
+
"exec_match": 195,
|
| 105 |
+
"type_match": 173,
|
| 106 |
+
"parse_error": 14,
|
| 107 |
+
"exec_error": 8,
|
| 108 |
+
"by_op": {
|
| 109 |
+
"add_atom": {
|
| 110 |
+
"n": 20,
|
| 111 |
+
"exec_match": 19,
|
| 112 |
+
"type_match": 12,
|
| 113 |
+
"parse_error": 1,
|
| 114 |
+
"exec_error": 0
|
| 115 |
+
},
|
| 116 |
+
"add_bond": {
|
| 117 |
+
"n": 20,
|
| 118 |
+
"exec_match": 19,
|
| 119 |
+
"type_match": 20,
|
| 120 |
+
"parse_error": 0,
|
| 121 |
+
"exec_error": 0
|
| 122 |
+
},
|
| 123 |
+
"add_functional_group": {
|
| 124 |
+
"n": 20,
|
| 125 |
+
"exec_match": 17,
|
| 126 |
+
"type_match": 10,
|
| 127 |
+
"parse_error": 0,
|
| 128 |
+
"exec_error": 1
|
| 129 |
+
},
|
| 130 |
+
"change_atom_element": {
|
| 131 |
+
"n": 20,
|
| 132 |
+
"exec_match": 20,
|
| 133 |
+
"type_match": 20,
|
| 134 |
+
"parse_error": 0,
|
| 135 |
+
"exec_error": 0
|
| 136 |
+
},
|
| 137 |
+
"change_bond_order": {
|
| 138 |
+
"n": 20,
|
| 139 |
+
"exec_match": 17,
|
| 140 |
+
"type_match": 17,
|
| 141 |
+
"parse_error": 1,
|
| 142 |
+
"exec_error": 0
|
| 143 |
+
},
|
| 144 |
+
"change_charge": {
|
| 145 |
+
"n": 20,
|
| 146 |
+
"exec_match": 20,
|
| 147 |
+
"type_match": 20,
|
| 148 |
+
"parse_error": 0,
|
| 149 |
+
"exec_error": 0
|
| 150 |
+
},
|
| 151 |
+
"flip_chirality": {
|
| 152 |
+
"n": 20,
|
| 153 |
+
"exec_match": 7,
|
| 154 |
+
"type_match": 12,
|
| 155 |
+
"parse_error": 4,
|
| 156 |
+
"exec_error": 0
|
| 157 |
+
},
|
| 158 |
+
"flip_ez": {
|
| 159 |
+
"n": 5,
|
| 160 |
+
"exec_match": 5,
|
| 161 |
+
"type_match": 5,
|
| 162 |
+
"parse_error": 0,
|
| 163 |
+
"exec_error": 0
|
| 164 |
+
},
|
| 165 |
+
"move_substituent": {
|
| 166 |
+
"n": 20,
|
| 167 |
+
"exec_match": 11,
|
| 168 |
+
"type_match": 14,
|
| 169 |
+
"parse_error": 2,
|
| 170 |
+
"exec_error": 1
|
| 171 |
+
},
|
| 172 |
+
"remove_atom": {
|
| 173 |
+
"n": 20,
|
| 174 |
+
"exec_match": 18,
|
| 175 |
+
"type_match": 17,
|
| 176 |
+
"parse_error": 1,
|
| 177 |
+
"exec_error": 1
|
| 178 |
+
},
|
| 179 |
+
"remove_bond": {
|
| 180 |
+
"n": 20,
|
| 181 |
+
"exec_match": 18,
|
| 182 |
+
"type_match": 18,
|
| 183 |
+
"parse_error": 1,
|
| 184 |
+
"exec_error": 0
|
| 185 |
+
},
|
| 186 |
+
"remove_functional_group": {
|
| 187 |
+
"n": 20,
|
| 188 |
+
"exec_match": 20,
|
| 189 |
+
"type_match": 1,
|
| 190 |
+
"parse_error": 0,
|
| 191 |
+
"exec_error": 0
|
| 192 |
+
},
|
| 193 |
+
"swap_substituents": {
|
| 194 |
+
"n": 20,
|
| 195 |
+
"exec_match": 4,
|
| 196 |
+
"type_match": 7,
|
| 197 |
+
"parse_error": 4,
|
| 198 |
+
"exec_error": 5
|
| 199 |
+
}
|
| 200 |
+
}
|
| 201 |
+
},
|
| 202 |
+
"claude-opus-4-6": {
|
| 203 |
+
"total": 245,
|
| 204 |
+
"exec_match": 138,
|
| 205 |
+
"type_match": 126,
|
| 206 |
+
"parse_error": 20,
|
| 207 |
+
"exec_error": 18,
|
| 208 |
+
"by_op": {
|
| 209 |
+
"add_atom": {
|
| 210 |
+
"n": 20,
|
| 211 |
+
"exec_match": 12,
|
| 212 |
+
"type_match": 1,
|
| 213 |
+
"parse_error": 3,
|
| 214 |
+
"exec_error": 1
|
| 215 |
+
},
|
| 216 |
+
"add_bond": {
|
| 217 |
+
"n": 20,
|
| 218 |
+
"exec_match": 9,
|
| 219 |
+
"type_match": 13,
|
| 220 |
+
"parse_error": 3,
|
| 221 |
+
"exec_error": 2
|
| 222 |
+
},
|
| 223 |
+
"add_functional_group": {
|
| 224 |
+
"n": 20,
|
| 225 |
+
"exec_match": 9,
|
| 226 |
+
"type_match": 14,
|
| 227 |
+
"parse_error": 2,
|
| 228 |
+
"exec_error": 0
|
| 229 |
+
},
|
| 230 |
+
"change_atom_element": {
|
| 231 |
+
"n": 20,
|
| 232 |
+
"exec_match": 15,
|
| 233 |
+
"type_match": 16,
|
| 234 |
+
"parse_error": 2,
|
| 235 |
+
"exec_error": 0
|
| 236 |
+
},
|
| 237 |
+
"change_bond_order": {
|
| 238 |
+
"n": 20,
|
| 239 |
+
"exec_match": 15,
|
| 240 |
+
"type_match": 16,
|
| 241 |
+
"parse_error": 2,
|
| 242 |
+
"exec_error": 0
|
| 243 |
+
},
|
| 244 |
+
"change_charge": {
|
| 245 |
+
"n": 20,
|
| 246 |
+
"exec_match": 19,
|
| 247 |
+
"type_match": 19,
|
| 248 |
+
"parse_error": 0,
|
| 249 |
+
"exec_error": 0
|
| 250 |
+
},
|
| 251 |
+
"flip_chirality": {
|
| 252 |
+
"n": 20,
|
| 253 |
+
"exec_match": 3,
|
| 254 |
+
"type_match": 4,
|
| 255 |
+
"parse_error": 4,
|
| 256 |
+
"exec_error": 1
|
| 257 |
+
},
|
| 258 |
+
"flip_ez": {
|
| 259 |
+
"n": 5,
|
| 260 |
+
"exec_match": 3,
|
| 261 |
+
"type_match": 3,
|
| 262 |
+
"parse_error": 0,
|
| 263 |
+
"exec_error": 0
|
| 264 |
+
},
|
| 265 |
+
"move_substituent": {
|
| 266 |
+
"n": 20,
|
| 267 |
+
"exec_match": 4,
|
| 268 |
+
"type_match": 9,
|
| 269 |
+
"parse_error": 1,
|
| 270 |
+
"exec_error": 4
|
| 271 |
+
},
|
| 272 |
+
"remove_atom": {
|
| 273 |
+
"n": 20,
|
| 274 |
+
"exec_match": 16,
|
| 275 |
+
"type_match": 8,
|
| 276 |
+
"parse_error": 1,
|
| 277 |
+
"exec_error": 1
|
| 278 |
+
},
|
| 279 |
+
"remove_bond": {
|
| 280 |
+
"n": 20,
|
| 281 |
+
"exec_match": 9,
|
| 282 |
+
"type_match": 11,
|
| 283 |
+
"parse_error": 1,
|
| 284 |
+
"exec_error": 6
|
| 285 |
+
},
|
| 286 |
+
"remove_functional_group": {
|
| 287 |
+
"n": 20,
|
| 288 |
+
"exec_match": 20,
|
| 289 |
+
"type_match": 6,
|
| 290 |
+
"parse_error": 0,
|
| 291 |
+
"exec_error": 0
|
| 292 |
+
},
|
| 293 |
+
"swap_substituents": {
|
| 294 |
+
"n": 20,
|
| 295 |
+
"exec_match": 4,
|
| 296 |
+
"type_match": 6,
|
| 297 |
+
"parse_error": 1,
|
| 298 |
+
"exec_error": 3
|
| 299 |
+
}
|
| 300 |
+
}
|
| 301 |
+
}
|
| 302 |
+
}
|
data/dataset.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/images/000000.png
ADDED
|
Git LFS Details
|
data/images/000001.png
ADDED
|
Git LFS Details
|
data/images/000002.png
ADDED
|
Git LFS Details
|
data/images/000003.png
ADDED
|
Git LFS Details
|
data/images/000004.png
ADDED
|
Git LFS Details
|
data/images/000005.png
ADDED
|
Git LFS Details
|
data/images/000006.png
ADDED
|
Git LFS Details
|
data/images/000007.png
ADDED
|
Git LFS Details
|
data/images/000008.png
ADDED
|
Git LFS Details
|
data/images/000009.png
ADDED
|
Git LFS Details
|
data/images/000010.png
ADDED
|
Git LFS Details
|
data/images/000011.png
ADDED
|
Git LFS Details
|
data/images/000012.png
ADDED
|
Git LFS Details
|
data/images/000013.png
ADDED
|
Git LFS Details
|
data/images/000014.png
ADDED
|
Git LFS Details
|
data/images/000015.png
ADDED
|
Git LFS Details
|
data/images/000016.png
ADDED
|
Git LFS Details
|
data/images/000017.png
ADDED
|
Git LFS Details
|
data/images/000018.png
ADDED
|
Git LFS Details
|
data/images/000019.png
ADDED
|
Git LFS Details
|
data/images/000020.png
ADDED
|
Git LFS Details
|
data/images/000021.png
ADDED
|
Git LFS Details
|
data/images/000022.png
ADDED
|
Git LFS Details
|
data/images/000023.png
ADDED
|
Git LFS Details
|
data/images/000024.png
ADDED
|
Git LFS Details
|
data/images/000025.png
ADDED
|
Git LFS Details
|
data/images/000026.png
ADDED
|
Git LFS Details
|
data/images/000027.png
ADDED
|
Git LFS Details
|
data/images/000028.png
ADDED
|
Git LFS Details
|
data/images/000029.png
ADDED
|
Git LFS Details
|
data/images/000030.png
ADDED
|
Git LFS Details
|
data/images/000031.png
ADDED
|
Git LFS Details
|
data/images/000032.png
ADDED
|
Git LFS Details
|
data/images/000033.png
ADDED
|
Git LFS Details
|
data/images/000034.png
ADDED
|
Git LFS Details
|
data/images/000035.png
ADDED
|
Git LFS Details
|
data/images/000036.png
ADDED
|
Git LFS Details
|