Genetic structure and selection in subdivided populations