Researchers have identified a genetic link between depression and an increased risk of developing stomach ulcers.