You and your favorite cheese—whether it's cheddar, Wensleydale, or a good aged goat brie—have something in common: You’re both home to a constantly evolving menagerie of microbes. The bacteria inside you and your fermented dairy live together in a community called a biome, growing and changing in response to their environments. And they adapt to their homes—a cow’s hide, a chunk of Swiss, or your gut—by stealing their neighbors’ genes.

That genetic transfer has the ability to dramatically change a microbe. “You take this whole gene that you didn’t have before, that has totally new functions that you’ve never had, and you just plop it into this bacterium and suddenly it can do this completely new and different thing,” says Miriam Barlow, an antimicrobial resistance researcher at UC Merced. In humans, that's how antibiotic resistance can emerge—one bug evolves a mutation that helps it survive the onslaught of a drug, and it makes its way into the rest of the community. But to fully understand how resistance evolves, studying superbugs isn’t enough: You need large, diverse bacterial boroughs to understand how bugs siphon off new genes.

The search for lively bacterial communities led Rachel Dutton, a microbiologist at UC San Diego, to cave-aged cheese wheels—the kind you can only pick up with both hands. She wanted to find an environment that would kill some bacteria, but let other interesting microbes survive. Microbes don’t love cheese like humans do—it’s acidic, salty, and dry for their tastes—but it’s passable housing for some. If surviving antibiotics is like winning the lottery for a bacterium, inhabiting gruyere is like winning at bingo. “We have basically, in our freezer in lab, a few hundred vials of cheese,” Dutton says.

That frozen cheese stockpile—which came from 10 different countries—provides plenty of microbes to survey. Dutton and her students isolate bacteria from a smidge of cheese rind, grow communities in petri dishes, then send samples off for genetic sequencing. “Each of these sequences is about four to five megabases, in other words, about 4 million A’s, T’s, G’s and C’s,” says Kevin Bonham, a postdoc in Dutton’s group. Bonham wrote code that lines up hundreds of bacterial species’ genomes, plucks out each of their genes, and finds similarities between samples.

Scrutinizing sequences alone can’t tell you exactly how a gene showed up, but it can give you a good idea of which genes are most mobile in a population of bacteria. The exact same sequence in two different species, say, a proteobacterium and a firmicutes bacterium, stands out as a transferred gene, because normally there would be some variation between their genetic material. And more than one gene can move at once, so if one identical gene showed up next to another, they considered that chunk to have migrated all together, Bonham says.

The most frequently shared genes were the ones that help bacteria grab and use nutrients around them. Iron uptake genes were by far the most commonly transferred. Some bacterial proteins need to bind metal to function, but milk and cheese are low in iron, so bacteria who could unlock the mineral have better odds of surviving. Those who survived also shared bacterial versions of Lactaid pills—genes for breaking down the abundant lactose in cheese.

That kind of information could help researchers figure out which genes are most prone to transferring within the human microbiome. While not all pathogens transfer genes readily, some certainly do. Gonorrhea—which comes in horridly resistant varieties now—really likes to spread its genes around, Barlow says. So understanding how these genes move in a community could mean a better grasp of how to battle antibiotic resistance.

Ideally, it would be possible to pinpoint exactly how certain sequences mobilize. Armed with instructions for spreading bacterial genes, scientists could introduce useful ones to influence how pathogenic foes, or friendly microbes, behave. But transferred traits are only one piece of the bacterial genome—so it will be a while before anyone has precise control of bacteria.

But keeping cheese popsicles in the freezer means Dutton and her students can run plenty more experiments. Now that it’s clear which genes bacteria pass around, they want to narrow in on how often those genes move, and how that transfer changes how microbes compete or cooperate. Maybe the way cheese bacteria steal traits will shed light on how their disease-causing relatives survive. For a humble crumb of cheese, that’s not just gouda–that’s grate.