PhenotypingProtocol#

class pybrops.breed.prot.pt.PhenotypingProtocol.PhenotypingProtocol[source]#

Bases: Copyable, HDF5InputOutput

Abstract class defining interfaces for phenotyping protocols.

The purpose of this abstract class is to provide functionality for:
  1. Genomic model metadata.

  2. Phenotype simulation.

  3. Manipulation and setting of environmental variance metadata.

Methods

copy

Make a shallow copy of the Copyable object.

deepcopy

Make a deep copy of the Copyable object.

from_hdf5

Read an object from an HDF5 file.

phenotype

Phenotype a set of genotypes using a genomic prediction model.

set_H2

Set the broad sense heritability for environments.

set_h2

Set the narrow sense heritability for environments.

to_hdf5

Write an object to an HDF5 file.

Attributes

gpmod

Genomic prediction model.

var_err

Pure error variance for each trait

abstract copy()#

Make a shallow copy of the Copyable object.

Returns:

out – A shallow copy of the Copyable object.

Return type:

Copyable

abstract deepcopy(memo)#

Make a deep copy of the Copyable object.

Parameters:

memo (dict, None) – An optional dictionary of memo metadata.

Returns:

out – A deep copy of the Copyable object.

Return type:

Copyable

abstract classmethod from_hdf5(filename, groupname)#

Read an object from an HDF5 file.

Parameters:
  • filename (str, Path, h5py.File) – If str, an HDF5 file name from which to read. If Path, an HDF5 file name from which to read. If h5py.File, an opened HDF5 file from which to read.

  • groupname (str, None) – If str, an HDF5 group name under which object data is stored. If None, object is read from base HDF5 group.

Returns:

out – An object read from an HDF5 file.

Return type:

HDF5InputOutput

abstract property gpmod: GenomicModel#

Genomic prediction model.

abstract phenotype(pgmat, miscout, **kwargs)[source]#

Phenotype a set of genotypes using a genomic prediction model.

Parameters:
  • pgmat (PhasedGenotypeMatrix) – Genomes of the individuals to phenotype.

  • 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 pandas.DataFrame containing phenotypes for individuals.

Return type:

pandas.DataFrame

abstract set_H2(H2, pgmat, **kwargs)[source]#

Set the broad sense heritability for environments.

Parameters:
  • H2 (Real, numpy.ndarray) – Broad sense heritability.

  • pgmat (PhasedGenotypeMatrix) – Founder genotypes.

  • kwargs (dict) – Additional keyword arguments

Return type:

None

abstract set_h2(h2, pgmat, **kwargs)[source]#

Set the narrow sense heritability for environments.

Parameters:
  • h2 (Real, numpy.ndarray) – Narrow sense heritability.

  • pgmat (PhasedGenotypeMatrix) – Founder genotypes.

  • kwargs (dict) – Additional keyword arguments

Return type:

None

abstract to_hdf5(filename, groupname, overwrite)#

Write an object to an HDF5 file.

Parameters:
  • filename (str, Path, h5py.File) – If str, an HDF5 file name to which to write. If Path, an HDF5 file path to which to write. If h5py.File, an opened HDF5 file to which to write.

  • groupname (str, None) – If str, an HDF5 group name under which object data is stored. If None, object is written to the base HDF5 group.

  • overwrite (bool) – Whether to overwrite values in an HDF5 file if a field already exists.

Return type:

None

abstract property var_err: object#

Pure error variance for each trait