If life looks cheery in spite of the gloomy weather, mass job insecurity and the suspicion that spending hours on Facebook is mangling your mind, you might want to thank your brightside gene.

It seems that for some of us, seeing the glass as half full is hardwired into our genetic make-up, helping us shrug off the miseries of life and enjoy the positives.

Research by British psychologists suggests that people who carry the gene pay less attention to negative things going on around them and focus instead on the happier aspects of life. By doing so, they end up being more sociable and are generally in better shape psychologically.

Elaine Fox, head of psychology at Essex University, said the gene seems to underlie some people's ability to deal with daily stresses. Those without it are likely to have a gloomier outlook on life, and suffer more from mental health problems such as depression.

"We've shown for the first time that a genetic variation is linked with a tendency to look on the bright side of life," she said. "This is a key mechanism underlying resilience to general life stress."

In a study involving more than 100 volunteers, Fox's team checked how long it took people to react to good and bad images that flashed up on a computer screen. Among the positive pictures were a couple hugging and someone sailing along in a boat. The negative images included a photo of someone being mugged.

Chris Ashwin, a co-author on the study and cognitive psychologist at Bath University, said the test reveals whether people are inclined to focus more on the good things in life or the bad.

Genetic tests on the participants showed that a tendency to ignore negative images and dwell on the positive ones was strongly linked to a variation in a gene that controls serotonin, the brain's main feelgood chemical.

Each of us inherits two versions of the gene, either two short ones, two long ones, or one of each. People who had two longs versions were most likely to focus on the positives, according to the study published in Proceedings of the Royal Society B.

How the gene works is unclear, but Ashwin suspects it might dampen down activity in part of the brain called the amygdala, which plays a leading role in regulating our emotions. People with two short versions of the gene show more activity in that part of the brain and are more likely to be neurotic and anxious about their lives, the researchers said.

The discovery raises the prospect of employers screening out applicants who take a glum view on life. But individuals vary too much for such a test to be effective, the researchers told the Guardian.

Of course they're probably wrong, but who cares, working for a living is rubbish anyway.