Call

class hail.representation.Call(call)[source]

An object that represents an individual’s call at a genomic locus.

Parameters:call (int or None) – Genotype hard call

Attributes

gt Returns the hard call.

Methods

__init__ Initialize a Call object.
is_called True if the call is non-missing.
is_called_non_ref True if the call contains any non-reference alleles.
is_het True if the call contains two different alleles.
is_het_non_ref True if the call contains two different alternate alleles.
is_het_ref True if the call contains one reference and one alternate allele.
is_hom_ref True if the call is 0/0
is_hom_var True if the call contains two identical alternate alleles.
is_not_called True if the call is missing.
num_alt_alleles Returns the count of non-reference alleles.
one_hot_alleles Returns a list containing the one-hot encoded representation of the called alleles.
one_hot_genotype Returns a list containing the one-hot encoded representation of the genotype call.
gt

Returns the hard call.

Return type:int or None
is_called()[source]

True if the call is non-missing.

Return type:bool
is_called_non_ref()[source]

True if the call contains any non-reference alleles.

Return type:bool
is_het()[source]

True if the call contains two different alleles.

Return type:bool
is_het_non_ref()[source]

True if the call contains two different alternate alleles.

Return type:bool
is_het_ref()[source]

True if the call contains one reference and one alternate allele.

Return type:bool
is_hom_ref()[source]

True if the call is 0/0

Return type:bool
is_hom_var()[source]

True if the call contains two identical alternate alleles.

Return type:bool
is_not_called()[source]

True if the call is missing.

Return type:bool
num_alt_alleles()[source]

Returns the count of non-reference alleles.

This function returns None if the genotype call is missing.

Return type:int or None
one_hot_alleles(num_alleles)[source]

Returns a list containing the one-hot encoded representation of the called alleles.

This one-hot representation is the positional sum of the one-hot encoding for each called allele. For a biallelic variant, the one-hot encoding for a reference allele is [1, 0] and the one-hot encoding for an alternate allele is [0, 1]. Thus, with the following variables:

num_alleles = 2
hom_ref = Call(0)
het = Call(1)
hom_var = Call(2)

All the below statements are true:

hom_ref.one_hot_alleles(num_alleles) == [2, 0]
het.one_hot_alleles(num_alleles) == [1, 1]
hom_var.one_hot_alleles(num_alleles) == [0, 2]

This function returns None if the call is missing.

Parameters:num_alleles (int) – number of possible alternate alleles
Return type:list of int or None
one_hot_genotype(num_genotypes)[source]

Returns a list containing the one-hot encoded representation of the genotype call.

A one-hot encoding is a vector with one ‘1’ and many ‘0’ values, like [0, 0, 1, 0] or [1, 0, 0, 0]. This function is useful for transforming the genotype call (gt) into a one-hot encoded array. With the following variables:

num_genotypes = 3
hom_ref = Call(0)
het = Call(1)
hom_var = Call(2)

All the below statements are true:

hom_ref.one_hot_genotype(num_genotypes) == [1, 0, 0]
het.one_hot_genotype(num_genotypes) == [0, 1, 0]
hom_var.one_hot_genotype(num_genotypes) == [0, 0, 1]

This function returns None if the call is missing.

Parameters:num_genotypes (int) – number of possible genotypes
Return type:list of int or None