# load data and calculate genotype probabilities
iron <- read_cross2(system.file("extdata", "iron.zip", package="qtl2"))
iron <- iron[1:50, ] # subset to first 50 individuals
map <- insert_pseudomarkers(iron$gmap, step=1)
pr <- calc_genoprob(iron, map, error_prob=0.002)
# infer genotypes, as those with maximal marginal probability
m <- maxmarg(pr, minprob=0.5)
# re-code the X chr, (5,6) -> (1,3)
m[["X"]] <- (m[["X"]] - 5)*2 + 1
# plot phased genotypes
plot_geno(m, map, col=c("#FFDC00", "#00C800", "#0064C9"))
# this is more interesting for Diversity Outbred mouse data
if (FALSE) {
file <- paste0("https://raw.githubusercontent.com/rqtl/",
"qtl2data/main/DOex/DOex.zip")
DOex <- read_cross2(file)
# subset to first 25 individuals
DOex <- DOex[1:25, ]
pr <- calc_genoprob(DOex, error_prob=0.002)
# infer genotypes, as those with maximal marginal probability
m <- maxmarg(pr, minprob=0.5)
# guess phase
ph <- guess_phase(DOex, m)
# plot phased genotypes
plot_geno(ph, DOex$gmap)
}
Run the code above in your browser using DataLab