bugfix in multi-threaded bwa-mem

This commit is contained in:
Heng Li 2013-02-23 14:48:54 -05:00
parent a19ab654df
commit d460f2ec9e
2 changed files with 5 additions and 3 deletions

View File

@ -707,14 +707,14 @@ static void *worker2(void *data)
worker_t *w = (worker_t*)data;
int i;
if (!(w->opt->flag&MEM_F_PE)) {
for (i = 0; i < w->n; i += w->step) {
for (i = w->start; i < w->n; i += w->step) {
mem_mark_primary_se(w->opt, w->regs[i].n, w->regs[i].a);
mem_sam_se(w->opt, w->bns, w->pac, &w->seqs[i], &w->regs[i], 0, 0);
free(w->regs[i].a);
}
} else {
int n = 0;
for (i = 0; i < w->n>>1; i += w->step) { // not implemented yet
for (i = w->start; i < w->n>>1; i += w->step) { // not implemented yet
n += mem_sam_pe(w->opt, w->bns, w->pac, w->pes, i, &w->seqs[i<<1], &w->regs[i<<1]);
free(w->regs[i<<1|0].a); free(w->regs[i<<1|1].a);
}

View File

@ -24,8 +24,9 @@ int main_mem(int argc, char *argv[])
bseq1_t *seqs;
opt = mem_opt_init();
while ((c = getopt(argc, argv, "PHk:c:v:s:r:")) >= 0) {
while ((c = getopt(argc, argv, "PHk:c:v:s:r:t:")) >= 0) {
if (c == 'k') opt->min_seed_len = atoi(optarg);
else if (c == 't') opt->n_threads = atoi(optarg), opt->n_threads = opt->n_threads > 1? opt->n_threads : 1;
else if (c == 'P') opt->flag |= MEM_F_NOPAIRING;
else if (c == 'H') opt->flag |= MEM_F_HARDCLIP;
else if (c == 'c') opt->max_occ = atoi(optarg);
@ -37,6 +38,7 @@ int main_mem(int argc, char *argv[])
fprintf(stderr, "\n");
fprintf(stderr, "Usage: bwa mem [options] <idxbase> <in.fq>\n\n");
fprintf(stderr, "Options: -k INT minimum seed length [%d]\n", opt->min_seed_len);
fprintf(stderr, " -t INT number of threads [%d]\n", opt->n_threads);
fprintf(stderr, " -c INT skip seeds with more than INT occurrences [%d]\n", opt->max_occ);
fprintf(stderr, " -s INT look for internal seeds inside a seed with less than INT occ [%d]\n", opt->split_width);
fprintf(stderr, " -r FLOAT look for internal seeds inside a seed longer than {-k} * FLOAT [%g]\n", opt->split_factor);