## Functions | |

def | min_max_f |

def | a_effective_founders_lacy |

def | effective_founders_lacy |

def | a_effective_founders_boichard |

def | a_effective_ancestors_definite |

def | a_effective_ancestors_indefinite |

def | a_coefficients |

def | fast_a_coefficients |

def | theoretical_ne_from_metadata |

def | pedigree_completeness |

def | common_ancestors |

def | related_animals |

def | relationship |

def | mating_coi |

def | mating_coi_group |

def | effective_founder_genomes |

def | generation_intervals |

def | generation_intervals_all |

def | founder_descendants |

def | descendants |

def | dropped_ancestral_inbreeding |

def | ballou_ancestral_inbreeding |

def PyPedal::pyp_metrics::a_coefficients | ( | pedobj, |
||

a = `''` , |
||||

method = `'nrm'` | ||||

) |

a_coefficients() writes population average coefficients of inbreeding and relationship to a file, as well as individual animal IDs and coefficients of inbreeding. Some pedigrees are too large for fast_a_matrix() or fast_a_matrix_r() -- an array that large cannot be allocated due to memory restrictions -- and will result in a value of -999.9 for all outputs.

**Parameters:**-
*pedobj*A PyPedal pedigree object. *a*A numerator relationship matrix (optional). *method*If no relationship matrix is passed, determines which procedure should be called to build one (nrm|frm).

**Returns:**- A dictionary of non-zero individual inbreeding coefficients. dictionary
Write population average coefficients of inbreeding and relationship to a file, as well as individual animal IDs and coefficients of inbreeding. Some pedigrees are too large for fast_a_matrix() or fast_a_matrix_r() -- an array that large cannot be allocated due to memory restrictions -- and will result in a value of -999.9 for all outputs.

Definition at line 1004 of file pyp_metrics.py.

def PyPedal::pyp_metrics::a_effective_ancestors_definite | ( | pedobj, |
||

a = `''` , |
||||

gen = `''` | ||||

) |

a_effective_ancestors_definite() uses the algorithm in Appendix B of Boichard et al. (1996) to compute the effective ancestor number for a myped pedigree. NOTE: One problem here is that if you pass a pedigree WITHOUT generations and error is not thrown. You simply end up wth a list of generations that contains the default value for Animal() objects, 0. Boichard's algorithm requires information about the GENERATION of animals. If you do not provide an input pedigree with generations things may not work. By default the most recent generation -- the generation with the largest generation ID -- will be used as the reference population.

**Parameters:**-
*pedobj*A PyPedal pedigree object. *a*A numerator relationship matrix (optional). *gen*Generation of interest.

**Returns:**- The effective ancestor number. float
The algorithm in Appendix B of Boichard et al. (1996) is not very well written. a_effective_ancestors_definite() implements that algorithm (successfully, I hope). NOTE: One problem here is that if you pass a pedigree WITHOUT generations an error is not thrown. You simply end up wth a list of generations that contains the default value for Animal() objects, 0.

Definition at line 483 of file pyp_metrics.py.

def PyPedal::pyp_metrics::a_effective_ancestors_indefinite | ( | pedobj, |
||

a = `''` , |
||||

gen = `''` , |
||||

n = `25` | ||||

) |

a_effective_ancestors_indefinite() uses the approach outlined on pages 9 and 10 of Boichard et al. (1996) to compute approximate upper and lower bounds for f_a. This is much more tractable for large pedigrees than the exact computation provided in a_effective_ancestors_definite(). NOTE: One problem here is that if you pass a pedigree WITHOUT generations and error is not thrown. You simply end up wth a list of generations that contains the default value for Animal() objects, 0. NOTE: If you pass a value of n that is greater than the actual number of ancestors in the pedigree then strange things happen. As a stop-gap, a_effective_ancestors_indefinite() will detect that case and replace n with the number of founders - 1. Boichard's algorithm requires information about the GENERATION of animals. If you do not provide an input pedigree with generations things may not work. By default the most recent generation -- the generation with the largest generation ID -- will be used as the reference population.

**Parameters:**-
*pedobj*A PyPedal pedigree object. *a*A numerator relationship matrix (optional). *gen*Generation of interest.

**Returns:**- The effective ancestor number. float
a_effective_ancestors_indefinite() uses the approach outlined on pages 9 and 10 of Boichard et al. (1996) to compute approximate upper and lower bounds for f_a. This is much more tractable for large pedigrees than the exact computation provided in a_effective_ancestors_definite().

Definition at line 751 of file pyp_metrics.py.

def PyPedal::pyp_metrics::a_effective_founders_boichard | ( | pedobj, |
||

a = `''` , |
||||

gen = `''` | ||||

) |

