This app fits GBLUP models with interactions between SNPs and groups (envitonments, sex, race, etc).
The following features are worth mentioning:
In this example we identigy two clusters (of wheat inbred lines) and model SNP-by-group interactions Data and data
library(BGLR)
data(wheat)
X=wheat.X
tmp=svd(X,nu=5)
group=kmeans(tmp$u,centers=2,nstart=100)$cluster
groups=unique(group)
nGroups=length(groups)
Centering within group
for(i in 1:nGroups){
tmp=group==groups[i]
means=colMeans(X[tmp,])
X[tmp,]=sweep(x=X[tmp,],STATS=means,FUN='-',MARGIN=2L)
}
G-matrix
G=tcrossprod(X)
G=G/mean(diag(G))
Sourcing the app
source('https://raw.githubusercontent.com/gdlc/BGLR-R/master/apps/RKHS_GROUPS/RKHS_GROUPS.R')
Fitting the model
fm=RKHS.Groups(y=wheat.Y[,1],K=G,group=group)
Extracting results
INTERCEPTS=c(fm$mu,fm$ETA$int$b)
## predictions
PRED=data.frame(ID=rownames(X),group=group, y=y,yHat=yHat)
head(PRED)
## Variance components
fm$varE
#fm$COV #to be done
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.