TASSELpy.net.maizegenetics.analysis.distance package

Submodules

TASSELpy.net.maizegenetics.analysis.distance.IBSDistanceMatrix module

class TASSELpy.net.maizegenetics.analysis.distance.IBSDistanceMatrix.IBSDistanceMatrix(*args, **kwargs)[source]

Bases: TASSELpy.net.maizegenetics.taxa.distance.DistanceMatrix.DistanceMatrix

This class calculates an identity by state matrix. It is scaled so only non-missing comparison are used. It conducts bit level calculations of IBS for genotypes. Only the two most common alleles are used in the distance calculations.

Please note that when heterozygous genotypes are used, Het to Het distance is 0.5 NOT 0.0. The default along the identity diagonal is 0 (isTrueIBS = false), but changing isTrueIBS = true will calculate the identity.

The distance estimates become wildly inaccurate when too few sites are used to calculate distance. The minSiteComp parameter can be used to control the minimum number of sites used for a calculation. If there are insufficient sites in the estimate, then Double.NaN is returned.

Methods

absoluteDistance(*args) Compute absolute distance to second distance matrix
castTo(pyType) Casts this object to another java/python type
clone(*args) Creates and returns a copy of this object
computeHetBitDistances(*args) Compute distance for a pair of taxa
equals(*args) Indicates whether some other object is “equal to” this one
getArray(size) Gets an empty wrapped java array that can accept the type of the wrapped
getAverageTotalSites(*args) Gets average number of sites used in calculating the distance matrix
getClass(*args) Returns the runtime class of this Object.
getClonedDistances(*args) Returns the distances as a 2-dimensional array of doubles.
getClosestIndex(*args) Gets the index of the taxon closest to a given taxon
getColumnCount(*args) Gets the number of columns
getColumnName(*args) Gets a column name
getDblArray(rows[, cols]) Gets an empty wrapped java array that can accept the type of other wrapped java arrays: i.e.
getDistance(*args) Returns the distance calculated for two taxa with the indices
getDistances(*args) Returns the distances as a 2-dimensional array of doubles (in the actual array used
getElementCount(*args) Gets the total number of elements in the dataset
getRow(*args) Returns specified row
getRowCount(*args) Gets the number of rows
getSize(*args) Returns the number of rows and columns that the distance matrix has
getTableColumnNames(*args) Gets the names of the columns
getTableTitle(*args) Gets the title of the table
getTaxaList(*args) Return TaxaList of this matrix
getTaxon(*args) Gets a Taxon
getValueAt(*args) Returns value at given row and column
hashCode(*args) Returns a hash code vlaue for the object
isSymmetric(*args) Test whether this matrix is a symmetrix distance matrix
isTrueIBS(*args) Returns whether true IBS is calculated for the diagonal
meanDistance(*args) Returns the mean pairwise distnace of this matrix
numberOfTaxa(*args) Gets the number of taxa
squaredDistance(*args) Compute squared distance to second distance matrix
toDict() Outputs the table as a dictionary
toString(*args) Gets string representation of this matrix with ‘d’ displayed digits
whichIdNumber(*args) Gets the id number of a taxon
wrap_existing_array(arr_instance) Wraps a java array of this class’s type
__init__(*args, **kwargs)[source]

Compute observed distances for all taxa. Missing sites are ignored

Signature:

IBSDistanceMatrix (GenotypeTable theAlignment)

Signature:

IBSDistanceMatrix (GenotypeTable theAlignment, ProgressListener listener)

Signature:

IBSDistanceMatrix (GenotypeTable theAlignment, int minSiteComp, ProgressListener listener)

Signature:

IBSDistanceMatrix (GenotypeTable theAlignment, int minSiteComp, boolean trueIBS, ProgressListener listener)

Parameters:
  • theAlignment (GenotypeTable) – Alignment used to compute distances
  • listener (ProgressListener) – Listener to track progress in calculations
  • minSiteComp (int) – Minimum number of sites needed to estimate distance
  • trueIBS (boolean) – Estimate diagonal distance based IBS (default = false, i=i=0.0)
static computeHetBitDistances(*args)[source]

Compute distance for a pair of taxa

Signature:

computeHetBitDistances (GenotypeTable theTBA, int taxon1, int taxon2)

Signature:

computeHetBitDistances (GenotypeTable theTBA, int taxon1, int taxon2, int minSitesCompared, boolean isTrueIBS)

Signature:

computeHetBitDistances (GenotypeTable theTBA, int taxon1, int taxon2, int minSitesCompared, int firstWord, int lastWord, BitSet maskBadSet)

Signature:

computeHetBitDistances (long[] iMj, long[] iMn, long[] jMj, long[] jMn, int minSitesCompared)

Signature:

computeHetBitDistances (long[] iMj, long[] iMn, long[] jMj, long[] jMn, int minSitesCompared, int firstWord, int lastWord)

Parameters:
  • theTBA (GenotypeTable) – input alignment
  • taxon1 (int) – index of taxon 1
  • taxon2 (int) – index of taxon 2
  • minSitesCompared (int) – Minimum number of sites needed to estimate distance
  • isTrueIBS (boolean) – estimate diagonal distance based IBS (default = False, i=i=0.0)
  • firstWord (int) – Starting word for calculating distance site=(firstWord*64)
  • lastWord (int) – Ending word for calculating distance inclusive site=(lastWord*64+63)
  • maskBadSet (BitSet) – Optional mask for sites (those set to 1 are kept)
  • iMj (long[]) – Vector of major alleles for taxon i
  • iMn (long[]) – Vector of minor alleles for taxon i
  • jMj (long[]) – Vector of major alleles for taxon j
  • jMn (long[]) – Vector of minor alleles for taxon j
Returns:

Array of {distance, number of sites used in comparison}

Return type:

double[]

getAverageTotalSites(*args)[source]

Gets average number of sites used in calculating the distance matrix

Signature:getAverageTotalSits ()
Returns:Average number of sites used in calculating the distance matrix
Return type:double
isTrueIBS(*args)[source]

Returns whether true IBS is calculated for the diagonal

Signature:IsTrueIBS ()
Returns:Whether true IBS is calculated for the diagonal
Return type:boolean
toString(*args)[source]

Gets string representation of this matrix with ‘d’ displayed digits

Signature:toString ()
Signature:toString (int d)
Parameters:d (int) – The number of digits to display
Returns:String representation of this matrix
Return type:String

TASSELpy.net.maizegenetics.analysis.distance.Kinship module

class TASSELpy.net.maizegenetics.analysis.distance.Kinship.Kinship(*args, **kwargs)[source]

Bases: TASSELpy.net.maizegenetics.taxa.distance.DistanceMatrix.DistanceMatrix

Kinship tools by Zhiwu Zhang

Methods

absoluteDistance(*args) Compute absolute distance to second distance matrix
castTo(pyType) Casts this object to another java/python type
clone(*args) Creates and returns a copy of this object
equals(*args) Indicates whether some other object is “equal to” this one
getArray(size) Gets an empty wrapped java array that can accept the type of the wrapped
getClass(*args) Returns the runtime class of this Object.
getClonedDistances(*args) Returns the distances as a 2-dimensional array of doubles.
getClosestIndex(*args) Gets the index of the taxon closest to a given taxon
getColumnCount(*args) Gets the number of columns
getColumnName(*args) Gets a column name
getDblArray(rows[, cols]) Gets an empty wrapped java array that can accept the type of other wrapped java arrays: i.e.
getDistance(*args) Returns the distance calculated for two taxa with the indices
getDistances(*args) Returns the distances as a 2-dimensional array of doubles (in the actual array used
getDm(*args) Gets the DistanceMatrix containing the Kinship values
getElementCount(*args) Gets the total number of elements in the dataset
getRow(*args) Returns specified row
getRowCount(*args) Gets the number of rows
getSize(*args) Returns the number of rows and columns that the distance matrix has
getTableColumnNames(*args) Gets the names of the columns
getTableTitle(*args) Gets the title of the table
getTaxaList(*args) Return TaxaList of this matrix
getTaxon(*args) Gets a Taxon
getValueAt(*args) Returns value at given row and column
hashCode(*args) Returns a hash code vlaue for the object
isSymmetric(*args) Test whether this matrix is a symmetrix distance matrix
meanDistance(*args) Returns the mean pairwise distnace of this matrix
numberOfTaxa(*args) Gets the number of taxa
squaredDistance(*args) Compute squared distance to second distance matrix
toDict() Outputs the table as a dictionary
toString(*args) Get string representation of alignment as a string
whichIdNumber(*args) Gets the id number of a taxon
wrap_existing_array(arr_instance) Wraps a java array of this class’s type
__init__(*args, **kwargs)[source]

Creates a kinship matrix

Signature:

Kinship (GenotypeTable mar)

Signature:

Kinship (SimplePhenotype ped)

Signature:

Kinship (DistanceMatrix dm)

Parameters:
  • mar (GenotypeTable) – A GenotypeTable used to calculated Kinship
  • ped (SimplePhenotype) – A SimplePhenotype table for calculating from Phenotype
  • dm (DistanceMatrix) – A DistanceMatrix instance
getDm(*args)[source]

Gets the DistanceMatrix containing the Kinship values

Signature:getDm ()
Returns:DistanceMatrix containing kinship values
Return type:DistanceMatrix

Module contents