a_effective_founders_boichard() uses the algorithm in Appendix A of Boichard et al. (1996) to compute the effective founder number for myped. Note that results from this function will not necessarily match those from a_effective_founders_lacy(). Boichard's algorithm requires information about the GENERATION of animals. If you do not provide an input pedigree with generations things may not work. By default the most recent generation -- the generation with the largest generation ID -- will be used as the reference population.

**Parameters:**-
*pedobj*A PyPedal pedigree object. *a*A numerator relationship matrix (optional). *gen*Generation of interest.

**Returns:**- The effective founder number. float
The algorithm in Appendix A of Boichard et al. (1996) is not very well written. a_effective_founders_boichard() implements that algorithm (successfully, I hope). Note that answers from this function will not necessarily match those from a_effective_founders_lacy().

Definition at line 333 of file pyp_metrics.py.

def PyPedal::pyp_metrics::a_effective_founders_lacy | ( | pedobj, |
||

a = `''` | ||||

) |

a_effective_founders_lacy() calculates the number of effective founders in a pedigree using the exact method of Lacy.

**Parameters:**-
*pedobj*A PyPedal pedigree object. *a*A numerator relationship matrix (optional).

**Returns:**- A dictionary of results, including the effective founder number. dictionary
Calculate the number of effective founders in a pedigree using the exact method of Lacy.

Definition at line 119 of file pyp_metrics.py.

def PyPedal::pyp_metrics::ballou_ancestral_inbreeding | ( | pedobj |
) |

ballou_ancestral_inbreeding() calculates ancestral inbreeding, the probability of an individual inheriting an allele that has undergone inbreeding in the past at least once, using the method of Ballou (1997).

**Parameters:**-
*pedobj*A PyPedal pedigree object.

**Returns:**- A dictionary of ancestral inbreeding coefficients keyed to animal IDs. dictionary
ballou_ancestral_inbreeding() calculates ancestral inbreeding, the probability of an individual inheriting an allele that has undergone inbreeding in the past at least once, using the method of Ballou (1997).

Definition at line 2505 of file pyp_metrics.py.

def PyPedal::pyp_metrics::common_ancestors | ( | anim_a, |
||

anim_b, |
||||

pedobj | ||||

) |

common_ancestors() returns a list of the ancestors that two animals share in common.

**Parameters:**-
*anim_a*The renumbered ID of the first animal, a. *anim_b*The renumbered ID of the second animal, b. *pedobj*A PyPedal pedigree object.

**Returns:**- A list of animals related to anim_a AND anim_b list
common_ancestors() returns a list of the ancestors that two animals share in common.

Definition at line 1424 of file pyp_metrics.py.

def PyPedal::pyp_metrics::descendants | ( | anid, |
||

pedobj, |
||||

_desc | ||||

) |

descendants() uses pedigree metadata to walk a pedigree and return a list of all of the descendants of a given animal.

**Parameters:**-
*anid*An animal ID *pedobj*A Python list of PyPedal Animal() objects. *_desc*A Python dictionary of descendants of animal anid.

**Returns:**- A list of descendants of anid. list
descendants() uses pedigree metadata to walk a pedigree and return a list of all of the descendants of a given animal.

Definition at line 2331 of file pyp_metrics.py.

def PyPedal::pyp_metrics::dropped_ancestral_inbreeding | ( | pedobj, |
||

rounds = `100` , |
||||

loci = `100` , |
||||

frequency = `0.05` , |
||||

seed = `5048665` | ||||

) |

dropped_ancestral_inbreeding() uses a gene dropping approach to calculate ancestral inbreeding, the probability of an individual inheriting an allele that has undergone inbreeding in the past at least once.

**Parameters:**-
*pedobj*A PyPedal pedigree object. *rounds*The number of times to simulate segregation through the entire pedigree. *loci*The number biallelic, unlinked loci to simulate. *frequency*The minor allele frequency. *seed*The seed for the RNG.

**Returns:**- A dictionary of ancestral inbreeding coefficients keyed to animal IDs. dictionary
dropped_ancestral_inbreeding() uses a gene dropping approach to calculate ancestral inbreeding, the probability of an individual inheriting an allele that has undergone inbreeding in the past at least once.

Definition at line 2379 of file pyp_metrics.py.

def PyPedal::pyp_metrics::effective_founder_genomes | ( | pedobj, |
||

rounds = `10` | ||||

) |

effective_founder_genomes() simulates the random segregation of founder alleles through a pedigree. At present only two alleles are simulated for each founder. Summary statistics are computed on the most recent generation.

**Parameters:**-
*pedobj*A PyPedal pedigree object. *rounds*The number of times to simulate segregation through the entire pedigree.

**Returns:**- The effective number of founder genomes over based on 'rounds' gene-drop simulations. float
effective_founder_genomes() simulates the random segregation of founder alleles through a pedigree. At present only two alleles are simulated for each founder. Summary statistics are computed on the most recent generation.

