5.3 Matings

There are a number of questions you might wish to ask that involve matings, such as, ``What is the minimum-inbreeding mating among this set of individuals?''. Several routines in pyp_metrics.

Suppose you were considering a mating between animals 5 (index 4) and 14 (index 13), which is a sire-daughter mating. How would you go about this? You simply call pyp_metrics.mating_coi():

print '\tCalling mating_coi() at %s' % ( pyp_nice_time() )
f = pyp_metrics.mating_coi(example.pedigree[4].animalID,
print f
which produces the output:
Calling mating_coi() at Wed Mar  5 11:31:30 2008
We don't need PyPedal to tell us the coefficient of inbreeding of such a simple mating, but the calculations can be complex for more complicated cases. While you can do all of the necessary computations ``by hand'', pyp_metrics.mating_coi() takes care of that for you by adding a new dummy animal to the pedigree with the proposed parents, calculating the coefficient of inbreeding of that mating, deleting the dummy animal from the pedigree, and returning the coefficient of inbreeding.

PyPedal takes things one step further, allowing you to work with groups of proposed matings at one time using pyp_metrics.mating_coi_group(). Internally it works similarly to pyp_metrics.mating_coi(), although instead of passing a pair of parents you pass a list of proposed matings. The matings are of the form "<parent1>_<parent2>". Here's an example in which we are going to consider the following three matings: 1 with 5, 1 with 14, and 5 with 14. Note how the matings are formed and appended to the "matings" list in one step.

matings = []
matings.append('%s_%s'%(example.pedigree[0].animalID, example.pedigree[4].animalID))
matings.append('%s_%s'%(example.pedigree[0].animalID, example.pedigree[13].animalID))
matings.append('%s_%s'%(example.pedigree[4].animalID, example.pedigree[13].animalID))
fgrp = pyp_metrics.mating_coi_group(matings,example)
print 'fgrp: ', fgrp['matings']
That code produces a list of the proposed matings with associated coefficients of inbreeding. In addition to the "matings" dictionary, the "fgrp" dictionary also contains a dictionary named "metadata" which contains summary statistics about the proposed matings.
fgrp:  {'1_5': 0.25, '5_14': 0.25, '1_14': 0.125}
See About this document... for information on suggesting changes.