I’ve somehow created an iterator function where calling
collect on the
Alignment struct returns a 5-element vector, while iterating produces only three elements.
Context: I’m working on a patch for BioAlignments (GitHub - MillironX/BioAlignments.jl at operations-fix), where I modified the
Base.iterate function, but I don’t know how to debug this since stepping into the iterator doesn’t causes the input to become correct again. Does anyone know how this could happen?
using BioAlignments anchors = [ AlignmentAnchor(0, 0, 0, OP_START), AlignmentAnchor(2, 2, 2, OP_SEQ_MATCH), AlignmentAnchor(2, 2, 3, OP_PAD), AlignmentAnchor(3, 3, 4, OP_SEQ_MATCH), AlignmentAnchor(3, 3, 5, OP_HARD_CLIP), ] seq = AlignedSequence("ACG", anchors) ref = "ACG" aln = PairwiseAlignment(seq, ref) @show collect(aln) for (k, (i,j)) in enumerate(aln) @show k @show i @show j println(' ') end
collect(aln) = [('A', 'A'), ('C', 'C'), ('G', 'G'), ('\0', '\0'), ('\0', '\0')] k = 1 i = 'A' j = 'A' k = 2 i = 'C' j = 'C' k = 3 i = 'G' j = 'G'