A wine's terroir is what makes it special, says Greg Allen. He's a California winemaker who has studied and worked in the industry for 20 years.

"There's a rush of emotion when I think of terroir," he says. A wine's terroir may recall the slope of the hill where lush grapes grow — and maybe the angle of sunlight that warmed those grapes on that hill, or the way water moves through the soil that nourished them.

But when Allen thinks of terroir, he also think about microbes — about bacteria and fungi.

See, for centuries now, vintners and wine enthusiasts alike have puzzled over what gives wines their unique flavor profiles, which come from grapes grown in a specific geographic location.

Scientists and winemakers like Allen are now recognizing that part of what makes a wine-growing region special may be its resident microbes. A study published Tuesday in the journal mBio found that the collection of bacteria and fungi, or "microbiome," on pressed grapes can help predict the flavor profile of a finished wine.

"We know that humans can detect something in wine that allows us to separate it out by region," says David Mills, a microbiologist at the University of California, Davis and the study's senior researcher. "What that something is, is something that we can apply science to figure out."

Mills and his research team already knew from previous research that the microbes on grapes vary across broad growing regions. Cabernet sauvignon grapes grown in Sonoma, Calif., for example, carry different microbes than the same grapes grown about 150 miles south on the Central Coast.

The scientists also knew from other research that metabolites — the chemical compounds that shape the flavor and texture of wines — vary regionally.

What they did not know was whether microbes and metabolites differ at the finer scale of neighboring vineyards, and whether a grape's microbial community had any connection to the flavor metabolites in the finished wine.

To figure it out, Mills and his U.C. Davis colleagues teamed up with Far Niente and Nickel & Nickel wineries in Oakville, Calif., to study chardonnay and cabernet sauvignon grapes from across Napa and Sonoma counties.

Allen, a former graduate student of Mills and a winemaker for another winery in the Far Niente and Nickel & Nickel family, led efforts to collect more than 700 samples of wine in progress during the 2011 season.

The team then identified the groups of bacteria and fungi in each sample by sequencing the microbial DNA. They also used a chemical analysis to identify collections of flavor metabolites in the final products.

They discovered that neighboring vineyards often harbor unique collections of microbes, as well as unique groups of flavor metabolites in the finished wines. They also found that they could use the microbial community of the pressed grapes to predict which collections of flavor metabolites would end up in the finished wine.

The scientists now want to know whether the microbes directly impact flavor metabolites or whether the two are merely correlated.

Either way, a winemaker in the future could test the microbiome of grapes to determine whether a particular growing site will produce desirable metabolites in the wine, or to identify possible microbial issues early in the fermentation process.

"I think this is a really cool study," says Anna Katharine Mansfield, a wine scientist at Cornell University. "Measuring as much as you can measure, even in a wine you are happy with, gives you a baseline and a way to guess what went wrong if the flavor changes," she says. "Wine is an art and a science. But if the art can be informed by the science, then we have a broader palette to paint with."

Daniele Tessaro, a vintner at Barboursville Vineyards in Virginia, agrees. But he says it is unlikely that he'll be analyzing microbiomes any time soon. "You always have to decide whether testing something is worth your time and money," he says.

Copyright 2016 NPR. To see more, visit http://www.npr.org/.