Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add break condition to making cigar string #362

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ksw.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,11 @@ int ksw_global2(int qlen, const uint8_t *query, int tlen, const uint8_t *target,
uint32_t *cigar = 0, tmp;
i = tlen - 1; k = (i + w + 1 < qlen? i + w + 1 : qlen) - 1; // (i,k) points to the last cell
while (i >= 0 && k >= 0) {
which = z[(long)i * n_col + (k - (i > w? i - w : 0))] >> (which<<1) & 3;
int j_beg = i > w? i - w : 0;
int j_end = i + w + 1 < qlen? i + w + 1 : qlen;
j = (k - j_beg);
if (j >= (j_end-j_beg)) break;
which = z[(long)i * n_col + j] >> (which<<1) & 3;
if (which == 0) cigar = push_cigar(&n_cigar, &m_cigar, cigar, 0, 1), --i, --k;
else if (which == 1) cigar = push_cigar(&n_cigar, &m_cigar, cigar, 2, 1), --i;
else cigar = push_cigar(&n_cigar, &m_cigar, cigar, 1, 1), --k;
Expand Down