Genomic Selection with Bayesian Generalized Linear Regression model using R
Genomic Selection with
Bayesian Generalized Linear
Regression model using R
by Avjinder Kaler
Avjinder Singh Kaler
University of Arkansas, Fayetteville, AR
This tutorial is used to perform a genomic prediction.
Anyone can use and learn about genomic prediction using
BGLR R package and if you have question related to
genomic prediction and other models, you can contact me
using above email.
Download and Install software.
1. R program
2. R Studio
Steps in Genomic Prediction
Step 1: Data Formatting
Format the genotype and phenotype data files needed for BGLR package.
Three types of files are required; genotype file in numeric form, phenotype
file, and kinship matrix.
Format your files like this.
Genotype file: Markers in Columns and Lines in Rows
Kinship Matrix file: You can third party software to estimate kinship matrix
like TASSEL, GAPIT.
Need Line ID in Columns, not in Rows.
Phenotype file: You can put 10/20/30 % data missing to predict those missing
values and check accuracy of model by checking correlation between actual
phenotypic value and predictive values. High correlation means high
First Column is Line ID and Second column is Trait. You can have more
traits in rest of columns.
Step 2: R code for Genomic Prediction
Step 3: Set working directory and import data
Set your working directory where you have your data files.
# Read all files
#Phenotype file loading
Y <- read.table("AAE.txt", head = TRUE)
#Genotype file loading
X <- read.table("g3.txt", head = TRUE)
#Kinship matrix file loading
A<- read.table("k3.txt", head = TRUE)
# Check the dimensions for all files, need to be same dimension for Lines
#Computing the genomic relationship matrix
#Computing the eigen-value decomposition of G
#Setting the linear predictor
#Fitting the model
fm<-BGLR(y=y, ETA=ETA, nIter=12000, burnIn=2000,saveAt='PGBLUP_')
#Exporting your Genomic prediction values
write.table(yHat, "C:/Folder/file. xt", sep="t")
#Godness of fit and related statistics
fm$varE # compare to var(y)
#Variance components associated with the genomic and pedigree
# Residual variance
# Check results in your folder and correlate predictive values with
actual phenotypic values, see how accurate is your model.
For other Tutorials, you can visit here: