Immune systems develop specific genes to combat common bacteria such as those found in food, new research shows.