# Linear Models for the Prediction of Animal Breeding Values, 3rd Edition.

# Raphael Mrode

# Example 11.2 p183

간단한 설명은 다음 포스팅을 참고한다.

2020/12/19 - [Animal Breeding/R for Genetic Evaluation] - Mixed Linear Model(SNP-BLUP Model) for Computing SNP Effects, unweighted analysis

 

Mixed Linear Model for Computing SNP Effects(SNP-BLUP Model), unweighted analysis

# Linear Models for the Prediction of Animal Breeding Values, 3rd Edition. # Raphael Mrode # Example 11.2 p183 SNP effect를 임의 효과로 다루어 SNP effect를 추정한다. 각 SNP effect의..

bhpark.tistory.com

 

Data

13 0 0 1 558 9 0.00179211 1.3571429 -0.3571429 0.2857143 0.2857143 -0.2857143 -1.2142857 -0.1428571 0.07142857 -0.1428571 1.2142857
14 0 0 1 722 13.4 0.00138504 0.3571429 -0.3571429 -0.7142857 -0.7142857 -0.2857143 0.7857143 -0.1428571 0.07142857 -0.1428571 -0.7857143
15 13 4 1 300 12.7 0.00333333 0.3571429 0.6428571 1.2857143 0.2857143 0.7142857 -1.2142857 -0.1428571 0.07142857 -0.1428571 1.2142857
16 15 2 1 73 15.4 0.01369863 -0.6428571 -0.3571429 1.2857143 0.2857143 -0.2857143 -0.2142857 -0.1428571 0.07142857 0.8571429 0.2142857
17 15 5 1 52 5.9 0.01923077 -0.6428571 0.6428571 0.2857143 1.2857143 -0.2857143 -1.2142857 -0.1428571 0.07142857 -0.1428571 1.2142857
18 14 6 1 87 7.7 0.01149425 0.3571429 0.6428571 -0.7142857 0.2857143 -0.2857143 0.7857143 -0.1428571 0.07142857 0.8571429 0.2142857
19 14 9 1 64 10.2 0.01562500 -0.6428571 -0.3571429 0.2857143 0.2857143 -0.2857143 0.7857143 -0.1428571 0.07142857 0.8571429 -0.7857143
20 14 9 1 103 4.8 0.00970874 -0.6428571 0.6428571 0.2857143 -0.7142857 -0.2857143 -0.2142857 -0.1428571 0.07142857 0.8571429 -0.7857143

 

1 ~ 3 : animal, sire, dam

4 : general mean

5 : EDC(using weight)

6 : Fat DYD

7 : EDC 역수

8 - 17 : SNP1 ~ SNP10의 coding하고 평균을 0으로 scaling한 값

(7 - 17 컬럼은 원래의 자료에서 계산을 하여 입력하여야 한다.)

* 계산 방법은 위 포스팅을 참고


Renumf90 Parameter File

# Parameter file for program renf90; it is translated to parameter
# file for BLUPF90 family programs.
DATAFILE
snp_data2.txt
TRAITS
6
FIELDS_PASSED TO OUTPUT
 
WEIGHT(S)
 
RESIDUAL_VARIANCE
245
EFFECT
4 cross alpha
EFFECT
4 cross alpha
RANDOM
diagonal
RANDOM_REGRESSION
data
RR_POSITION
8 9 10 11 12 13 14 15 16 17
(CO)VARIANCES
9.96 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 9.96 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 9.96 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 9.96 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 9.96 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 9.96 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 9.96 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 9.96 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 9.96 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 9.96
OPTION solv_method FSPAK

 

첫째

EFFECT
4 cross alpha

general mean의 추정을 위하여 넣은 effect

 

두번째

EFFECT 
4 cross alpha

SNP 효과들을 회귀 변수로 다루기 위한 effect. 공변이를 임의 효과로 다루므로 일종의 random regression model이다. 이 효과에 대해서 nested 하는데 결국 모두 1이므로 전체에 대해서 회귀 계수(SNP effect)를 추정하게 된다.

 

RANDOM
diagonal

대각 성분에만 분산을 더하여 효과 추정

 

RANDOM_REGRESSION
data

공변이들이 자료에 있다는 의미


RR_POSITION
8 9 10 11 12 13 14 15 16 17

