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