MatingProtocol#

class pybrops.breed.prot.mate.MatingProtocol.MatingProtocol[source]#

Bases: object

Abstract class for mating protocols.

The purpose of this abstract class is to provide functionality for:
  1. Mating simulation and progeny generation from genotype matrices.

Methods

mate

Mate individuals according to a mating scheme.

Attributes

nparent

Number of parents the mating protocol requires.

abstract mate(pgmat, xconfig, nmating, nprogeny, miscout, **kwargs)[source]#

Mate individuals according to a mating scheme.

Parameters:
  • pgmat (PhasedGenotypeMatrix) – A PhasedGenotypeMatrix of parental candidates.

  • xconfig (numpy.ndarray) – Array of shape (ncross,nparent) containing indices specifying a cross configuration. Each index corresponds to an individual in pgmat.

  • nmating (Integral, numpy.ndarray) – Number of matings of the cross configuration per cross pattern. Relevant in situations with heterozygous parents.

  • nprogeny (Integral, numpy.ndarray) – Number of progeny to generate per mating.

  • miscout (dict, None) – Pointer to a dictionary for miscellaneous user defined output. If dict, write to dict (may overwrite previously defined fields). If None, user defined output is not calculated or stored.

  • kwargs (dict) – Additional keyword arguments.

Returns:

out – A PhasedGenotypeMatrix of progeny.

Return type:

PhasedGenotypeMatrix

abstract property nparent: Integral#

Number of parents the mating protocol requires.