자료에 있는 공변이들의 위치


(CO)VARIANCES
9.96 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 9.96 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 9.96 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 9.96 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 9.96 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 9.96 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 9.96 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 9.96 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 9.96 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 9.96

10개 random SNP effect의 분산 행렬. 여기서 9.96은 상가적 유전분산(35.242)을 각 SNP의 2p(1-p)의 합(3.5382)으로 나누어준 값이다.

 

Renumf90 실행 화면

 

renumf90 실행 로드

 RENUMF90 version 1.145
 renumf90_mlm_snp_uw.par
 datafile:snp_data2.txt
 traits:           6
 R
   245.0    

 Processing effect  1 of type cross     
 item_kind=alpha     

 Processing effect  2 of type cross     
 item_kind=alpha     
 Reading (CO)VARIANCES:          10 x          10

 Maximum size of character fields: 20

 Maximum size of record (max_string_readline): 800

 Maximum number of fields for input file (max_field_readline): 100

 Pedigree search method (ped_search): convention

 Order of pedigree animals (animal_order): default

 Order of UPG (upg_order): default

 Missing observation code (missing): 0

 hash tables for effects set up
 first 3 lines of the data file (up to 70 characters)
    13 0 0 1 558 9 0.00179211 1.3571429 -0.3571429 0.2857143 0.2857143 -0.
    14 0 0 1 722 13.4 0.00138504 0.3571429 -0.3571429 -0.7142857 -0.714285
    15 13 4 1 300 12.7 0.00333333 0.3571429 0.6428571 1.2857143 0.2857143
 read            8  records
 table with            1  elements sorted
 added count
 Effect group            1  of column            1  with            1  levels
 table expanded from        10000  to        10000  records
 table with            1  elements sorted
 added count
 Effect group            2  of column            1  with            1  levels
 table expanded from        10000  to        10000  records
 wrote statistics in file "renf90.tables"

 Basic statistics for input data  (missing value code is '0')
 Pos  Min         Max         Mean        SD                 N
   6    4.8000      15.400      9.8875      3.7434           8

 random effect   2
 type:diag      

 Wrote parameter file "renf90.par"
 Wrote renumbered data "renf90.dat" 8 records

 

renumf90으로 생성된 파일

renf90.dat

 9 1.3571429 -0.3571429 0.2857143 0.2857143 -0.2857143 -1.2142857 -0.1428571 0.07142857 -0.1428571 1.2142857 1 1
 13.4 0.3571429 -0.3571429 -0.7142857 -0.7142857 -0.2857143 0.7857143 -0.1428571 0.07142857 -0.1428571 -0.7857143 1 1
 12.7 0.3571429 0.6428571 1.2857143 0.2857143 0.7142857 -1.2142857 -0.1428571 0.07142857 -0.1428571 1.2142857 1 1
 15.4 -0.6428571 -0.3571429 1.2857143 0.2857143 -0.2857143 -0.2142857 -0.1428571 0.07142857 0.8571429 0.2142857 1 1
 5.9 -0.6428571 0.6428571 0.2857143 1.2857143 -0.2857143 -1.2142857 -0.1428571 0.07142857 -0.1428571 1.2142857 1 1
 7.7 0.3571429 0.6428571 -0.7142857 0.2857143 -0.2857143 0.7857143 -0.1428571 0.07142857 0.8571429 0.2142857 1 1
 10.2 -0.6428571 -0.3571429 0.2857143 0.2857143 -0.2857143 0.7857143 -0.1428571 0.07142857 0.8571429 -0.7857143 1 1
 4.8 -0.6428571 0.6428571 0.2857143 -0.7142857 -0.2857143 -0.2142857 -0.1428571 0.07142857 0.8571429 -0.7857143 1 1

 

renf90.par

# BLUPF90 parameter file created by RENUMF90
DATAFILE
 renf90.dat
NUMBER_OF_TRAITS
           1
NUMBER_OF_EFFECTS
          11
OBSERVATION(S)
    1
WEIGHT(S)
 
