Add isless function for Variation

This commit is contained in:
Thomas A. Christensen II 2023-01-10 11:07:30 -06:00
parent 6119368af3
commit 0b2879b78c

View file

@ -75,6 +75,11 @@ BioGenerics.leftposition(v::Variation) = leftposition(_edit(v))
BioGenerics.rightposition(v::Variation) = rightposition(_edit(v)) BioGenerics.rightposition(v::Variation) = rightposition(_edit(v))
Base.:(==)(x::Variation, y::Variation) = x.ref == y.ref && x.edit == y.edit Base.:(==)(x::Variation, y::Variation) = x.ref == y.ref && x.edit == y.edit
Base.hash(x::Variation, h::UInt) = hash(Variation, hash((x.ref, x.edit), h)) Base.hash(x::Variation, h::UInt) = hash(Variation, hash((x.ref, x.edit), h))
function Base.isless(x::Variation, y::Variation)
reference(x) == reference(y) ||
error("Variations cannot be compared if their reference sequences aren't equal")
return leftposition(x) < leftposition(y)
end
""" """
_is_valid(v::Variation) _is_valid(v::Variation)