Role of selection and gene flow in population differentiation at the edge vs. interior of the species range differing in climatic conditions