Definition at line 1783 of file pyp_metrics.py.

def PyPedal::pyp_metrics::effective_founders_lacy | ( | pedobj |
) |

effective_founders_lacy() calculates the number of effective founders in a pedigree using the exact method of Lacy. This version of the routine a_effective_founders_lacy() is designed to work with larger pedigrees as it forms "familywise" relationship matrices rather than a "populationwise" relationship matrix.

**Parameters:**-
*pedobj*A PyPedal pedigree object.

**Returns:**- A dictionary of results, including the effective founder number. dictionary
Calculate the number of effective founders in a pedigree using the exact method of Lacy.

Definition at line 220 of file pyp_metrics.py.

def PyPedal::pyp_metrics::fast_a_coefficients | ( | pedobj, |
||

a = `''` , |
||||

method = `'nrm'` , |
||||

debug = `0` , |
||||

storage = `'dense'` | ||||

) |

a_fast_coefficients() writes population average coefficients of inbreeding and relationship to a file, as well as individual animal IDs and coefficients of inbreeding. It returns a list of non-zero individual CoI.

**Parameters:**-
*pedobj*A PyPedal pedigree object. *a*A numerator relationship matrix (optional). *method*If no relationship matrix is passed, determines which procedure should be called to build one (nrm|frm). *storage*Use dense or sparse matrix storage.

**Returns:**- A dictionary of non-zero individual inbreeding coefficients. dictionary
a_fast_coefficients() writes population average coefficients of inbreeding and relationship to a file, as well as individual animal IDs and coefficients of inbreeding. It returns a list of non-zero individual CoI.

Definition at line 1131 of file pyp_metrics.py.

def PyPedal::pyp_metrics::founder_descendants | ( | pedobj |
) |

founder_descendants() returns a dictionary containing a list of descendants of each founder in the pedigree.

**Parameters:**-
*pedojb*An instance of a PyPedal NewPedigree object. dictionary founder_descendants() returns a dictionary containing a list of descendants of each founder in the pedigree.

Definition at line 2308 of file pyp_metrics.py.

def PyPedal::pyp_metrics::generation_intervals | ( | pedobj, |
||

units = `'y'` | ||||

) |

generation_intervals() computes the average age of parents at the time of birth of their first (oldest) offspring. This is implies that selection decisions are made at the time of birth of the first offspring. Average ages are computed for each of four paths: sire-son, sire-daughter, dam-son, and dam-daughter. An overall mean is computed, as well. IT IS IMPORTANT to note that if you DO NOT provide birthyears in your pedigree file that the returned dictionary will contain only zeroes! This is because when no birthyear is provided a default value (1900) is assigned to all animals in the pedigree.

**Parameters:**-
*pedobj*A PyPedal pedigree object. *units*A character indicating the units in which the generation lengths should be returned.

**Returns:**- A dictionary containing the five average ages. dictionary
generation_intervals() computes the average age of parents at the time of birth of their first (oldest) offspring. This is implies that selection decisions are made at the time of birth of the first offspring. Average ages are computed for each of four paths: sire-son, sire-daughter, dam-son, and dam-daughter. An overall mean is computed, as well. IT IS IMPORTANT to note that if you DO NOT provide birthyears in your pedigree file that the returned dictionary will contain only zeroes! This is because when no birthyear is provided a default value (1900) is assigned to all animals in the pedigree.

Definition at line 1972 of file pyp_metrics.py.

def PyPedal::pyp_metrics::generation_intervals_all | ( | pedobj, |
||

units = `'y'` | ||||

) |

generation_intervals_all() computes the average age of parents at the time of birth of their offspring. The computation is made using birth years for all known offspring of sires and dams, which implies discrete generations. Average ages are computed for each of four paths: sire-son, sire-daughter, dam-son, and dam-daughter. An overall mean is computed, as well. IT IS IMPORTANT to note that if you DO NOT provide birthyears in your pedigree file that the returned dictionary will contain only zeroes! This is because when no birthyear is provided a default value (1900) is assigned to all animals in the pedigree.

**Parameters:**-
*pedobj*A PyPedal pedigree object. *units*A character indicating the units in which the generation lengths should be returned.

**Returns:**- A dictionary containing the five average ages. dictionary
generation_intervals_all() computes the average age of parents at the time of birth of their offspring. The computation is made using birth years for all known offspring of sires and dams, which implies discrete generations. Average ages are computed for each of four paths: sire-son, sire-daughter, dam-son, and dam-daughter. An overall mean is computed, as well. IT IS IMPORTANT to note that if you DO NOT provide birthyears in your pedigree file that the returned dictionary will contain only zeroes! This is because when no birthyear is provided a default value (1900) is assigned to all animals in the pedigree.

Definition at line 2166 of file pyp_metrics.py.

