Skip to content

Commit

Permalink
r244: fixed extra aa and a potential memory bug
Browse files Browse the repository at this point in the history
Resolves #47
  • Loading branch information
lh3 committed Mar 6, 2024
1 parent 61a352f commit af102cf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion format.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ static void mp_write_residue(kstring_t *out, const mp_idx_t *mi, const mp_mapopt
}
}
assert(nl == r->ve - r->vs);
if (l_nt == r->ve - r->vs + 3) { // then print one more codon
if (l_nt == r->ve - r->vs + 3 && str[4][w4-1] != '*') { // then print one more codon
uint8_t n1 = nt[nl], n2 = nt[nl + 1], n3 = nt[nl + 2], nt_aa, codon;
codon = n1<<4 | n2<<2 | n3;
nt_aa = n1 > 3 || n2 > 3 || n3 > 3? ns_tab_aa20['X'] : ns_tab_codon[codon];
Expand Down
2 changes: 1 addition & 1 deletion miniprot.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <stdint.h>

#define MP_VERSION "0.12-r243-dirty"
#define MP_VERSION "0.12-r244-dirty"

#define MP_F_NO_SPLICE 0x1
#define MP_F_NO_ALIGN 0x2
Expand Down
2 changes: 2 additions & 0 deletions ntseq.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ int64_t mp_ntseq_get(const mp_ntdb_t *db, int32_t cid, int64_t st, int64_t en, i
int64_t mp_ntseq_get_by_v(const mp_ntdb_t *nt, int32_t vid, int64_t st, int64_t en, uint8_t *seq)
{
int64_t ctg_len = nt->ctg[vid>>1].len;
if (st < 0 || en < 0 || st >= ctg_len) return -1;
en = en <= ctg_len? en : ctg_len;
return mp_ntseq_get(nt, vid>>1, vid&1? ctg_len - en : st, vid&1? ctg_len - st : en, vid&1, seq);
}

Expand Down

0 comments on commit af102cf

Please sign in to comment.