H_matrix: 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
H_matrix(M012, ped_full)

Arguments

M012

It is the matrix which has rownames(ID), the first column is SNP infor, the SNP is 012 format.

ped_full

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

Value

The H-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
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])
idx <- as.character(1:26)
H_matrix(M012,ped_full)[idx,idx] %>% solve %>% round(3)

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