The study of the genetic basis of ecological differentiation; the study of the genetic composition of populations in relation to their habitats.