Skip to content

Commit

Permalink
Update seqtk.c
Browse files Browse the repository at this point in the history
fixed bugs regarding trimfq
  • Loading branch information
ndaniel committed Oct 3, 2014
1 parent 9063c2a commit f07d0c9
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions seqtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,17 +315,29 @@ int stk_trimfq(int argc, char *argv[])
beg = left; end = left + left_keep;
if (seq->seq.l < end) end = seq->seq.l;
if (seq->seq.l < beg) beg = seq->seq.l;
if (end - beg < min_len) { beg = 0; end = min_len; }
if (end - beg < min_len) {
beg = 0;
end = min_len;
if (end > seq->seq.l) end = seq->seq.l;
}
} else if (right_keep) {
beg = seq->seq.l - right_keep - right; end = seq->seq.l - right;
if (beg < 0) beg = 0;
if (end < 0) end = 0;
if (end - beg < min_len) { beg = 0; end = min_len; }
if (end - beg < min_len) {
beg = 0;
end = min_len;
if (end > seq->seq.l) end = seq->seq.l;
}
} else if (left || right) {
beg = left; end = seq->seq.l - right;
if (end < 0) end = 0;
if (seq->seq.l < beg) beg = seq->seq.l;
if (end - beg < min_len) { beg = 0; end = min_len; }
if (end - beg < min_len) {
beg = 0;
end = min_len;
if (end > seq->seq.l) end = seq->seq.l;
}
} else if (seq->qual.l > min_len && param != 0.) {
for (i = 0, beg = tmp = 0, end = seq->qual.l, s = max = 0.; i < seq->qual.l; ++i) {
int q = seq->qual.s[i];
Expand Down

0 comments on commit f07d0c9

Please sign in to comment.