ensembl.vep.matcher package#

Association matchers.

Submodules#

ensembl.vep.matcher.allele module#

Variant-allele association helpers.

ensembl.vep.matcher.allele.get_matched_variant_alleles(variation_alleles, query, *, match_reference=True, match_alternate=True)[source]#

Return alleles with matching coordinates and selected allele strings.

Parameters:
  • variation_alleles (Iterable[AlleleT]) – Candidate alleles to inspect.

  • query (AlleleLike) – Coordinate and allele values to match.

  • match_reference (bool, default: True) – Require equal reference strings.

  • match_alternate (bool, default: True) – Require equal alternate strings.

Returns:

Matching candidates in their supplied order.

Return type:

list[AlleleT]

ensembl.vep.matcher.base module#

Matcher contracts and policies.

class ensembl.vep.matcher.base.AlleleLike(*args, **kwargs)[source]#

Bases: IntervalLike, Protocol

Coordinates and allele strings used for colocation.

property alternate_allele: str | None#

Return the alternate allele string.

property reference_allele: str | None#

Return the reference allele string.

class ensembl.vep.matcher.base.InsertionMatchPolicy(*values)[source]#

Bases: str, Enum

Policy for associating an interbase insertion with a feature.

CONTAINED = 'contained'#
THREE_PRIME = 'three_prime'#
TOUCHING = 'touching'#
class ensembl.vep.matcher.base.IntervalLike(*args, **kwargs)[source]#

Bases: Protocol

Inclusive coordinates used for interval matching.

property end: int#

Return the inclusive end coordinate.

property start: int#

Return the inclusive start coordinate.

ensembl.vep.matcher.exact module#

Exact-coordinate association.

class ensembl.vep.matcher.exact.ExactCoordinateMatcher[source]#

Bases: object

Matcher for identical inclusive interval coordinates.

matches(left, right)[source]#

Return whether both coordinate pairs are identical.

Return type:

bool

ensembl.vep.matcher.overlap module#

General interval-overlap matching.

class ensembl.vep.matcher.overlap.OverlapMatcher(*, insertion_policy=InsertionMatchPolicy.CONTAINED)[source]#

Bases: object

Matcher for containing or partially intersecting intervals.

A normal interval uses inclusive base coordinates. An insertion is encoded as start=end+1 and remains a zero-width interbase location during matching.

Variables:

insertion_policy (InsertionMatchPolicy) – Rule for associating an insertion with a feature.

insertion_policy: InsertionMatchPolicy#
matches(left, right)[source]#

Return whether two inclusive intervals meet; an insertion is start == end + 1.

Return type:

bool

ensembl.vep.matcher.reciprocal module#

Reciprocal interval-overlap association.

class ensembl.vep.matcher.reciprocal.ReciprocalOverlapMatcher(*, left_minimum=0.5, right_minimum=0.5)[source]#

Bases: object

Matcher requiring both configured reference-span fractions.

Zero-width insertions never match reciprocally because their reference-span fraction is undefined. Use OverlapMatcher for point association or ExactCoordinateMatcher for identical insertion positions.

Variables:
  • left_minimum (float) – Minimum fraction of the left reference span covered.

  • right_minimum (float) – Minimum fraction of the right reference span covered.

left_minimum: float#
matches(left, right)[source]#

Return whether both intervals meet their configured overlap fraction.

Return type:

bool

right_minimum: float#