KosambiMapFunction#

class pybrops.popgen.gmap.KosambiMapFunction.KosambiMapFunction(**kwargs)[source]#

Bases: GeneticMapFunction

A concrete class for the Kosambi genetic map function.

The purpose of this concrete class is to implement functionality for:
  1. Converting genetic distance to recombination probability.

  2. Converting recombination probability to genetic distance.

  3. Converting physical distance to recombination probability.

Constructor for a Kosambi mapping function object.

Parameters:

kwargs (dict) – Additional keyword arguments.

Methods

invmapfn

Convert recombination probabilities between two loci to genetic map distances using the Kosambi mapping function (Kosambi, 1944).

mapfn

Convert genetic map distances to recombination probabilities using the Kosambi mapping function (Kosambi, 1944).

rprob1g

Calculate sequential recombination probabilities using genetic distances.

rprob1p

Calculate sequential recombination probabilities using physical distances.

rprob2g

Calculate pairwise recombination probabilities using genetic distances.

rprob2p

Calculate pairwise recombination probabilities using physical distances.

invmapfn(r)[source]#

Convert recombination probabilities between two loci to genetic map distances using the Kosambi mapping function (Kosambi, 1944).

This is a bare-bones function and does no parameter checking for errors.

Parameters:

r (numpy.ndarray) – An array of recombination probabilities between two loci.

Returns:

d – An array of genetic map distances as defined by the Kosambi mapping function. The shape of the array is the same shape as that of r.

Return type:

numpy.ndarray

mapfn(d)[source]#

Convert genetic map distances to recombination probabilities using the Kosambi mapping function (Kosambi, 1944).

Parameters:

d (numpy.ndarray) – An array of genetic distances in Morgans. This can be an array of any shape.

Returns:

r – An array of recombination probabilities. The shape of the array is the same shape as that of d.

Return type:

numpy.ndarray

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

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

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

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