r337: mem - always read even number of reads
In the old code, we may read odd number of reads from an interleaved fastq.
This commit is contained in:
parent
72817b664e
commit
3e3236dfc4
2
bwa.c
2
bwa.c
|
|
@ -55,7 +55,7 @@ bseq1_t *bseq_read(int chunk_size, int *n_, void *ks1_, void *ks2_)
|
||||||
kseq2bseq1(ks2, &seqs[n]);
|
kseq2bseq1(ks2, &seqs[n]);
|
||||||
size += seqs[n++].l_seq;
|
size += seqs[n++].l_seq;
|
||||||
}
|
}
|
||||||
if (size >= chunk_size) break;
|
if (size >= chunk_size && (n&1) == 0) break;
|
||||||
}
|
}
|
||||||
if (size == 0) { // test if the 2nd file is finished
|
if (size == 0) { // test if the 2nd file is finished
|
||||||
if (ks2 && kseq_read(ks2) >= 0)
|
if (ks2 && kseq_read(ks2) >= 0)
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,11 @@ int main_mem(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
while ((seqs = bseq_read(opt->chunk_size * opt->n_threads, &n, ks, ks2)) != 0) {
|
while ((seqs = bseq_read(opt->chunk_size * opt->n_threads, &n, ks, ks2)) != 0) {
|
||||||
int64_t size = 0;
|
int64_t size = 0;
|
||||||
|
if ((opt->flag & MEM_F_PE) && (n&1) == 1) {
|
||||||
|
if (bwa_verbose >= 2)
|
||||||
|
fprintf(stderr, "[W::%s] odd number of reads in the PE mode; last read dropped\n", __func__);
|
||||||
|
n = n>>1<<1;
|
||||||
|
}
|
||||||
if (!copy_comment)
|
if (!copy_comment)
|
||||||
for (i = 0; i < n; ++i) {
|
for (i = 0; i < n; ++i) {
|
||||||
free(seqs[i].comment); seqs[i].comment = 0;
|
free(seqs[i].comment); seqs[i].comment = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue