if (FALSE) {
# load genotype data to analyze (not shown) into this variable
X
# choose the number of ancestries
r <- 3
# load alstructure package (install from https://github.com/StoreyLab/alstructure)
library(alstructure)
# define the function this way, a function of the genotype matrix only
FUN <- function(x) t( alstructure(x, d_hat = r)$Q_hat )
# calculate p-values (and other statistics) for each SNP
out <- jackstraw_alstructure( X, r, FUN )
}
Run the code above in your browser using DataLab