Behold NeuroMechFly, the best fruit fly simulator yet

Drosophila melanogaster, the common fruit fly, is in some ways a simple creature. But in others it is so complex that, as with any form of life, we are only scratching the surface of understanding it. Researchers have taken a major step with D. melanogaster by creating the most accurate digital twin yet — at least in how it moves and, to a certain extent, why.

NeuroMechFly, as the researchers at EPFL call their new model, is a “morphologically realistic biomechanical model” based on careful scans and close observation of actual flies. The result is a 3D model and movement system that, when prompted, does things like walk around or respond to certain basic stimuli pretty much as a real fly would.

To be clear, this isn’t a complete cell-by-cell simulation, which we’ve seen some progress on in the last few years with much smaller microorganisms. It doesn’t simulate hunger, or vision or any sophisticated behaviors — not even how it flies, only how it walks along a surface and grooms itself.

What’s so hard about that, you ask? Well, it’s one thing to approximate this type of movement or behavior and make a little 3D fly that moves more or less like a real one. It’s another to do so to a precise degree in a physically simulated environment, including a biologically accurate exoskeleton, muscles, and a neural network analogous to the fly’s that controls them.

To make this very precise model, they started with a CT scan of a fly, in order to create the morphologically realistic 3D mesh. Then they recorded a fly walking in very carefully controlled circumstances and tracked its precise leg movements. EPFL researchers then needed to model exactly how those movements corresponded to the physically simulated “articulating body parts, such as head, legs, wings, abdominal segments, proboscis, antennae, halteres,” the latter of which is a sort of motion-sensing organ that helps during flight.

Image Credits: Pavan Ramdya (EPFL)

They showed that these worked by bringing the precise motions of the observed fly into a simulation environment and replaying them with the simulated fly — the real movements mapped correctly onto the model’s. Then they demonstrated that they could create new gaits and movements based on these, letting the fly run faster or in a more stable way than what they had observed.

Image Credits: Pavan Ramdya (EPFL)

Not that they’re improving on nature, exactly; they’re just showing that the simulation of the fly’s movement extended to other, more extreme examples. Their model was even robust against virtual projectiles…to a certain extent, as you can see in the animation above.

“These case studies built our confidence in the model. But we are most interested in when the simulation fails to replicate animal behavior, pointing out ways to improve the model,” said EPFL’s Pavan Ramdya, who leads the group that built the simulator (and other D. melanogaster–related models). Seeing where their simulation breaks down shows where there’s work to do.

“NeuroMechFly can increase our understanding of how behaviors emerge from interactions between complex neuromechanical systems and their physical surroundings,” reads the abstract of the paper published last week in Nature Methods. By better understanding how and why a fly moves the way it does, we can understand the systems that underlie it better as well, producing insights in other areas (fruit flies are among the most used experimental animals). And of course if we ever wanted to create an artificial fly for some reason, we would definitely want to know how it works first.

While NeuroMechFly is in some ways a huge advance in the field of digitally simulating life, it’s still (as its creators would be the first to acknowledge) incredibly limited, focusing solely on specific physical processes and not on the many other aspects of the tiny body and mind that make a Drosophila a Drosophila. You can check out the code and perhaps contribute over at GitHub or Code Ocean.