def PyPedal::pyp_metrics::mating_coi | ( | anim_a, |
||

anim_b, |
||||

pedobj, |
||||

gens = `0` | ||||

) |

mating_coi() returns the coefficient of inbreeding of offspring of a mating between two animals, anim_a and anim_b.

**Parameters:**-
*anim_a*The renumbered ID of an animal, a. *anim_b*The renumbered ID of an animal, b. *pedobj*A PyPedal pedigree object. *gens*The number of generations from the pedigree to be used for calculating CoI. By default, gens=0.

**Returns:**- The coefficient of inbreeding of the offpsring of anim_a and anim_b float
mating_coi() returns the coefficient of inbreeding of offspring of a mating between two animals, anim_a and anim_b.

Definition at line 1563 of file pyp_metrics.py.

def PyPedal::pyp_metrics::mating_coi_group | ( | matings, |
||

pedobj, |
||||

names = `0` , |
||||

gens = `0` | ||||

) |

mating_coi_group() returns the coefficients of inbreeding of offspring of a series of matings, as well as a list of minimum-inbreeding matings.

**Parameters:**-
*matings*A list of proposed matings *pedobj*A PyPedal pedigree object. *names*Indicates if the identifiers in 'matings' are names or animalIDs *gens*The number of generations from the pedigree to be used for calculating CoI. By default, gens=0.

**Returns:**- he coefficient of inbreeding of the offpsring of anim_a and anim_b dictionary

Definition at line 1697 of file pyp_metrics.py.

def PyPedal::pyp_metrics::min_max_f | ( | pedobj, |
||

a = `''` , |
||||

n = `10` , |
||||

forma = `'dense'` | ||||

) |

min_max_f() takes a pedigree and returns a list of the individuals with the n largest and n smallest coefficients of inbreeding. Individuals with CoI of zero are not included.

**Parameters:**-
*pedobj*A PyPedal pedigree object. *a*A numerator relationship matrix (optional). *n*An integer (optional, default is 10). *forma*If A must be formed should dense or sparse matrices be used?

**Returns:**- Lists of the individuals with the n largest and the n smallest CoI in the pedigree as (ID, CoI) tuples. list
Given a pedigree or relationship matrix, return a list of the individuals with the n largest and n smallest coefficients of inbreeding; individuals with CoI of zero are not included.

Definition at line 64 of file pyp_metrics.py.

def PyPedal::pyp_metrics::pedigree_completeness | ( | pedobj, |
||

gens = `4` | ||||

) |

pedigree_completeness() computes the proportion of known ancestors in the pedigree of each animal in the population for a user-determined number of generations. Also, the mean pedcomps for all animals and for all animals that are not founders are computed as summary statistics.

**Parameters:**-
*pedobj*A PyPedal pedigree object. *gens*The number of generations the pedigree should be traced for completeness.

**Returns:**- Dictionary of summary statistics dictionary
pedigree_completeness() computes the proportion of known ancestors in the pedigree of each animal in the population for a user-determined number of generations. Also, the mean pedcomps for all animals and for all animals that are not founders are computed as summary statistics.

Definition at line 1299 of file pyp_metrics.py.

def PyPedal::pyp_metrics::related_animals | ( | anim, |
||

pedobj | ||||

) |

related_animals() returns a list of the ancestors of an animal.

**Parameters:**-
*anim_a*The renumbered ID of an animal, a. *pedobj*A PyPedal pedigree object.

**Returns:**- A list of animals related to anim_a list
related_animals() returns a list of the ancestors of an animal.

Definition at line 1457 of file pyp_metrics.py.

def PyPedal::pyp_metrics::relationship | ( | anim_a, |
||

anim_b, |
||||

pedobj | ||||

) |

relationship() returns the coefficient of relationship for two animals, anim_a and anim_b.

**Parameters:**-
*anim_a*The renumbered ID of an animal, a. *anim_b*The renumbered ID of an animal, b. *pedobj*A PyPedal pedigree object.

**Returns:**- The coefficient of relationship of anim_a and anim_b float
relationship() returns the coefficient of relationship for two animals, anim_a and anim_b.

Definition at line 1482 of file pyp_metrics.py.

def PyPedal::pyp_metrics::theoretical_ne_from_metadata | ( | pedobj |
) |

theoretical_ne_from_metadata() computes the theoretical effective population size based on the number of sires and dams contained in a pedigree metadata object. Writes results to an output file.

**Parameters:**-
*pedobj*A PyPedal pedigree object.

**Returns:**- True (1) on success, false (0) on failure integer
theoretical_ne_from_metadata() computes the theoretical effective population size based on the number of sires and dams contained in a pedigree metadata object. Writes results to an output file.

Definition at line 1257 of file pyp_metrics.py.

Generated on Fri Mar 28 14:34:59 2008 for PyPedal by 1.5.3