Skip to content

Commit 74ebfb2

Browse files
authored
fix error (#1223)
1 parent a0cbe2e commit 74ebfb2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

python/mappy.pyx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,12 @@ cdef class Aligner:
211211
c = h.cigar32[k]
212212
cigar.append([c>>4, c&0xf])
213213
if cs or MD: # generate the cs and/or the MD tag, if requested
214+
_cur_seq = _seq2 if h.seg_id > 0 and seq2 is not None else _seq
214215
if cs:
215-
l_cs_str = cmappy.mm_gen_cs(km, &cs_str, &m_cs_str, self._idx, &regs[i], _seq, 1)
216+
l_cs_str = cmappy.mm_gen_cs(km, &cs_str, &m_cs_str, self._idx, &regs[i], _cur_seq, 1)
216217
_cs = cs_str[:l_cs_str] if isinstance(cs_str, str) else cs_str[:l_cs_str].decode()
217218
if MD:
218-
l_cs_str = cmappy.mm_gen_MD(km, &cs_str, &m_cs_str, self._idx, &regs[i], _seq)
219+
l_cs_str = cmappy.mm_gen_MD(km, &cs_str, &m_cs_str, self._idx, &regs[i], _cur_seq)
219220
_MD = cs_str[:l_cs_str] if isinstance(cs_str, str) else cs_str[:l_cs_str].decode()
220221
yield Alignment(h.ctg, h.ctg_len, h.ctg_start, h.ctg_end, h.strand, h.qry_start, h.qry_end, h.mapq, cigar, h.is_primary, h.mlen, h.blen, h.NM, h.trans_strand, h.seg_id, _cs, _MD)
221222
cmappy.mm_free_reg1(&regs[i])

0 commit comments

Comments
 (0)