-
Notifications
You must be signed in to change notification settings - Fork 0
makeA
makeA(pedigree)
Constructs Wright's Numerator Relationship Matrix (WNRM) from a given pedigree structure. This is a symmetric positive-definite matrix which represents the relationships between candidates in the cohort.
-
pedigree : dict
Pedigree structure in an{int: [int, int]}
dictionary format, such as that returned from load_ped.
-
ndarray
A dense NumPy array which is equal to Wright's Numerator Relationship Matrix.
Consider an example cohort with four candidates, which when loaded into Python produces the following dictionary representing the pedigree structure
>>> pedigree = robustocs.load_ped("example.ped")
>>> pedigree
{1: [0, 0], 2: [1, 0], 3: [1, 2], 4: [1, 3]}
We can then use this in makeA
to form the WNRM (
>>> robustocs.makeA(pedigree)
array([[1. , 0.5 , 0.75 , 0.875],
[0.5 , 1. , 0.75 , 0.625],
[0.75 , 0.75 , 1.25 , 1. ],
[0.875, 0.625, 1. , 1.375]])
It does this by applying an algorithm, set out in papers such as Henderson [1]. For the
- If both parents are known, i.e.
$p > 0$ and$q > 0$ ,-
$a_{ij} = a_{ji} = \frac{1}{2}(a_{jp}, + a_{jq})$ for$j = 1, 2, \ldots, i-1$ , -
$a_{ii} = 1 + \frac{1}{2}a_{pq}$ .
-
- If only one parent is known, i.e.
$p > 0$ and$q = 0$ ,-
$a_{ij} = a_{ji} = \frac{1}{2}a_{jp}$ for$j = 1, \ldots, i-1$ , -
$a_{ii} = 1$ .
-
- If neither parent is known, i.e.
$p = 0$ and$q = 0$ ,-
$a_{ij} = a_{ji} = 0$ for$j = 1, \ldots, i-1$ , -
$a_{ii} = 1$ .
-
We can apply this to the above example, populating the matrix
Candidate 3 has known parentage,
Candidate 4 also has known parentage,
Thus our final matrix is
We see that this is the same as what makeA
formed. This matrix
- [1] Henderson (1976), A Simple Method for Computing the Inverse of a Numerator Relationship Matrix Used in Prediction of Breeding Values, Biometrics 32:1, pg. 69-83.
This documentation relates to the latest version of the package on GitHub. For past versions, download the zip bundled with the release from here. If anything in this wiki looks incorrect or you think key information is missing, please do open an issue.