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:
  1. Converting genetic distance to recombination probability.

  2. Converting recombination probability to genetic distance.

  3. Converting physical distance to recombination probability.

Methods

invmapfn

convert recombination probability (r) to genetic distance (d).

mapfn

Convert genetic distance (d) to recombination probability (r).

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.

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