"""What the benchmark asks about: a drug sitting in the hERG channel's pore, so potassium stops flowing. Schematic. The README and its source give the task as SMILES strings and labels, not as the structures of the drugs or of the channel, so nothing here is drawn from coordinates; the numbers in the label are the set's own (648 drugs, 68.9% of labels positive). The ring skeleton stands for a drug, not for any particular one. """ import math from pathlib import Path import kit TOP, BOT, NECK = 16.0, 252.0, 150.0 MOUTH, THROAT = 74.0, 34.0 # half-widths of the pore at its mouths and at its narrow part def wall(side): x = lambda w: 320 + side * w return (f'M{kit.f1(x(MOUTH))} {TOP}L{kit.f1(x(MOUTH))} {TOP + 44}' f'C{kit.f1(x(MOUTH))} {kit.f1(NECK - 40)} {kit.f1(x(THROAT))} {kit.f1(NECK - 46)} ' f'{kit.f1(x(THROAT))} {kit.f1(NECK)}' f'C{kit.f1(x(THROAT))} {kit.f1(NECK + 46)} {kit.f1(x(MOUTH))} {kit.f1(BOT - 84)} ' f'{kit.f1(x(MOUTH))} {kit.f1(BOT - 44)}L{kit.f1(x(MOUTH))} {BOT}') def ring(cx, cy, r, rot=0.0): return kit.polygon([(cx + r * math.cos(rot + k * math.pi / 3), cy + r * math.sin(rot + k * math.pi / 3)) for k in range(6)], 'f') # the membrane the channel sits in, then the channel's two walls body = ''.join(kit.line(0, y, 640, y, 'faint-s', 2, ' stroke-dasharray="4 11"') for y in (62, 238)) body += kit.path(wall(-1), 'ink-s', 6) + kit.path(wall(1), 'ink-s', 6) # potassium ions, held above the drug: none get through body += ''.join(kit.dot(320 + dx, dy, 11, 'sand') for dx, dy in ((-40, 30), (18, 24), (-16, 64), (36, 70), (-28, 104))) # the drug wedged in the narrow part body += ring(312, NECK + 4, 30) + ring(354, NECK + 36, 22, math.pi / 6) label = '648 drugs · 68.9% block the channel · schematic' kit.write(__file__, 'life-health', body, label, 'A drug lodged in the narrow part of the hERG potassium channel, with the potassium ions held above it') print(label)