GeneticMapFunction#
- class pybrops.popgen.gmap.GeneticMapFunction.GeneticMapFunction[source]#
Bases:
object
An abstract class for genetic map function objects.
- The purpose of this abstract class is to define base functionality for:
Converting genetic distance to recombination probability.
Converting recombination probability to genetic distance.
Converting physical distance to recombination probability.
Methods
convert recombination probability (r) to genetic distance (d).
Convert genetic distance (d) to recombination probability (r).
Calculate sequential recombination probabilities using genetic distances.
Calculate sequential recombination probabilities using physical distances.
Calculate pairwise recombination probabilities using genetic distances.
Calculate pairwise recombination probabilities using physical distances.
- abstract invmapfn(r)[source]#
convert recombination probability (r) to genetic distance (d).
- Parameters:
r (numpy.ndarray) – An array of recombination probabilities.
- Returns:
d – An array of genetic distances in Morgans.
- Return type:
numpy.ndarray
- abstract mapfn(d)[source]#
Convert genetic distance (d) to recombination probability (r).
- Parameters:
d (numpy.ndarray) – An array of genetic map distances in Morgans.
- Returns:
r – An array of recombination probabilities for each corresponding distance.
- Return type:
numpy.ndarray
- abstract rprob1g(gmap, vrnt_chrgrp, vrnt_genpos)[source]#
Calculate sequential recombination probabilities using genetic distances. Calculate recombination probabilities between successive entries along a chromosome. Supply 0.5 across chromosomes.
Example:
vrnt_chrgrp = [ 1, 1, 2, 2, 2, 3, 3] vrnt_genpos = [...] xo = [.5, .2, .5, .1, .3, .5, .2]
- Parameters:
gmap (GeneticMap) – GeneticMap object for calculating genetic distances between successive entries along a chromosome.
vrnt_chrgrp (numpy.ndarray) – An array assigning chromosomes to groups. Must be sorted.
vrnt_genpos (numpy.ndarray) – An array of genetic positions. Must be sorted and correspond with
vrnt_chrgrp
.
- Returns:
r – A 1D array of recombination probabilities.
- Return type:
numpy.ndarray
- abstract rprob1p(gmap, vrnt_chrgrp, vrnt_phypos)[source]#
Calculate sequential recombination probabilities using physical distances.
- Parameters:
gmap (GeneticMap) – GeneticMap object for calculating genetic distances between successive entries along a chromosome.
vrnt_chrgrp (numpy.ndarray) – An array assigning chromosomes to groups. Must be sorted.
vrnt_phypos (numpy.ndarray) – An array of physical positions. Must be sorted and correspond with
vrnt_chrgrp
.
- Returns:
r – A 1D array of recombination probabilities.
- Return type:
numpy.ndarray
- abstract rprob2g(gmap, vrnt_chrgrp, vrnt_genpos)[source]#
Calculate pairwise recombination probabilities using genetic distances. Calculate a recombination probability matrix.
- Parameters:
gmap (GeneticMap) – GeneticMap object for calculating genetic distances between successive entries along a chromosome.
vrnt_chrgrp (numpy.ndarray) – An array assigning chromosomes to groups. Must be sorted.
vrnt_genpos (numpy.ndarray) – An array of genetic positions. Must be sorted and correspond with
vrnt_chrgrp
.
- Returns:
r – A 2D array of recombination probabilities.
- Return type:
numpy.ndarray
- abstract rprob2p(gmap, vrnt_chrgrp, vrnt_phypos)[source]#
Calculate pairwise recombination probabilities using physical distances.
- Parameters:
gmap (GeneticMap) – GeneticMap object for calculating genetic distances between successive entries along a chromosome.
vrnt_chrgrp (numpy.ndarray) – An array assigning chromosomes to groups. Must be sorted.
vrnt_phypos (numpy.ndarray) – An array of physical positions. Must be sorted and correspond with
vrnt_chrgrp
.
- Returns:
r – A 2D array of recombination probabilities.
- Return type:
numpy.ndarray