A gene's eye view of epistasis, selection and speciation