hinv_matrix_asreml: Build the H-inverse-matrix from G-inverse-matrix and...

Description Usage Arguments Value Examples

Description

Build the H-inverse-matrix from G-inverse-matrix and pedigree-full and pedigree-genotype#'

Usage

1
hinv_matrix_asreml(M012, ped_full)

Arguments

ped_full

It contains the full pedigree, it has three columns:ID,Sire,Dam

G_mat

It is the matrix which has rownames and colnames(ID)

ped_geno

It contains the pedigree that has the genotype, it is a part of the ped_full pedigree

Value

The H-inverse-matrix form the formula

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# paper:Legarra A, Aguilar I, Misztal I. A relationship matrix including full pedigree and genomic information.[J]. Journal of Dairy Science, 2009, 92(9):4656-63.
ped_full <- data.frame(ID=9:17,Sire=c(1,3,5,7,9,11,11,13,13),Dam=c(2,4,6,8,10,12,4,15,14))
ped_full
G <- matrix(0.7,4,4)
diag(G) <- 1
rownames(G) <- colnames(G) <- 9:12
G
#another example
library(MASS)
animal  <- 13:26
data.11.1 <- data.frame(animal,
                        sire  = c(0,0,13,15,15,14,14,14,1,14,14,14,14,14),
                        dam   = c(0,0,4,2,5,6,9,9,3,8,11,10,7,12),
                        mean  = rep(1,length(animal)),
                        EDC   = c(558,722,300,73,52,87,64,103,13,125,93,66,75,33),
                        fat_DYD = c(9.0,13.4,12.7,15.4,5.9,7.7,10.2,4.8,7.6,8.8,9.8,9.2,11.5,13.3),
                        SNP1  = c(2,1,1,0,0,1,0,0,2,0,0,1,0,1),
                        SNP2  = c(0,0,1,0,1,1,0,1,0,0,1,0,0,0),SNP3  = c(1,0,2,2,1,0,1,1,0,0,1,0,0,1),
                        SNP4  = c(1,0,1,1,2,1,1,0,0,1,0,0,1,1),
                        SNP5  = c(0,0,1,0,0,0,0,0,0,1,0,1,1,0),
                        SNP6  = c(0,2,0,1,0,2,2,1,1,2,1,1,2,2),
                        SNP7  = c(0,0,0,0,0,0,0,0,2,0,0,0,0,0),
                        SNP8  = c(2,2,2,2,2,2,2,2,2,2,2,2,2,1),
                        SNP9  = c(1,1,1,2,1,2,2,2,1,0,2,0,1,0),
                        SNP10 = c(2,0,2,1,2,1,0,0,2,0,1,0,0,0))
                        rm(list="animal")
                        animal <- 1:26
                        sire   <- c(rep(0,12), data.11.1$sire)
                        dam    <- c(rep(0,12), data.11.1$dam)
                        ped_full    <- data.frame(animal, sire, dam)
                        rm(list=c("animal","dam","sire"))
                        M <- data.11.1[6:14, c(1, 7:16)]
                        rownames(M) <- M[, 1]
                        M012 <- as.matrix(M[, -1])
                        hinv_matrix(M012,ped_full) %>% round(3)

dengfei2013/GS documentation built on May 16, 2019, 7:29 a.m.