inbr = pyp_nrm.inbreeding(example)
print 'inbr: ',
>>> inbr: {
'fx': {1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0, 5: 0.0, 6: 0.0, 7: 0.0,
8: 0.0, 9: 0.0, 10: 0.0, 11: 0.0, 12: 0.0, 13: 0.0, 14: 0.0},
'metadata': {
'nonzero': {'f_max': 0.0, 'f_avg': 0.0, 'f_rng': 0.0,
'f_sum': 0.0, 'f_min': 0.0, 'f_count': 0},
'all': {'f_max': 0.0, 'f_avg': 0.0, 'f_rng': 0.0, 'f_sum': 0.0,
'f_min': 0.0, 'f_count': 14}
}
}
Relationship metadata, similar to the inbreeding metadata described above but for coefficients of relationship, are available but not calculated by default.
inbr,reln = pyp_nrm.inbreeding(example,rels=1)
print 'reln: ', reln
>>> reln: {'r_nonzero_count': 10, 'r_nonzero_avg': 0.40000000000000002,
'r_min': 0.25, 'r_sum': 4.0, 'r_avg': 0.19047619047619047, 'r_max': 0.5,
'r_count': 21, 'r_rng': 0.25}
Relationship metadata are not guaranteed to be correct when "method = 'vanraden'" is used. This is because inbreeding_vanraden() uses a speed-up when there are full-sibs in the pedigree to avoid repeating calculations. The metadata should be reasonably accurate for pedigrees with few or no full-sibs. The summary statistics will not be very accurate in the case of pedigrees that contain lots of full-sibs.
The relationship metadata do not include individual pairwise relationships. In order to associate those with your pedigree you must create a NewAMatrix object, form the numerator relationship matrix (NRM), and attach it to the pedigree:
options = {}
...
example = pyp_newclasses.loadPedigree(options)
example.nrm = pyp_newclasses.NewAMatrix(example.kw)
example.nrm.form_a_matrix(example.pedigree)
options = {}
options['form_nrm'] = 1
...
example = pyp_newclasses.loadPedigree(options)
[[ 1. 0. 0. 0. 0.5 0. 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25] [ 0. 1. 0. 0. 0.5 0. 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25] [ 0. 0. 1. 0. 0. 0.5 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25] [ 0. 0. 0. 1. 0. 0.5 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25] [ 0.5 0.5 0. 0. 1. 0. 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ] [ 0. 0. 0.5 0.5 0. 1. 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ] [ 0.25 0.25 0.25 0.25 0.5 0.5 1. 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ] [ 0.25 0.25 0.25 0.25 0.5 0.5 0.5 1. 0.5 0.5 0.5 0.5 0.5 0.5 ] [ 0.25 0.25 0.25 0.25 0.5 0.5 0.5 0.5 1. 0.5 0.5 0.5 0.5 0.5 ] [ 0.25 0.25 0.25 0.25 0.5 0.5 0.5 0.5 0.5 1. 0.5 0.5 0.5 0.5 ] [ 0.25 0.25 0.25 0.25 0.5 0.5 0.5 0.5 0.5 0.5 1. 0.5 0.5 0.5 ] [ 0.25 0.25 0.25 0.25 0.5 0.5 0.5 0.5 0.5 0.5 0.5 1. 0.5 0.5 ] [ 0.25 0.25 0.25 0.25 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 1. 0.5 ] [ 0.25 0.25 0.25 0.25 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 1. ]]
print example.nrm.nrm[1][4] >>> 0.5
print example.nrm.nrm[1][4] >>> 0.5 print example.nrm.nrm[5][1] >>> 0.5
example.nrm.save('Amatrix.txt')
1.0 0.0 0.0 0.0 0.5 0.0 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.0 1.0 0.0 0.0 0.5 0.0 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.0 0.0 1.0 0.0 0.0 0.5 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.0 0.0 0.0 1.0 0.0 0.5 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.5 0.5 0.0 0.0 1.0 0.0 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.0 0.0 0.5 0.5 0.0 1.0 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.25 0.25 0.25 0.25 0.5 0.5 1.0 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.25 0.25 0.25 0.25 0.5 0.5 0.5 1.0 0.5 0.5 0.5 0.5 0.5 0.5 0.25 0.25 0.25 0.25 0.5 0.5 0.5 0.5 1.0 0.5 0.5 0.5 0.5 0.5 0.25 0.25 0.25 0.25 0.5 0.5 0.5 0.5 0.5 1.0 0.5 0.5 0.5 0.5 0.25 0.25 0.25 0.25 0.5 0.5 0.5 0.5 0.5 0.5 1.0 0.5 0.5 0.5 0.25 0.25 0.25 0.25 0.5 0.5 0.5 0.5 0.5 0.5 0.5 1.0 0.5 0.5 0.25 0.25 0.25 0.25 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 1.0 0.5 0.25 0.25 0.25 0.25 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 1.0
Finally, if you're going to work on the exact same pedigree later you can load "Amatrix.txt" and avoid having to recalculate the NRM entirely:
example.nrm2 = pyp_newclasses.NewAMatrix(example.kw)
example.nrm2.load('Amatrix.txt')
example.nrm2.printme()
See About this document... for information on suggesting changes.