fixed a stupid bug in fastq reading
This commit is contained in:
parent
59eaf650ac
commit
987d4b4205
6
bseq.c
6
bseq.c
|
|
@ -41,15 +41,15 @@ bseq1_t *bseq_read(int chunk_size, int *n_, void *ks1_, void *ks2_)
|
|||
size += seqs[n++].l_seq;
|
||||
if (ks2) {
|
||||
trim_readno(&ks2->name);
|
||||
kseq2bseq1(ks2, &seqs[n++]);
|
||||
kseq2bseq1(ks2, &seqs[n]);
|
||||
size += seqs[n++].l_seq;
|
||||
}
|
||||
if (size >= chunk_size) break;
|
||||
}
|
||||
*n_ = n;
|
||||
if (size < chunk_size) { // test if the 2nd file is finished
|
||||
if (size == 0) { // test if the 2nd file is finished
|
||||
if (ks2 && kseq_read(ks2) >= 0)
|
||||
fprintf(stderr, "[W::%s] the 1st file has fewer sequences.\n", __func__);
|
||||
}
|
||||
*n_ = n;
|
||||
return seqs;
|
||||
}
|
||||
|
|
|
|||
6
bwamem.c
6
bwamem.c
|
|
@ -644,21 +644,21 @@ int mem_process_seqs(const mem_opt_t *opt, const bwt_t *bwt, const bntseq_t *bns
|
|||
#ifdef HAVE_PTHREAD
|
||||
if (opt->n_threads == 1) {
|
||||
worker1(w);
|
||||
mem_pestat(opt, bns->l_pac, n, regs, pes);
|
||||
if (opt->is_pe) mem_pestat(opt, bns->l_pac, n, regs, pes);
|
||||
worker2(w);
|
||||
} else {
|
||||
pthread_t *tid;
|
||||
tid = (pthread_t*)calloc(opt->n_threads, sizeof(pthread_t));
|
||||
for (i = 0; i < opt->n_threads; ++i) pthread_create(&tid[i], 0, worker1, &w[i]);
|
||||
for (i = 0; i < opt->n_threads; ++i) pthread_join(tid[i], 0);
|
||||
mem_pestat(opt, bns->l_pac, n, regs, pes);
|
||||
if (opt->is_pe) mem_pestat(opt, bns->l_pac, n, regs, pes);
|
||||
for (i = 0; i < opt->n_threads; ++i) pthread_create(&tid[i], 0, worker2, &w[i]);
|
||||
for (i = 0; i < opt->n_threads; ++i) pthread_join(tid[i], 0);
|
||||
free(tid);
|
||||
}
|
||||
#else
|
||||
worker1(w);
|
||||
mem_pestat(opt, bns->l_pac, n, regs, pes);
|
||||
if (opt->is_pe) mem_pestat(opt, bns->l_pac, n, regs, pes);
|
||||
worker2(w);
|
||||
#endif
|
||||
for (i = 0; i < n; ++i) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue