SelfCross#

class pybrops.breed.prot.mate.SelfCross.SelfCross(progeny_counter=0, family_counter=0, rng=None, **kwargs)[source]#

Bases: MatingProtocol

Class implementing mating protocols for self-fertilization.

Constructor for the concrete class SelfCross.

Parameters:
  • progeny_counter (Integral) – Progeny counter. This helps create progeny names.

  • family_counter (Integral) – Family counter. This helps label groups of progenies as originating from the same family.

  • rng (numpy.random.Generator, numpy.random.RandomState) – Random number source.

  • kwargs (dict) – Additional keyword arguments.

Methods

mate

Self-fertilize individuals.

Attributes

family_counter

Description for property family_counter.

nparent

Number of parents the mating protocol requires.

progeny_counter

Description for property progeny_counter.

rng

Random number generator.

property family_counter: Integral#

Description for property family_counter.

mate(pgmat, xconfig, nmating, nprogeny, miscout=None, nself=0, **kwargs)[source]#

Self-fertilize individuals.

Example crossing diagram:

         pgmat
           │                sel = [A,...]
           A
     ┌─────┴─────┐          nmating = 2
     A           A
  ┌──┴──┐     ┌──┴──┐       initial self, nprogeny = 2
S0(A) S0(A) S0(A) S0(A)     cross pattern finished.
  │     │     │     │       s = 2
S1(A) S1(A) S1(A) S1(A)     first self
  │     │     │     │
S2(A) S2(A) S2(A) S2(A)     second self, final result
Parameters:
  • pgmat (DensePhasedGenotypeMatrix) – A DensePhasedGenotypeMatrix containing candidate breeding individuals.

  • xconfig (numpy.ndarray) –

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

    Where:

    • ncross is the number of crosses to perform.

    • nparent is the number of parents required for a cross.

    Indices are organized as follows:

    • All indices are self parents.

    Example:

    xconfig = [[ 1 ],
               [ 3 ],
               [ 2 ],
               ...,
               [ S ]]
    self = [1, 3, 2, ..., S]
    

  • ncross (numpy.ndarray) – Number of cross patterns to perform.

  • nprogeny (numpy.ndarray) – Number of progeny to generate per cross.

  • miscout (dict, None, default = 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.

  • s (int, default = 0) – Number of generations of single seed descent post-cross pattern.

  • kwargs (dict) – Additional keyword arguments to be passed to constructor for the output DensePhasedGenotypeMatrix.

Returns:

out – A DensePhasedGenotypeMatrix of progeny.

Return type:

DensePhasedGenotypeMatrix

property nparent: Integral#

Number of parents the mating protocol requires.

property progeny_counter: Integral#

Description for property progeny_counter.

property rng: Generator | RandomState#

Random number generator.