EFFECTS: POSITIONS_IN_DATAFILE NUMBER_OF_LEVELS TYPE_OF_EFFECT[EFFECT NESTED]
 12         1 cross 
 2          1 cov 13
 3          1 cov 13
 4          1 cov 13
 5          1 cov 13
 6          1 cov 13
 7          1 cov 13
 8          1 cov 13
 9          1 cov 13
 10          1 cov 13
 11          1 cov 13
RANDOM_RESIDUAL VALUES
   245.00    
 RANDOM_GROUP
     2     3     4     5     6     7     8     9    10    11
 RANDOM_TYPE
 diagonal     
 FILE
                                                                                
(CO)VARIANCES
   9.9600       0.0000       0.0000       0.0000       0.0000       0.0000       0.0000    
   0.0000       0.0000       0.0000    
   0.0000       9.9600       0.0000       0.0000       0.0000       0.0000       0.0000    
   0.0000       0.0000       0.0000    
   0.0000       0.0000       9.9600       0.0000       0.0000       0.0000       0.0000    
   0.0000       0.0000       0.0000    
   0.0000       0.0000       0.0000       9.9600       0.0000       0.0000       0.0000    
   0.0000       0.0000       0.0000    
   0.0000       0.0000       0.0000       0.0000       9.9600       0.0000       0.0000    
   0.0000       0.0000       0.0000    
   0.0000       0.0000       0.0000       0.0000       0.0000       9.9600       0.0000    
   0.0000       0.0000       0.0000    
   0.0000       0.0000       0.0000       0.0000       0.0000       0.0000       9.9600    
   0.0000       0.0000       0.0000    
   0.0000       0.0000       0.0000       0.0000       0.0000       0.0000       0.0000    
   9.9600       0.0000       0.0000    
   0.0000       0.0000       0.0000       0.0000       0.0000       0.0000       0.0000    
   0.0000       9.9600       0.0000    
   0.0000       0.0000       0.0000       0.0000       0.0000       0.0000       0.0000    
   0.0000       0.0000       9.9600    
OPTION solv_method FSPAK

 

위에서 생성된 renf90.dat와 renf90.par를 이용하여 blupf90 실행

blupf90 실행 화면

 

blupf90 실행 로그

renf90.par
     BLUPF90 ver. 1.68

 Parameter file:             renf90.par
 Data file:                  renf90.dat
 Number of Traits             1
 Number of Effects           11
 Position of Observations      1
 Position of Weight (1)        0
 Value of Missing Trait/Observation           0

