BioJulia/SequenceVariation.jl

Feature request: Add equality functions for `Variation`

MillironX opened this issue · 0 comments

Right now, one Variation cannot be compared to another correctly. I would consider a Variation to be the same as another if

  • The reference sequence of both are equal
  • The position of both are equal
  • The edit of both are equal

Example

Current behavior

using BioAlignments, BioSequences, SequenceVariation

refseq = dna"ACAACTTTATCT"
mutseq = dna"ACATCTTTATCT"

read01 = AlignedSequence(mutseq[1:10], Alignment("10M", 1, 1))
read02 = AlignedSequence(mutseq[3:12], Alignment("10M", 1, 3))

aln01 = PairwiseAlignment(read01, refseq)
aln02 = PairwiseAlignment(read02, refseq)

@show Variant(aln01)
@show Variant(aln02)

@show Variant(aln01) == Variant(aln02)

Current behavior

Output:

Variant(aln01) = Variant{LongDNASeq, DNA} with 1 edit:
  A4T
Variant(aln02) = Variant{LongDNASeq, DNA} with 1 edit:
  A4T
Variant(aln01) == Variant(aln02) = false

Desired behavior

Variant(aln01) = Variant{LongDNASeq, DNA} with 1 edit:
  A4T
Variant(aln02) = Variant{LongDNASeq, DNA} with 1 edit:
  A4T
Variant(aln01) == Variant(aln02) = true