Practical genomic analysis

Yutaka Masuda

August 2026

Back to index.html.

Tuning and input/output of relationship matrices

In this section, we examine various options for creating and inverting relationship matrices and for saving and loading the matrices.

Construction of \(\mathbf{G}\)

OPTION whichfreq x

This option defines which type of allele frequency is used to calculate \(\mathbf{Z}\). The argument x can be 0 (use the user-supplied file; see below), 1 (use the fixed value 0.5), or 2 (use the current allele frequency calculated from the marker data; default). With argument 0, specify the file name using the following option:

OPTION FreqFile x

where x is the name of the file for allele frequency. The format of this file is explained in the previous section.

Blending

OPTION AlphaBeta a b
OPTION GammaDelta c d

These options define a as \(\alpha\), b as \(\beta\), c as \(\gamma\), and d as \(\delta\) in the blending formula \(\alpha\mathbf{G}+\beta\mathbf{A}_{22}+\gamma\mathbf{I}+\delta\mathbf{1}\mathbf{1}'\). The default values are \(\alpha = 0.95\), \(\beta = 0.05\), \(\gamma = 0\), and \(\delta = 0\). We usually impose the restriction \(\alpha + \beta = 1\), but the program does not check this restriction.

The original \(\mathbf{G}\) matrix is completely replaced by the blended \(\mathbf{G}\). After blending, we cannot retrieve the original elements of the unblended \(\mathbf{G}\).

Tuning

OPTION tunedG x

This option defines the method for tuning \(\mathbf{G}\). Tuning scales \(\mathbf{G}\) to \(\mathbf{A}_{22}\) and is a separate step from blending. In a real population, most genotypes are from recent generations, whereas the pedigree may span many generations. This can cause incompatibility between \(\mathbf{G}\) and \(\mathbf{A}_{22}\) because of differences in the information available and changes in allele frequencies over time. Tuning attempts to make \(\mathbf{G}\) compatible with \(\mathbf{A}_{22}\) by applying a single regression equation. See Chen et al. (2011), Vitezica et al. (2011), and Christensen et al. (2012) for details.

The possible argument x is as follows.

Scaling the inverse matrices

Additional scaling may be needed for \(\mathbf{G}^{-1}\) and \(\mathbf{A}_{22}^{-1}\) to maximize the predictive ability of GEBVs for young animals. The scaling factors \(\tau\) and \(\omega\) are used for this purpose. \[ \mathbf{H}^{-1} = \mathbf{A}^{-1} + \left[ \begin{array}{cc} \mathbf{0}&\mathbf{0}\\ \mathbf{0}&\tau\mathbf{G}^{-1}-\omega\mathbf{A}_{22}^{-1} \end{array} \right] \]

In the ideal situation, \(\tau = 1\) and \(\omega = 1\). Scaling may help address issues such as incomplete pedigrees and unqualified genotypes.

OPTION TauOmega t w

These options define t as \(\tau\) and w as \(\omega\) in the equation above. The default values are \(\tau = 1\) and \(\omega = 1\).

The original inverses (\(\mathbf{G}^{-1}\) and \(\mathbf{A}_{22}^{-1}\)) are completely replaced by the scaled ones (\(\tau\mathbf{G}^{-1}\) and \(\omega\mathbf{A}_{22}^{-1}\)). After scaling, we cannot retrieve the unscaled elements of \(\mathbf{G}^{-1}\) and \(\mathbf{A}_{22}^{-1}\). This behavior can be problematic when you save or load these matrices: the option rescales matrices read from files, even if the matrices have already been rescaled.

Note that this option is an ad hoc remedy for reducing bias and overdispersion in predicted breeding values. It may solve immediate problems in practice, but it may also introduce other problems. The option, particularly \(\omega\), was widely used in the past or for small populations. One reason why \(\omega\) is needed is incompatibility between \(\mathbf{G}^{-1}\) and \(\mathbf{A}^{-1}\). Accounting for inbreeding in \(\mathbf{A}^{-1}\) may solve this issue. The user should also examine the model and data for potential sources of bias.

Output options

Format

A relationship matrix and its inverse generated by the genomic module can be saved to a file. By default, the format is binary (machine-readable), which the software can read efficiently but humans cannot easily read. If you want to save the matrix in text format, the following option is useful.

OPTION saveAscii

The format is space-separated text. It has three columns per line: (1) row number, (2) column number, and (3) element value. The row and column numbers are aligned with the order in the marker file. For example, the animal that appears in the first line of the marker file has code 1, the animal in the second line has code 2, and so on. These codes are completely unrelated to the codes used in the pedigree file.

This text file can be used as a user-supplied relationship matrix in BLUPF90 with the user_file keyword. If you need maximum efficiency, do not use this option. It will slow the operation.

Basic output options

The following options are available for outputting matrices. The options are case-sensitive, so be careful when entering them.

OPTION saveA22         # save A22 to a file 'A22'
OPTION saveA22Inverse  # save A22-inverse to a file 'A22i'
OPTION saveG           # save G to a file 'G'
OPTION saveG all       # save all intermediate G
OPTION saveGInverse    # save G-inverse to a file 'Gi'

You cannot change the file name for each matrix. If you specify OPTION saveG all, the program will save all intermediate versions of \(\mathbf{G}\):

Note that the options saveGInverse and saveA22Inverse save the scaled matrices with \(\tau\) and \(\omega\). This can cause a serious problem if you later read these matrices from the files.

Additional output options

You may use the following options to save the matrices in text format. They are effective even if saveAscii is not specified.

OPTION saveHinv            # save H-inverse to `Hinv.txt`
OPTION saveAinv            # save A-inverse to `Ainv.txt`

OPTION saveA22Orig         # save A22 to a file 'A22_Orig.txt'
OPTION saveA22InverseOrig  # save A22-inverse to a file 'A22i_Orig.txt'
OPTION saveGOrig           # save G to a file 'G_Orig.txt'
OPTION saveGInverseOrig    # save G-inverse to a file 'Gi_Orig.txt'
OPTION saveHinvOrig        # save H-inverse to `HinvOrig.txt`
OPTION saveDiagHOrig       # save diag(H) to `diagH.txt`

The options with Orig take the “original” animal names (before renumbering) from the tenth column of the pedigree file and use them as row and column names in the output text file. These are not the animal codes after renumbering in the pedigree file. Thus, these Orig options assume that the pedigree file is compatible with the format prepared by RENUMF90. See the format of the renumbered pedigree file in the chapter on renumbering.

Input options

The program can read matrices from files. In this case, it does not calculate the matrix from the marker or pedigree file. If you read an inverse matrix from a file, the program can skip creating the original matrix. By default, the program reads only binary files. However, with the option OPTION saveAscii 1, it can read a text file. The following options are available.

OPTION readA22 file          # read A22                        [ default : 'A22']
OPTION readA22Inverse file   # read A22-inverse                [ default : 'A22i']
OPTION readG file            # read G                          [ default : 'G']
OPTION readGInverse file     # read G-inverse                  [ default: 'Gi']
OPTION readGimA22i file      # read (G-inverse - A22-inverse ) [ default: 'GimA22i']

If you specify a file name, the program reads the supplied file. If you omit the file name, the program tries to read the default file shown above. For example, you can use the following option to read \(\mathbf{G}^{-1}\) saved in Gi.

OPTION readGInverse

Alternatively, you can supply the file name as follows.

OPTION readGInverse condition1.Gi

The user must understand an important detail about the options readGInverse and readA22Inverse. After reading the matrix, the program scales it with \(\tau\) or \(\omega\). Thus, if you have already scaled the matrix before saving it and then read it from the file, the program scales it again without any warning or message. If you are unaware of this behavior, the results may be invalid.

A better practice is as follows.

  1. Create and save the relationship matrix without scaling factors (\(\tau\) or \(\omega\)); that is, use the default values \(\tau = 1\) and \(\omega = 1\).
  2. When reading the file, the scaling factors can be specified.

This strategy is important when performing the analysis multiple times with different \(\tau\) and \(\omega\) values.

Back to index.html.