anyvar.mapping.liftover
Defines functions used to lift over variants between GRCh37 & GRCh38
- exception anyvar.mapping.liftover.AccessionConversionError[source]
Indicates a failure to convert a variant’s refget accession
- exception anyvar.mapping.liftover.AmbiguousCoordinateConversionError[source]
Indicates AnyVar cannot lift over a variant because its start and/or end coordinates mapped to multiple possible locations
- exception anyvar.mapping.liftover.CoordinateConversionFailureError[source]
Indicates a failure to lift over a variant’s coordinate
- exception anyvar.mapping.liftover.LiftoverError[source]
Indicates a failure to liftover a variant between GRCh37 & GRCh38
- exception anyvar.mapping.liftover.RoundtripError[source]
Indicates failure to roundtrip a liftover between 37 and 38, suggesting ambiguous or unreliable liftover
- exception anyvar.mapping.liftover.UnsupportedReferenceAssemblyError[source]
Indicates a failure to retrieve alias data for a refget accession in any supported reference assembly.
- exception anyvar.mapping.liftover.UnsupportedVariantLocationTypeError[source]
Indicates a variant with a ‘location’ type that is unsupported
- anyvar.mapping.liftover.convert_position(converter, chromosome, position)[source]
Convert a SequenceLocation position (i.e., start or end) to another reference Genome. position can either be a models.Range or an int - return type will match.
- Parameters:
converter (
Converter) – An AGCT Converter instance.chromosome (
str) – The chromosome number where the position is found. Must be a string consisting of a) the prefix “chr”, and b) a number OR “X” or “Y” -> e.g. “chr10”, “chrX”, etc.position (
TypeVar(_PositionType,int,Range)) – A SequenceLocation start or end position. Can be a models.Range or an int.
- Return type:
TypeVar(_PositionType,int,Range)- Returns:
A lifted-over position. Type (models.Range or int) will match that of position
- anyvar.mapping.liftover.liftover_and_register_variant(variation, storage, dataproxy)[source]
Perform liftover between GRCh37 <-> GRCh38. Store mappings between the original and lifted-over variants.
Don’t register lifted-over variant or mappings if * liftover fails in either direction * liftover is ambiguous in either direction * liftover fails to roundtrip accurately
This function is intended to be quite directly ‘user-facing’, i.e. it catches and suppresses major error cases and communicates results as they are to be transmitted in the REST API routes. Library users hoping for more direct control will want to employ
get_liftover_variantto perform liftover and make their own decisions about when to register objects and mappings.- Parameters:
variation (
Allele) – variation to attempt liftover uponstorage (
Storage) – Storage instancedataproxy (
_DataProxy) – SeqRepo DataProxy instance, for normalizing lifted-over alleles
- Return type:
Allele- Returns:
lifted-over variant
- Raises:
RoundtripError – if liftover fails to roundtrip back to original variant
- anyvar.mapping.liftover.liftover_variant(input_variant)[source]
Liftover a variant from GRCh37 or GRCH38 into the opposite assembly, and return the converted variant as a VrsVariation.
If liftover is unsuccessful, raise an Exception.
- Parameters:
input_variant (
Allele) – A VrsVariation.- Return type:
Allele- Returns:
The converted variant as a VrsVariation.
- Raises:
UnsupportedVariantLocationTypeError – If the variant lacks a refget accession, start position or end position
UnsupportedReferenceAssemblyError – If the variant’s accession was not found in any supported assembly
CoordinateConversionFailureError – If unable to lift over the variant’s start and/or end position(s)
AmbiguousCoordinateConversionError – If variant’s start and/or end position(s) map to multiple possible locations
AccessionConversionError – If unable to lift over the variant’s refget accession