Skip to content

Commit

Permalink
count_aligned(): optimize with agnpos
Browse files Browse the repository at this point in the history
  • Loading branch information
alyst committed Oct 3, 2020
1 parent 93bc63b commit 5ffb114
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/pairwise/alignment.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,7 @@ Count the number of aligned positions.
"""
function count_aligned(aln::PairwiseAlignment)
anchors = aln.a.aln.anchors
n = 0
for i in 2:lastindex(anchors)
op = anchors[i].op
if ismatchop(op) || isinsertop(op)
n += anchors[i].seqpos - anchors[i-1].seqpos
elseif isdeleteop(op)
n += anchors[i].refpos - anchors[i-1].refpos
end
end
return n
return isempty(anchors) ? 0 : last(anchors).agnpos
end

seq2ref(aln::PairwiseAlignment, i::Integer) = seq2ref(aln.a, i)
Expand Down

0 comments on commit 5ffb114

Please sign in to comment.