# read data
iron <- read_cross2(system.file("extdata", "iron.zip", package="qtl2"))
iron <- iron[,c("19", "X")] # subset to chr 19 and X
# insert pseudomarkers into map
map <- insert_pseudomarkers(iron$gmap, step=1)
# calculate genotype probabilities
probs <- calc_genoprob(iron, map, error_prob=0.002)
# covariates for X chr under null
Xcovar <- get_x_covar(iron)
# create binary trait
bin_pheno <- setNames(as.numeric(iron$pheno[,1] > median(iron$pheno[,1])),
rownames(iron$pheno))
ll_glm <-
function(pr, pheno, addcovar=NULL, ...)
{
formula <- ifelse(is.null(pr), "pheno ~ 1", "pheno ~ pr")
if(!is.null(addcovar)) formula <- paste(formula, "+ addcovar")
glm_out <- glm(as.formula(formula), family=binomial(link=probit))
-glm_out$deviance/(2*log(10)) # log10 likelihood
}
# perform genome scan using glm() with probit link function
out <- scan1gen(probs, bin_pheno, Xcovar=Xcovar, func=ll_glm)
Run the code above in your browser using DataLab