People's coffee drinking habits are linked to their genes, scientists have found.

A large-scale study, which analysed 20,000 regular coffee drinkers of European and African American ancestry, identified six new genetic variants associated with habitual coffee drinking.

The genome-wide meta-analysis, led by Harvard School of Public Health and Brigham and Women's Hospital researchers, helps to explain why a given amount of coffee or caffeine has different effects on different people and provides a genetic basis for future research exploring the links between coffee and health.

The researchers, who are part of the Coffee and Caffeine Genetics Consortium, identified two variants that mapped two genes involved in caffeine metabolism, POR and ABCG2.

Two variants were also identified near genes BDNF and SLC6A4 that potentially influence the rewarding effects of caffeine.

Meanwhile two others, near GCKR and MLXIPL - genes involved in glucose and lipid metabolism - had not previously been linked to the metabolism or neurological effects of coffee.

The findings suggest that people naturally modulate their coffee intake to experience the optimal effects exerted by caffeine and that the strongest genetic factors linked to increased coffee intake likely work by directly increasing caffeine metabolism.

Marilyn Cornelis, research associate in the Department of Nutrition at Harvard School of Public Health and lead author of the study, said: "Coffee and caffeine have been linked to beneficial and adverse health effects. Our findings may allow us to identify subgroups of people most likely to benefit from increasing or decreasing coffee consumption for optimal health."

Daniel Chasman, associate professor at Brigham and Women's Hospital and the study's senior author, said: "Like previous genetic analyses of smoking and alcohol consumption, this research serves as an example of how genetics can influence some types of habitual behaviour."

The study appears in online journal Molecular Psychiatry.