diff --git a/bwamem_pair.c b/bwamem_pair.c index 06aacff..c218925 100644 --- a/bwamem_pair.c +++ b/bwamem_pair.c @@ -301,6 +301,7 @@ int mem_sam_pe(const mem_opt_t *opt, const bntseq_t *bns, const uint8_t *pac, co h[1] = mem_reg2aln(opt, bns, pac, s[1].l_seq, s[1].seq, &a[1].a[z[1]]); h[1].mapq = q_se[1]; h[1].flag |= 0x80 | extra_flag; mem_aln2sam(bns, &str, &s[0], 1, &h[0], 0, &h[1]); s[0].sam = strdup(str.s); str.l = 0; mem_aln2sam(bns, &str, &s[1], 1, &h[1], 0, &h[0]); s[1].sam = str.s; + if (strcmp(s[0].name, s[1].name) != 0) err_fatal(__func__, "paired reads have different names: \"%s\", \"%s\"\n", s[0].name, s[1].name); free(h[0].cigar); free(h[1].cigar); } else goto no_pairing; return n; @@ -319,6 +320,7 @@ no_pairing: } mem_reg2sam_se(opt, bns, pac, &s[0], &a[0], 0x41|extra_flag, &h[1]); mem_reg2sam_se(opt, bns, pac, &s[1], &a[1], 0x81|extra_flag, &h[0]); + if (strcmp(s[0].name, s[1].name) != 0) err_fatal(__func__, "paired reads have different names: \"%s\", \"%s\"\n", s[0].name, s[1].name); free(h[0].cigar); free(h[1].cigar); return n; } diff --git a/bwape.c b/bwape.c index 08490e7..2c96e06 100644 --- a/bwape.c +++ b/bwape.c @@ -706,6 +706,7 @@ void bwa_sai2sam_pe_core(const char *prefix, char *const fn_sa[2], char *const f } bwa_print_sam1(bns, p[0], p[1], opt.mode, opt.max_top2); bwa_print_sam1(bns, p[1], p[0], opt.mode, opt.max_top2); + if (strcmp(p[0]->name, p[1]->name) != 0) err_fatal(__func__, "paired reads have different names: \"%s\", \"%s\"\n", p[0]->name, p[1]->name); } fprintf(stderr, "%.2f sec\n", (float)(clock() - t) / CLOCKS_PER_SEC); t = clock(); diff --git a/fastmap.c b/fastmap.c index 8b4ae3f..598194b 100644 --- a/fastmap.c +++ b/fastmap.c @@ -60,7 +60,7 @@ int main_mem(int argc, char *argv[]) else return 1; } if (opt->n_threads < 1) opt->n_threads = 1; - if (optind + 1 >= argc) { + if (optind + 1 >= argc || optind + 3 < argc) { fprintf(stderr, "\n"); fprintf(stderr, "Usage: bwa mem [options] [in2.fq]\n\n"); fprintf(stderr, "Algorithm options:\n\n"); diff --git a/main.c b/main.c index 06d24bc..dd60d1c 100644 --- a/main.c +++ b/main.c @@ -46,10 +46,11 @@ static int usage() fprintf(stderr, " bwtupdate update .bwt to the new format\n"); fprintf(stderr, " bwt2sa generate SA from BWT and Occ\n"); fprintf(stderr, "\n"); - fprintf(stderr, "Note: To use BWA, you need to first index the genome with `bwa index'. There are\n"); - fprintf(stderr, " three alignment algorithms in BWA: `mem', `bwasw' and `aln/samse/sampe'. If\n"); - fprintf(stderr, " you are not sure which to use, try `bwa mem' first. Please `man ./bwa.1' for\n"); - fprintf(stderr, " for the manual.\n\n"); + fprintf(stderr, +"Note: To use BWA, you need to first index the genome with `bwa index'.\n" +" There are three alignment algorithms in BWA: `mem', `bwasw', and\n" +" `aln/samse/sampe'. If you are not sure which to use, try `bwa mem'\n" +" first. Please `man ./bwa.1' for the manual.\n\n"); return 1; }