2. This tutorial is to estimate broad and
narrow sense heritability using R
package “sommer”. You have any
question, you can contact me on
this email askaler@uark.edu
Download and Install software.
1. R program
https://cran.r-project.org/bin/windows/base/
2. R Studio
https://www.rstudio.com/products/rstudio/do wnload/
3. Steps in Heritability
Step 1: File Formatting
You need only one phenotypic file if you are
estimating broad sense heritability. If you are
estimating narrow sense heritability, then you
also need genotypic file.
Phenotype File Format: Make your phenotype
using this format.
In this file, you have genotype name “Name”,
environment “Env” (combination of Location
and Year), Location “Loc”, year “Year”,
“Block” (replication), and response variable “y”.
4. Genotype File Format: You only need this file if
you are estimating narrow sense heritability. You
need numeric format for genotype file
Column should be markers and row should be
Plant ID same as phenotype file.
Save both file as “.txt”.
5. Step 2: Install and Load the
packages.
#install these packages
install.packages("bigmemory")
install.packages("biganalytics")
install.packages("sommer")
# load the packages
library("bigmemory")
library("biganalytics")
library(“sommer”)
Step 3: Set working directory and import
data
#Set your working directory where you
have your data files.
6. Step 4: Read your “.txt” file
#phenotype file
Y<- read.table("filename.txt", head =
TRUE)
#genotype file
G <- read.big.matrix("filename.txt",
type="char", sep="t", head = TRUE)
attach(Y)
attach(G)
#Broad sense heritability using only
phenotype data
ans1 <- mmer2(y~1, random=~Name +
Env + Name:Env + Block,data=h2, silent
= TRUE)
vc <- ans1$var.comp
7. V_E <- vc[2,1]
V_GE <- vc[3,1]
V_G <- vc[1,1]
Ve <- vc[5,1]
n.env <- length(levels(h2$Env))
h2 <- V_G/(V_G + V_GE/n.env +Ve/(2*n.env))
#the 2 is a reference for block. You need to mention
here how many blocks or replications you have.
h2
#this will give you broad sense heritability
#Narrow sense heritability using
both phenotype and genotype data
y <- Y$y
# extract your phenotype response
8. Za <- diag(length(y))
Zd <- diag(length(y))
Ze <- diag(length(y))
A <- A.mat(G)
# additive relationship matrix
D <- D.mat(G)
# dominance relationship matrix
E <- E.mat(G)
# epistatic relationship matrix
ETA.ADE <-
list(add=list(Z=Za,K=A),dom=list(Z=Zd,K=
D),epi=list(Z=Ze,K=E))
ans.ADE <- mmer(Y=y, Z=ETA.ADE,silent
= TRUE)
9. (h2 <-
sum(ans.ADE$var.comp[1,1])/sum(ans.A
DE$var.comp[,1]))
# this will give you narrow sense
heritability.
(H2 <-
sum(ans.ADE$var.comp[1:3,1])/sum(ans.
ADE$var.comp[,1]))
# this can also give you broad sense
heritability.
For other Tutorials, you can visit here:
http://www.slideshare.net/AvjinderSingh