rcpp implementation of 2 stage gwas