Variant#

class alphagenome.data.genome.Variant(chromosome, position, reference_bases, alternate_bases, name='', info=<factory>)[source]#

Represents a genomic variant/mutation.

Differs from the Variant definition in a VCF file, which allows for multiple alternative bases and contains sample information. This Variant class does not include sample information or variant call quality information.

chromosome#

The chromosome name (e.g., ‘chr1’, ‘1’).

position#

The 1-based position of the variant on the chromosome.

reference_bases#

The reference base(s) at the variant position. Most frequently (not always!), these correspond to the sequence in the reference genome at positions: [position, …, position + len(reference_bases) - 1]

alternate_bases#

The alternate base(s) that replace the reference. For example, if sequence=’ACT’, position=2, reference_bases=’C’, alternate_bases=’TG’, then the actual (alternate) sequence would be ATGT.

name#

An optional name for the variant (e.g., a dbSNP ID like rs206437).

info#

An optional dictionary for additional variant information.

start#

The 0-based start position of the variant (position - 1).

end#

The 0-based end position (start + len(reference_bases)).

reference_interval#

Reference genomic Interval spanned by the variant.

is_snv#

True if single-nucleotide variant (len == 1 for ref and alt).

is_deletion#

True if deletion (len(reference_bases) > len(alternate_bases)).

is_insertion#

True if insertion (len(reference_bases) < len(alternate_bases)).

is_frameshift#

True if indel length is not a multiple of 3.

is_indel#

True if insertion or deletion.

is_structural#

True if indel length is at least 50 bp.

Methods

alternate_overlaps(interval)

Checks if the variant's alternate overlaps with the interval.

as_truncated_str([max_length])

Truncates the variant str's ref and alt bases to the given max length.

copy()

Returns a deep copy of the variant.

from_dict(dictionary)

Creates a Variant from a dictionary.

from_str(string[, variant_format])

Creates a Variant from a string representation.

reference_overlaps(interval)

Checks if the variant's reference overlaps with the interval.

split(anchor)

Splits the variant into two at the anchor point.

to_dict()

Converts the variant to a dictionary.