TruePhenotyping#

class pybrops.breed.prot.pt.TruePhenotyping.TruePhenotyping(gpmod, **kwargs)[source]#

Bases: PhenotypingProtocol

Class implementing phenotyping protocols for extracting true breeding values.

Constructor for the concrete class TruePhenotyping.

Parameters:
  • gpmod (GenomicModel) – Genomic prediction model to use to determine phenotypes.

  • kwargs (dict) – Additional keyword arguments

Methods

copy

Make a shallow copy of the TruePhenotyping object.

deepcopy

Make a deep copy of the TruePhenotyping 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 a TruePhenotyping object to an HDF5 file.

Attributes

gpmod

Genomic prediction model.

var_err

Error variance for each trait.

copy()[source]#

Make a shallow copy of the TruePhenotyping object.

Returns:

out – A shallow copy of the TruePhenotyping object.

Return type:

TruePhenotyping

deepcopy(memo=None)[source]#

Make a deep copy of the TruePhenotyping object.

Parameters:

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

Returns:

out – A deep copy of the TruePhenotyping object.

Return type:

TruePhenotyping

classmethod from_hdf5(filename, groupname=None, gpmod=None)[source]#

Read an object from an HDF5 file.

Parameters:
  • filename (str, Path, h5py.File) – If str or Path, an HDF5 file name from which to read. File is closed after reading. If h5py.File, an opened HDF5 file from which to read. File is not closed after reading.

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

  • gpmod (GenomicModel) – A genomic model to bind to the TruePhenotyping protocol. This will be eliminated when a better storage mechanism is available.

Returns:

out – An object read from an HDF5 file.

Return type:

TruePhenotyping

property gpmod: GenomicModel#

Genomic prediction model.

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

Phenotype a set of genotypes using a genomic prediction model.

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

  • 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.

  • gpmod (GenomicModel, None) – Genomic prediction model to use to determine phenotypes. If None, use default genomic prediction model.

  • kwargs (dict) – Additional keyword arguments.

Returns:

out – A pandas.DataFrame containing phenotypes for individuals.

Return type:

pandas.DataFrame

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

Set the broad sense heritability for environments.

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

  • pgmat (PhasedGenotypeMatrix) – Founder genotypes.

  • kwargs (dict) – Additional keyword arguments

Return type:

None

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

Set the narrow sense heritability for environments.

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

  • pgmat (PhasedGenotypeMatrix) – Founder genotypes.

  • kwargs (dict) – Additional keyword arguments

Return type:

None

to_hdf5(filename, groupname=None, overwrite=True)[source]#

Write a TruePhenotyping object to an HDF5 file.

Parameters:
  • filename (str, Path, h5py.File) – If str or Path, an HDF5 file name to which to write. File is closed after writing. If h5py.File, an already opened HDF5 file to which to write. File remains open after writing.

  • 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

property var_err: ndarray#

Error variance for each trait.