AGH.inv: Generate H-inverse matrix for SS-GBLUP.

View source: R/AF.Echidna.R

AGH.invR Documentation

Generate H-inverse matrix for SS-GBLUP.

Description

AGH.inv This function calculate genomic relationship matrix(G), full additative matrix(A) and blended relationship matrix(H) from genotyped marker, genotyped pedigree and ungenotyped pedigree.

Usage

AGH.inv(gmarker,option=1, ugped, gped, tidn, gidn)

Arguments

option

option (1~5) for different G matrixs.

ugped

ungenotyped pedigree, or total pedigree.

gped

genotyped pedigree.

gmarker

genotyped marker,column 1 should be sample ID.

asrV

asreml version, 3(default) or 4.

tidn

the id values of total pedigree id.

gidn

the id values of the genotyped id.

Details

This function would return a list containing 3 elements. The types of option (1~5) as following:

option Description
1 observed allele frequencies (GOF, VanRaden, 2008).
2 weighted markers by recipricals of expected variance (GD, Forni et al., 2011).
3 allele frequencies fixed at 0.5 (G05, Forni et al., 2011).
4 allele frequencies fixed at mean for each locus (GMF, Forni et al., 2011).
5 regression of MM' on A sort (Greg, VanRaden, 2008).

Value

Ainv

inverse of full additative matrix(A).

Ginv

inverse of genomic relationship matrix(G).

Hinv

inverse of blended relationship matrix(H).

Author(s)

Yuanzhen Lin <yzhlinscau@163.com>

References

Yuanzhen Lin. R & ASReml-R Statistics. China Forestry Publishing House. 2016

Examples

## Not run: 
library(AFEchidna)

data("ugped")
data("gped")
data("gmarker")

# get A-matrix, G-matrix and H-matrix
AGH1<-AGH.inv(option=1,ugped,gped,gmarker)

  
data(MET)
MET$yield<-0.01*MET$yield
levels(MET$Genotype)<-gped$ID
MET1<-filterD1(MET, Loc %in% c(3))

## for ASReml-R V3.0 
library(asreml)

# base model
sm1.asr<-asreml(yield~Rep, random=~ Genotype+units, 
                rcov=~ ar1(Col):ar1(Row), 
                data=MET1, maxiter=50)

Var(sm1.asr)

# A-BLUP
Ainv <- AGH1$Ainv
sm2.asr<-update(sm1.asr, random=~ ped(Genotype)+units, 
                ginverse=list(Genotype=Ainv))

Var(sm2.asr)

# G-BLUP
Ginv <- AGH1$Ginv
sm3.asr<-update(sm1.asr, random=~ ped(Genotype)+units, 
                ginverse=list(Genotype=Ginv))

Var(sm3.asr)

# H-BLUP
Hinv <- AGH1$Hinv
sm4.asr<-update(sm1.asr, random=~ ped(Genotype)+units, 
                ginverse=list(Genotype=Hinv))

Var(sm4.asr)


## for ASReml-R V4 
library(asreml)


sm1.asr<-asreml(yield~Rep, random=~ Genotype+units, 
                residual=~ ar1(Col):ar1(Row), 
                data=MET1, maxiter=50)

Var(sm1.asr)

# A-BLUP
Ainv <- AGH1$Ainv
sm2.asr<-update(sm1.asr, 
             random=~ vm(Genotype,Ainv)+units)

Var(sm2.asr)

# G-BLUP
Ginv <- AGH1$Ginv
sm3.asr<-update(sm1.asr, 
             random=~ vm(Genotype,Ginv)+units)

Var(sm3.asr)

# H-BLUP
Hinv <- AGH1$Hinv
sm4.asr<-update(sm1.asr, 
             random=~ vm(Genotype,Hinv)+units)

Var(sm4.asr)

########## if any other genotyped id without ped
########## we can put their parent code to 0 or NA
########## to make pedigree, then use H-matrix.
## gmarker2 without pedigree
#
## make their pedigree
# gid2<-gmarker2[,1]
# gped2<-data.frame(ID=gid2,Female=0,Male=0)
#
## combine genotyped id's pedigree
# gped1<-rbind(gped,gped2)
#
## combine all genotyped marker data
# gmarker1<-rbind(gmarker,gmarker2)
#
# AGH1a<-AGH.inv(option=1,tped1,gped1,gmarker1)
#

## End(Not run)

yzhlinscau/AAfun0s documentation built on April 18, 2023, 4:11 p.m.