Detecting and measuring genetic differentiation