* valgrind identifies a use of uninitialised value, but I have not fixed it.
kputc('\t', &str);
}
if (c->tid < 0) kputsn("*\t", 2, &str);
kputc('\t', &str);
}
if (c->tid < 0) kputsn("*\t", 2, &str);
- else { kputs(header->target_name[c->tid], &str); kputc('\t', &str); }
+ else {
+ if (header) kputs(header->target_name[c->tid] , &str);
+ else kputw(c->tid, &str);
+ kputc('\t', &str);
+ }
kputw(c->pos + 1, &str); kputc('\t', &str); kputw(c->qual, &str); kputc('\t', &str);
if (c->n_cigar == 0) kputc('*', &str);
else {
kputw(c->pos + 1, &str); kputc('\t', &str); kputw(c->qual, &str); kputc('\t', &str);
if (c->n_cigar == 0) kputc('*', &str);
else {
kputc('\t', &str);
if (c->mtid < 0) kputsn("*\t", 2, &str);
else if (c->mtid == c->tid) kputsn("=\t", 2, &str);
kputc('\t', &str);
if (c->mtid < 0) kputsn("*\t", 2, &str);
else if (c->mtid == c->tid) kputsn("=\t", 2, &str);
- else { kputs(header->target_name[c->mtid], &str); kputc('\t', &str); }
+ else {
+ if (header) kputs(header->target_name[c->mtid], &str);
+ else kputw(c->mtid, &str);
+ kputc('\t', &str);
+ }
kputw(c->mpos + 1, &str); kputc('\t', &str); kputw(c->isize, &str); kputc('\t', &str);
if (c->l_qseq) {
for (i = 0; i < c->l_qseq; ++i) kputc(bam_nt16_rev_table[bam1_seqi(s, i)], &str);
kputw(c->mpos + 1, &str); kputc('\t', &str); kputw(c->isize, &str); kputc('\t', &str);
if (c->l_qseq) {
for (i = 0; i < c->l_qseq; ++i) kputc(bam_nt16_rev_table[bam1_seqi(s, i)], &str);
} else if (op == BAM_CSOFT_CLIP) y += ol;
else if (op == BAM_CREF_SKIP) x += ol;
}
} else if (op == BAM_CSOFT_CLIP) y += ol;
else if (op == BAM_CREF_SKIP) x += ol;
}
- if (score < 0) return -1; // no high scoring segments
+ if (q[1] < 0) return -1; // no high scoring segments
endx = x - 1;
// find the left boundary
for (k = c->n_cigar - 1, score = max = 0, x = x-1, y = y-1; k >= 0; --k) {
endx = x - 1;
// find the left boundary
for (k = c->n_cigar - 1, score = max = 0, x = x-1, y = y-1; k >= 0; --k) {
} else if (op == BAM_CSOFT_CLIP) y -= ol;
else if (op == BAM_CREF_SKIP) x -= ol;
}
} else if (op == BAM_CSOFT_CLIP) y -= ol;
else if (op == BAM_CREF_SKIP) x -= ol;
}
- if (q[1] - q[0] < 15) return -1; // the high-scoring segment is too short
+ if (q[0] < 0 || q[1] - q[0] < 15) return -1; // the high-scoring segment is too short
// modify CIGAR
n_cigar = 0;
cigar = calloc(c->n_cigar + 4, 4);
// modify CIGAR
n_cigar = 0;
cigar = calloc(c->n_cigar + 4, 4);
if (new_min == (uint64_t)-1) return 0;
*_tid = new_min>>32; *_pos = (uint32_t)new_min;
for (i = 0; i < iter->n; ++i) {
if (new_min == (uint64_t)-1) return 0;
*_tid = new_min>>32; *_pos = (uint32_t)new_min;
for (i = 0; i < iter->n; ++i) {
- if (iter->pos[i] == iter->min) {
+ if (iter->pos[i] == iter->min) { // FIXME: valgrind reports "uninitialised value(s) at this line"
n_plp[i] = iter->n_plp[i], plp[i] = iter->plp[i];
++ret;
} else n_plp[i] = 0, plp[i] = 0;
n_plp[i] = iter->n_plp[i], plp[i] = iter->plp[i];
++ret;
} else n_plp[i] = 0, plp[i] = 0;