Skip to content

Commit

Permalink
goalign stats mutations list --aa does not report mutation when ref a…
Browse files Browse the repository at this point in the history
…nd seq have both only gaps
  • Loading branch information
fredericlemoine committed Jan 25, 2023
1 parent 9c558e8 commit 9ac1486
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion align/sequence.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,12 @@ func (s *seq) listMutationsComparedToReferenceSequenceAA(alphabet int, refseq Se
aaidx := 0
for refcodonidx[2] < s.Length() {
var refaa uint8
var allgaps bool = false

if refseqchar[refcodonidx[0]] == GAP && refseqchar[refcodonidx[1]] == GAP && refseqchar[refcodonidx[2]] == GAP {
refaa = '-'
aaidx--
allgaps = true
} else {
// We find the three reference positions without gap
for refcodonidx[2] < s.Length() && refseqchar[refcodonidx[0]] == GAP {
Expand Down Expand Up @@ -471,7 +474,9 @@ func (s *seq) listMutationsComparedToReferenceSequenceAA(alphabet int, refseq Se

// Deletion
if len(tmpseq) == 0 {
mutations = append(mutations, Mutation{Ref: refaa, Pos: aaidx, Alt: []uint8{'-'}})
if !allgaps {
mutations = append(mutations, Mutation{Ref: refaa, Pos: aaidx, Alt: []uint8{'-'}})
}
} else if len(tmpseq)%3 != 0 {
// Potential frameshift
mutations = append(mutations, Mutation{Ref: refaa, Pos: aaidx, Alt: []uint8{'/'}})
Expand Down

0 comments on commit 9ac1486

Please sign in to comment.