Variant¶
-
class
hail.representation.
Variant
(contig, start, ref, alts)[source]¶ An object that represents a genomic polymorphism.
Parameters: - contig (str or int) – chromosome identifier
- start (int) – chromosomal position (1-based)
- ref (str) – reference allele
- alts (str or list of str) – single alternate allele, or list of alternate alleles
Attributes
alt_alleles
List of alternate allele objects in this polymorphism. contig
Chromosome identifier. ref
Reference allele at this locus. start
Chromosomal position (1-based). Methods
__init__
x.__init__(…) initializes x; see help(type(x)) for signature allele
Returns the string allele representation for the ith allele. alt
Returns the alternate allele string, assumes biallelic. alt_allele
Returns the alternate allele object, assumes biallelic. in_X_PAR
True of this polymorphism is found on the pseudoautosomal region of chromosome X. in_X_non_PAR
True of this polymorphism is found on the non-pseudoautosomal region of chromosome X. in_Y_PAR
True of this polymorphism is found on the pseudoautosomal region of chromosome Y. in_Y_non_PAR
True of this polymorphism is found on the non-pseudoautosomal region of chromosome Y. is_autosomal
True if this polymorphism is located on an autosome. is_autosomal_or_pseudoautosomal
True if this polymorphism is found on an autosome, or the PAR on X or Y. is_biallelic
True if there is only one alternate allele in this polymorphism. is_mitochondrial
True if this polymorphism is mapped to mitochondrial DNA. locus
Returns the locus object for this polymorphism. num_alleles
Returns the number of total alleles in this polymorphism, including the reference. num_alt_alleles
Returns the number of alternate alleles in this polymorphism. num_genotypes
Returns the total number of unique genotypes possible for this variant. parse
Parses a variant object from a string. -
allele
(i)[source]¶ Returns the string allele representation for the ith allele.
The reference is included in the allele index. The index of the first alternate allele is 1. The following is true for all variants:
>>> v_multiallelic.ref == v_multiallelic.allele(0)
Additionally, the following is true for all biallelic variants:
>>> v_biallelic.alt == v_biallelic.allele(1)
Parameters: i (int) – integer index of desired allele Returns: string representation of ith allele Return type: str
-
alt
()[source]¶ Returns the alternate allele string, assumes biallelic.
Fails if called on a multiallelic variant.
Return type: str
-
alt_allele
()[source]¶ Returns the alternate allele object, assumes biallelic.
Fails if called on a multiallelic variant.
Return type: AltAllele
-
contig
¶ Chromosome identifier.
Return type: str
-
in_X_PAR
()[source]¶ True of this polymorphism is found on the pseudoautosomal region of chromosome X.
Return type: bool
-
in_X_non_PAR
()[source]¶ True of this polymorphism is found on the non-pseudoautosomal region of chromosome X.
Return type: bool
-
in_Y_PAR
()[source]¶ True of this polymorphism is found on the pseudoautosomal region of chromosome Y.
Return type: bool
-
in_Y_non_PAR
()[source]¶ True of this polymorphism is found on the non-pseudoautosomal region of chromosome Y.
Return type: bool
-
is_autosomal_or_pseudoautosomal
()[source]¶ True if this polymorphism is found on an autosome, or the PAR on X or Y.
Return type: bool
-
is_biallelic
()[source]¶ True if there is only one alternate allele in this polymorphism.
Return type: bool
-
is_mitochondrial
()[source]¶ True if this polymorphism is mapped to mitochondrial DNA.
Return type: bool
-
num_alleles
()[source]¶ Returns the number of total alleles in this polymorphism, including the reference.
Return type: int
-
num_alt_alleles
()[source]¶ Returns the number of alternate alleles in this polymorphism.
Return type: int
-
num_genotypes
()[source]¶ Returns the total number of unique genotypes possible for this variant.
For a biallelic variant, this value is 3: 0/0, 0/1, and 1/1.
For a triallelic variant, this value is 6: 0/0, 0/1, 1/1, 0/2, 1/2, 2/2.
For a variant with N alleles, this value is:
\[\frac{N * (N + 1)}{2}\]Return type: int
-
static
parse
(string)[source]¶ Parses a variant object from a string.
There are two acceptable formats: CHR:POS:REF:ALT, and CHR:POS:REF:ALT1,ALT2,…ALTN. Below is an example of each:
>>> v_biallelic = Variant.parse('16:20012:A:TT') >>> v_multiallelic = Variant.parse('16:12311:T:C,TTT,A')
Return type: Variant
-
ref
¶ Reference allele at this locus.
Return type: str
-
start
¶ Chromosomal position (1-based).
Return type: int