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,
example.pedigree[13].animalID,example,1)
print f
Calling mating_coi() at Wed Mar 5 11:31:30 2008 0.25
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']
fgrp: {'1_5': 0.25, '5_14': 0.25, '1_14': 0.125}