Tag Archives: Fly

Finally solving drug discovery with a Fly

As I was sitting down this morning, trying to enjoy my rather excellent breakfast, I was suddenly attacked by a fly. Unfortunately for me, my lazy hand swats proved no match for the nimble little thing, who was evidently pretty hungry too. And as I watched the acrobatics this tiny creature could effortlessly pull off in pursuit of my sandwich, I was left wondering: if only we could put these skills to better use.

Open-sourcing a fly

Luckily, I’m not the only one who has been staring at a fly and wondering. A couple of weeks ago, HHMI Janelia, the University of Cambridge and Google Research published a paper in the Cell describing the complete wiring diagram of a male fruit fly’s central nervous system: the brain and the nerve cord, the whole thing, down to individual synapses. To be fair, this isn’t the first time someone has done this. The FlyWire project gave us a complete female fly brain back in 2024, and Janelia had already released half a female brain in 2020. But this one comes with the body wiring attached, and, for whatever reason, this is the one the internet decided to notice.

What the internet did with it

Now, the video games. My question at the top was whether these skills could be put to better use, so here they are:

Beat Saber

Crypto Trading

People even started feeling bad for this fly, so one developer began building it its own heaven: an open world full of grass, trees and an endless supply of fruit, where it can just fly around and eat whatever it wants, forever. Honestly, not a bad retirement.

Taping a molecule to the fly

All of which brings me back to breakfast. The one thing the fly is undeniably, infuriatingly good at is flying: a six-degrees-of-freedom control problem, three translations and three rotations, solved in real time by a brain the size of a poppy seed. And it turns out there is another six-degrees-of-freedom problem that a great deal of expensive software spends a great deal of expensive compute on: docking. Rigid docking is this: here is a protein, here is a drug molecule, find the pose in which the molecule sits in the binding pocket. Three translations, three rotations. If you squint, it is the problem the fly solves on the way to my sandwich, just with a worse view.

So I taped a molecule to the fly.

More precisely, I built a small simulator where the “body” the fly controls is a rigid drug molecule and the “world” is the inside of a protein. The molecule is staurosporine, a famously indiscriminate kinase inhibitor that has been crystallised bound to something like 86 different proteins, which means there are 86 known correct answers lying around in the Protein Data Bank. The protein is CDK2, a cell-cycle kinase, from PDB entry 1AQ1. Each step, the fly nudges the molecule by up to half an ångström and turns it by up to about nine degrees. It is rewarded for getting closer to the crystal pose, penalised for pushing atoms into the protein, and if it gets within 2 Å of the real thing, it has docked.

The wiring in the middle is the real thing: the central-brain part of MaleCNS, 38,128 neurons and 3 million synapses, with each neuron’s outgoing synapses made excitatory or inhibitory according to its predicted neurotransmitter. The fly’s senses go into its 4,656 sensory neurons, the ones that in life would be smelling and touching things: a “smell” that points toward the pocket and says how far away it is, a “touch” that says how close the nearest protein atom is and from which direction. The motor commands, six little nudges, are read out of its 1,312 descending neurons, the cells that in life carry orders from the brain to the wings and legs. Nothing in between is trained. The only things that learn are the two thin layers at the edges, which is the same trick as the Doom fly, and training is ordinary reinforcement learning: about a hundred thousand nudges, half an hour on a laptop.

It did not work the first time. Or the second. For most of a day the fly’s preferred strategy was to grab the molecule and leave, ending up a hundred ångströms from the protein, which in molecular terms is the next postcode. Some of that was my fault: my first version of the protein was a maze the molecule had to tunnel through, and no amount of wiring fixes a bad map. But the interesting failure was in the read-out. The descending neurons fire away at a steady hum whatever the fly is sensing, and the part of their activity that actually depends on the senses turned out to be about 0.1% of the total. The connectome was doing its job; I just had the volume knob wrong. Once each neuron was read relative to its own usual hum, that fraction went to 91%, and twenty thousand nudges later the fly docked staurosporine into CDK2 from every starting position I gave it, including ones where the molecule began nine ångströms out and upside down.

Here it is doing that.

So, have we finally solved drug discovery with a fly? Obviously not. What we have is a dead fly’s brain, untrained and unbothered, parking a molecule about as well as a network built for the job, plus a to-do list that starts with “learn what a pocket is” and ends somewhere around “chemistry”. Still, every demo in this post is made-up physics bolted onto a real map, and it keeps being the map that works. Eighty-five more kinases are sitting in the Protein Data Bank waiting for a pilot. After a hundred thousand attempts at parking, the fly has earned a snack. It can have the sandwich.