Pedigrees (families and crosses)¶
Utilities for working with related individuals (crosses, families, etc.).
See also the examples at:
-
anhima.ped.
diploid_inheritance
(parent_diplotype, gamete_haplotypes)[source]¶ Determine the transmission of parental alleles to a set of gametes.
Parameters: parent_diplotype : array_like, shape (n_variants, 2)
An array of phased genotypes for a single diploid individual, where each element of the array is an integer corresponding to an allele index (-1 = missing, 0 = reference allele, 1 = first alternate allele, 2 = second alternate allele, etc.).
gamete_haplotypes : array_like, shape (n_variants, n_gametes)
An array of haplotypes for a set of gametes derived from the given parent, where each element of the array is an integer corresponding to an allele index (-1 = missing, 0 = reference allele, 1 = first alternate allele, 2 = second alternate allele, etc.).
Returns: inheritance : ndarray, uint8, shape (n_variants, n_gametes)
An array of integers coding the allelic inheritance, where 1 = inheritance from first parental haplotype, 2 = inheritance from second parental haplotype, 3 = inheritance of reference allele from parent that is homozygous for the reference allele, 4 = inheritance of alternate allele from parent that is homozygous for the alternate allele, 5 = non-parental allele, 6 = parental genotype is missing, 7 = gamete allele is missing.
-
anhima.ped.
diploid_mendelian_error
(parental_genotypes, progeny_genotypes)[source]¶ Find impossible genotypes according to Mendelian inheritance laws.
Parameters: parental_genotypes : array_like, int
An array of shape (n_variants, 2, 2) where each element of the array is an integer corresponding to an allele index (-1 = missing, 0 = reference allele, 1 = first alternate allele, 2 = second alternate allele, etc.).
progeny_genotypes : array_like, int
An array of shape (n_variants, n_progeny, 2) where each element of the array is an integer corresponding to an allele index (-1 = missing, 0 = reference allele, 1 = first alternate allele, 2 = second alternate allele, etc.).
Returns: errors : ndarray, uint8
An array of shape (n_variants, n_progeny) where each element counts the number of non-Mendelian alleles in a progeny genotype call.
See also
Notes
Not applicable to polyploid genotype calls.
Applicable to multiallelic variants.
Assumes that genotypes are unphased.
-
anhima.ped.
count_diploid_mendelian_error
(parental_genotypes, progeny_genotypes, axis=None)[source]¶ Count impossible genotypes according to Mendelian inheritance laws, summed over all progeny genotypes, or summed along variants or samples.
Parameters: parental_genotypes : array_like, int
An array of shape (n_variants, 2, 2) where each element of the array is an integer corresponding to an allele index (-1 = missing, 0 = reference allele, 1 = first alternate allele, 2 = second alternate allele, etc.).
progeny_genotypes : array_like, int
An array of shape (n_variants, n_progeny, 2) where each element of the array is an integer corresponding to an allele index (-1 = missing, 0 = reference allele, 1 = first alternate allele, 2 = second alternate allele, etc.).
axis : int, optional
The axis along which to count (0 = variants, 1 = samples).
Returns: n : int or array
If axis is None, returns the total number of Mendelian errors. If axis is specified, returns the sum along the given axis.
See also
-
anhima.ped.
impute_inheritance_nearest
(inheritance, pos, pos_impute)[source]¶ Impute inheritance at unknown positions, by copying from nearest neighbouring position where inheritance is known.
Parameters: inheritance : array_like, int, shape (n_variants, n_gametes)
An array of integers coding the allelic inheritance state at the known positions.
pos : array_like, int, shape (n_variants,)
Array of genomic positions at which inheritance was determined.
pos_impute : array_like, int
Array of positions at which to impute inheritance.
Returns: imputed_inheritance : ndarray, int
An array of integers coding the imputed allelic inheritance.
-
anhima.ped.
tabulate_inheritance_switches
(inheritance, pos, gametes=None)[source]¶ Tabulate switches in inheritance.
Parameters: inheritance : array_like, int, shape (n_variants, n_gametes)
An array of integers coding the allelic inheritance state at the known positions.
pos : array_like, int, shape (n_variants,)
Array of genomic positions at which inheritance was determined.
gametes : sequence, length (n_gametes), optional
Returns: df : DataFrame
A table of all inheritance switches observed in the gametes, where each row corresponds to a switch from one parental allele to another. The table has a hierarchical index, where the first level corresponds to the gamete.
See also
-
anhima.ped.
tabulate_inheritance_blocks
(inheritance, pos, gametes=None)[source]¶ Tabulate inheritance blocks.
Parameters: inheritance : array_like, int, shape (n_variants, n_gametes)
An array of integers coding the allelic inheritance state at the known positions.
pos : array_like, int, shape (n_variants,)
Array of genomic positions at which inheritance was determined.
gametes : sequence, length (n_gametes), optional
Returns: df : DataFrame
A table of all inheritance blocks observed in the gametes, where each row corresponds to a block of inheritance from a single parent. The table has a hierarchical index, where the first level corresponds to the gamete.
See also
-
anhima.ped.
inheritance_block_masks
(inheritance, pos)[source]¶ Construct arrays suitable for masking the original inheritance array using the attributes of the inheritance blocks.
Parameters: inheritance : array_like, int, shape (n_variants, n_gametes)
An array of integers coding the allelic inheritance state at the known positions.
pos : array_like, int, shape (n_variants,)
Array of genomic positions at which inheritance was determined.
Returns: block_support : ndarray, int, shape (n_variants, n_gametes)
An array where each item has the number of variants supporting the containing inheritance block.
block_length_min : ndarray, int, shape (n_variants, n_gametes)
An array where each item has the minimal length of the containing inheritance block.
See also