EFFECTS
 #  type                position (2)        levels   [positions for nested]
    1  cross-classified      12         1
    2  covariable             2         1    13
    3  covariable             3         1    13
    4  covariable             4         1    13
    5  covariable             5         1    13
    6  covariable             6         1    13
    7  covariable             7         1    13
    8  covariable             8         1    13
    9  covariable             9         1    13
   10  covariable            10         1    13
   11  covariable            11         1    13

 Residual (co)variance Matrix
  245.00    

 correlated random effects     2  3  4  5  6  7  8  9 10 11
 Type of Random Effect:      diagonal
 trait   effect    (CO)VARIANCES
  1       2     9.960       0.000       0.000       0.000       0.000       0.000       0.000       0.000       0.000       0.000    
  1       3     0.000       9.960       0.000       0.000       0.000       0.000       0.000       0.000       0.000       0.000    
  1       4     0.000       0.000       9.960       0.000       0.000       0.000       0.000       0.000       0.000       0.000    
  1       5     0.000       0.000       0.000       9.960       0.000       0.000       0.000       0.000       0.000       0.000    
  1       6     0.000       0.000       0.000       0.000       9.960       0.000       0.000       0.000       0.000       0.000    
  1       7     0.000       0.000       0.000       0.000       0.000       9.960       0.000       0.000       0.000       0.000    
  1       8     0.000       0.000       0.000       0.000       0.000       0.000       9.960       0.000       0.000       0.000    
  1       9     0.000       0.000       0.000       0.000       0.000       0.000       0.000       9.960       0.000       0.000    
  1      10     0.000       0.000       0.000       0.000       0.000       0.000       0.000       0.000       9.960       0.000    
  1      11     0.000       0.000       0.000       0.000       0.000       0.000       0.000       0.000       0.000       9.960    

 REMARKS
  (1) Weight position 0 means no weights utilized
  (2) Effect positions of 0 for some effects and traits means that such
      effects are missing for specified traits
 

 * The limited number of OpenMP threads = 4

 * solving method (default=PCG):FSPAK               
 
 Data record length =           13
 # equations =           11
 G
  9.9600      0.0000      0.0000      0.0000      0.0000      0.0000      0.0000      0.0000      0.0000    
  0.0000    
  0.0000      9.9600      0.0000      0.0000      0.0000      0.0000      0.0000      0.0000      0.0000    
  0.0000    
  0.0000      0.0000      9.9600      0.0000      0.0000      0.0000      0.0000      0.0000      0.0000    
  0.0000    
  0.0000      0.0000      0.0000      9.9600      0.0000      0.0000      0.0000      0.0000      0.0000    
  0.0000    
  0.0000      0.0000      0.0000      0.0000      9.9600      0.0000      0.0000      0.0000      0.0000    
  0.0000    
  0.0000      0.0000      0.0000      0.0000      0.0000      9.9600      0.0000      0.0000      0.0000    
  0.0000    
  0.0000      0.0000      0.0000      0.0000      0.0000      0.0000      9.9600      0.0000      0.0000    
  0.0000    
  0.0000      0.0000      0.0000      0.0000      0.0000      0.0000      0.0000      9.9600      0.0000    
  0.0000    
  0.0000      0.0000      0.0000      0.0000      0.0000      0.0000      0.0000      0.0000      9.9600    
  0.0000    
  0.0000      0.0000      0.0000      0.0000      0.0000      0.0000      0.0000      0.0000      0.0000    
  9.9600    
 read            8  records in   0.2343750      s,                      66 
  nonzeroes
 finished peds in   0.2343750      s,                      66  nonzeroes
 left hand side
      0.0327     -0.0006      0.0047      0.0093      0.0052     -0.0052     -0.0070     -0.0047      0.0023      0.0117      0.0070
     -0.0006      0.1162     -0.0021     -0.0042     -0.0016      0.0016     -0.0040      0.0001     -0.0000     -0.0063      0.0080
      0.0047     -0.0021      0.1092      0.0013      0.0028      0.0013     -0.0051     -0.0007      0.0003      0.0017      0.0051
      0.0093     -0.0042      0.0013      0.1194      0.0056      0.0026     -0.0142     -0.0013      0.0007      0.0033      0.0102
      0.0052     -0.0016      0.0028      0.0056      0.1130     -0.0003     -0.0093     -0.0007      0.0004     -0.0002      0.0134
     -0.0052      0.0016      0.0013      0.0026     -0.0003      0.1048     -0.0030      0.0007     -0.0004     -0.0039      0.0030
     -0.0070     -0.0040     -0.0051     -0.0142     -0.0093     -0.0030      0.1264      0.0010     -0.0005      0.0057     -0.0219
     -0.0047      0.0001     -0.0007     -0.0013     -0.0007      0.0007      0.0010      0.1011     -0.0003     -0.0017     -0.0010
      0.0023     -0.0000      0.0003      0.0007      0.0004     -0.0004     -0.0005     -0.0003      0.1006      0.0008      0.0005
      0.0117     -0.0063      0.0017      0.0033     -0.0002     -0.0039      0.0057     -0.0017      0.0008      0.1127     -0.0057
      0.0070      0.0080      0.0051      0.0102      0.0134      0.0030     -0.0219     -0.0010      0.0005     -0.0057      0.1264
 right hand side:
    0.32    0.00    0.01    0.12    0.04   -0.04   -0.05   -0.05    0.02    0.11
    0.07
 solution:
    9.94    0.09   -0.31    0.26   -0.08    0.11    0.14   -0.00    0.00   -0.06
   -0.02
 solutions stored in file: "solutions"

 

blupf90 실행 결과 : solutions

trait/effect level  solution
   1   1         1          9.94394207
   1   2         1          0.08702092
   1   3         1         -0.31079215
   1   4         1          0.26246002
   1   5         1         -0.08027711
   1   6         1          0.11020813
   1   7         1          0.13908022
   1   8         1         -0.00000000
   1   9         1          0.00000000
   1  10         1         -0.06069044
   1  11         1         -0.01580233

 

general mean effect(1개) 추정하고, 10개의 SNP effect를 추정

 

 

 

+ Recent posts