Accurate methods for ancestry and relatedness inference