From d19e834d84dc9a2659b1be665cd7ff48828c3deb Mon Sep 17 00:00:00 2001 From: Heng Li Date: Mon, 25 Feb 2013 15:40:15 -0500 Subject: [PATCH] r280: align two ends in the same thread Otherwise odd-number threads may be of different speed from even-number threads. --- bwamem.c | 11 +++++++++-- main.c | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bwamem.c b/bwamem.c index a1f25b7..5c274b1 100644 --- a/bwamem.c +++ b/bwamem.c @@ -680,8 +680,15 @@ static void *worker1(void *data) { worker_t *w = (worker_t*)data; int i; - for (i = w->start; i < w->n; i += w->step) - w->regs[i] = mem_align1(w->opt, w->bwt, w->bns, w->pac, w->seqs[i].l_seq, w->seqs[i].seq); + if (!(w->opt->flag&MEM_F_PE)) { + for (i = w->start; i < w->n; i += w->step) + w->regs[i] = mem_align1(w->opt, w->bwt, w->bns, w->pac, w->seqs[i].l_seq, w->seqs[i].seq); + } else { // for PE we align the two ends in the same thread in case the 2nd read is of worse quality, in which case some threads may be faster/slower + for (i = w->start; i < w->n>>1; i += w->step) { + w->regs[i<<1|0] = mem_align1(w->opt, w->bwt, w->bns, w->pac, w->seqs[i<<1|0].l_seq, w->seqs[i<<1|0].seq); + w->regs[i<<1|1] = mem_align1(w->opt, w->bwt, w->bns, w->pac, w->seqs[i<<1|1].l_seq, w->seqs[i<<1|1].seq); + } + } return 0; } diff --git a/main.c b/main.c index a0e8ec6..b85757e 100644 --- a/main.c +++ b/main.c @@ -4,7 +4,7 @@ #include "utils.h" #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.6.2-r279-beta" +#define PACKAGE_VERSION "0.6.2-r280-beta" #endif static int usage()