Scientists have found the first gene for beer foam, a discovery which they say will help researchers perfect the frothy "head" atop a freshly poured pint.

Researchers from Spain and Australia say they have identified the yeast gene which helps produce the proteins needed to create bubbly foam, in a study published in the journal of Agricultural and Food Chemistry.

"This novel protein is responsible for beer foam stabilization," the researchers wrote. "This report represents the first time that a brewing yeast foaming gene has been cloned and its action fully characterized... Foam quality is an important organoleptic property of beer that directly correlates to consumer appeal."

Beer is typically made from ingredients including barley and yeast, as well as water and hops. The white foamy top on the popular alcoholic beverage consists of carbon dioxide gas, which is produced by yeast during the fermentation process, and proteins that gather around it creating bubbles.

Past research showed that proteins from the yeast stabilize the ale or lager's foam, which keep the beer's "head" from dissipating quickly.

Similar fermentation genes have been discovered for wine and sake by previous researchers, but, this was the first identification of the beer foam gene, the study says.

The gene is called CFG1, which stands for Carlsbergensis foaming gene, said scientists from the University of Santiago de Compostela and University of Burgos, both in Spain, and the University of Sydney in Australia.

"Although there have been many publications concerning barley proteins involvement in beer foam production … reports on yeast genes involved in beer foam generation and maintenance have been scarce," researchers said.

The scientists examined several yeast strains. One of the tests involved taking samples of beer fermented with different strains in test tubes and comparing the amount and quality of foam after shaking for 5, 15, 30, or 60 minutes.

The researchers say the discovery of the gene CFG1 takes us one step closer to uncovering the perfect pint of ale or lager.

"Taken together, all the results shown in the present paper show the CFG1 gene to be a good candidate to improve foam character in the brewing industry," the study reads.