# NOT RUN {
data(steptoe.morex.pheno)
dat <- steptoe.morex.pheno
# }
# NOT RUN {
# Visualize GxE of traits
require(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")
# }
# NOT RUN {
# ----------------------------------------------------------------------------
# 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
if(require(qtl)){
data(steptoe.morex.geno)
datg <- steptoe.morex.geno
plot.map(datg, main="steptoe.morex.pheno") # or just use plot()
}
# ----------------------------------------------------------------------------
# }
# NOT RUN {
# This is a very rudimentary example.
# Fit a simple multi-environment mixed model
# asreml3
require(asreml)
m1 <- asreml(yield ~ env, data=dat, random=~gen)
require(wgaim)
qtl::plotMissing(datg)
link.map(datg)
# Create an interval object for wgaim
class(datg)[1] <- "bc"
dati <- cross2int(datg, id="gen")
# Whole genome qtl
assign("dat", dat, 1) # Needed for wgaim in script mode
q1 <- wgaim(m1, dat, dati, merge.by="gen", na.method.X='include')
link.map(q1, dati) # Visualize
out.stat(q1, dati) # outlier statistic
summary(q1, dati) # Table of important intervals
# Chrom Left Marker dist(cM) Right Marker dist(cM) Size Pvalue <!-- % Var -->
# 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
# }
# NOT RUN {
# ----------------------------------------------------------------------------
# }
# NOT RUN {
# This is a very rudimentary example.
# Fit a simple multi-environment mixed model
## require(asreml4)
## m1 <- asreml(yield ~ env, data=dat, random=~gen)
## require(wgaim)
## plotMissing(datg)
## link.map(datg)
## # Create an interval object for wgaim
## class(datg)[1] <- "bc"
## dati <- cross2int(datg, id="gen")
## # Whole genome qtl
## assign("dat", dat, 1) # Needed for wgaim in script mode
## q1 <- wgaim(m1, dat, dati, merge.by="gen", na.method.X='include')
## link.map(q1, dati) # Visualize
## out.stat(q1, dati) # outlier statistic
## summary(q1, dati) # Table of important intervals
## # Chrom Left Marker dist(cM) Right Marker dist(cM) Size Pvalue <!-- % Var -->
## # 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
# }
# NOT RUN {
# ----------------------------------------------------------------------------
# }
Run the code above in your browser using DataCamp Workspace