if (FALSE) {
library(agridat)
data(steptoe.morex.pheno)
dat <- steptoe.morex.pheno
# Visualize GxE of traits
libs(lattice)
redblue <- colorRampPalette(c("firebrick", "lightgray", "#375997"))
levelplot(amylase~env*gen, data=dat, col.regions=redblue,
scales=list(x=list(rot=90)), main="amylase")
## levelplot(diapow~env*gen, data=dat, col.regions=redblue,
## scales=list(x=list(rot=90)), main="diapow")
## levelplot(hddate~env*gen, data=dat, col.regions=redblue,
## scales=list(x=list(rot=90)), main="hddate")
## levelplot(lodging~env*gen, data=dat, col.regions=redblue,
## scales=list(x=list(rot=90)), main="lodging")
## levelplot(malt~env*gen, data=dat, col.regions=redblue,
## scales=list(x=list(rot=90)), main="malt")
## levelplot(height~env*gen, data=dat, col.regions=redblue,
## scales=list(x=list(rot=90)), main="height")
## levelplot(protein~env*gen, data=dat, col.regions=redblue,
## scales=list(x=list(rot=90)), main="protein")
## levelplot(yield~env*gen, data=dat, col.regions=redblue,
## scales=list(x=list(rot=90)), main="yield")
# Calculate avg yield for each loc as in Romagosa 1996, table 3
# t(t(round(tapply(dat$yield, dat$env, FUN=mean),2)))
# SKo92,SKg92 means in table 3 are switched. Who is right, him or me?
# Draw marker map
libs(qtl)
data(steptoe.morex.geno)
datg <- steptoe.morex.geno
qtl::plot.map(datg, main="steptoe.morex.pheno")
qtl::plotMissing(datg)
# This is a very rudimentary example.
# The 'wgaim' function works interactively, but fails during
# devtools::check().
if(0 & require("asreml", quietly=TRUE)){
libs(asreml)
# Fit a simple multi-environment mixed model
m1 <- asreml(yield ~ env, data=dat, random=~gen)
libs(wgaim)
wgaim::linkMap(datg)
# Create an interval object for wgaim
dati <- wgaim::cross2int(datg, id="gen")
# Whole genome qtl
q1 <- wgaim::wgaim(m1, intervalObj=dati,
merge.by="gen", na.action=na.method(x="include"))
#wgaim::linkMap(q1, dati) # Visualize
wgaim::outStat(q1, dati) # outlier statistic
summary(q1, dati) # Table of important intervals
# Chrom Left Marker dist(cM) Right Marker dist(cM) Size Pvalue
# 3 ABG399 52.6 BCD828 56.1 0.254 0.000 45.0
# 5 MWG912 148 ABG387A 151.2 0.092 0.001 5.9
# 6 ABC169B 64.8 CDO497 67.5 -0.089 0.001 5.6
}
}
Run the code above in your browser using DataLab