PyPop.Homozygosity#

Module for calculating homozygosity statistics.

Classes#

Homozygosity

Calculate homozygosity statistics.

HomozygosityEWSlatkinExact

Calculate homozygosity statistics.

HomozygosityEWSlatkinExactPairwise

Functions#

getObservedHomozygosityFromAlleleData(alleleData)

Module Contents#

getObservedHomozygosityFromAlleleData(alleleData)#
class Homozygosity(alleleData, rootPath='.', debug=0)#

Calculate homozygosity statistics.

Given allele count data for a given locus, calculates the observed homozygosity and returns the approximate expected homozygosity statistics taken from previous simulation runs.

Constructor for homozygosity statistics.

Given:

  • ‘alleleCountData’: tuple consisting of a dictionary of alleles with their associated counts and the total number of alleles.

  • ‘rootPath’: path to the root of the directory where the pre-calculated expected homozygosity statistics can be found.

  • ‘debug’: flag to switch debugging on.

getObservedHomozygosity()#

Calculate and return observed homozygosity.

Available even if expected stats cannot be calculated

canGenerateExpectedStats()#

Can expected homozygosity stats be calculated?

Returns true if expected homozygosity statistics can be calculated. Should be called before attempting to get any expected homozygosity statistics.

getPValueRange()#

Gets lower and upper bounds for p-value.

Returns a tuple of (lower, upper) bounds.

Only meaningful if ‘canGenerateExpectedStats()’ returns true.

getCount()#

Number of runs used to calculate statistics.

Only meaningful if ‘canGenerateExpectedStats()’ returns true.

getExpectedHomozygosity()#

Gets mean of expected homozygosity.

This is the estimate of the expected homozygosity.

Only meaningful if ‘canGenerateExpectedStats()’ returns true.

getVarExpectedHomozygosity()#

Gets variance of expected homozygosity.

This is the estimate of the variance expected homozygosity.

Only meaningful if ‘canGenerateExpectedStats()’ returns true.

getNormDevHomozygosity()#

Gets normalized deviate of homozygosity.

Only meaningful if ‘canGenerateExpectedStats()’ returns true.

serializeHomozygosityTo(stream)#
class HomozygosityEWSlatkinExact(alleleData=None, numReplicates=10000, debug=0)#

Bases: Homozygosity

Inheritance diagram of PyPop.Homozygosity.HomozygosityEWSlatkinExact

Calculate homozygosity statistics.

Given allele count data for a given locus, calculates the observed homozygosity and returns the approximate expected homozygosity statistics taken from previous simulation runs.

Constructor for homozygosity statistics.

Given:

  • ‘alleleCountData’: tuple consisting of a dictionary of alleles with their associated counts and the total number of alleles.

  • ‘rootPath’: path to the root of the directory where the pre-calculated expected homozygosity statistics can be found.

  • ‘debug’: flag to switch debugging on.

doCalcs(alleleData)#
getHomozygosity()#
serializeHomozygosityTo(stream)#
returnBulkHomozygosityStats(alleleCountDict=None, binningMethod=None)#
class HomozygosityEWSlatkinExactPairwise(matrix=None, numReplicates=10000, untypedAllele='****', debug=0)#
serializeTo(stream)#