From 340babdd671eeeb3c7bfbf2e4ad1e761ece94983 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Mon, 11 Sep 2017 09:58:41 -0400 Subject: [PATCH 1/8] r1185: don't lower supp mapq with -5 --- bwamem.c | 3 ++- main.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bwamem.c b/bwamem.c index d7c00fe..a4e9068 100644 --- a/bwamem.c +++ b/bwamem.c @@ -1026,7 +1026,8 @@ void mem_reg2sam(const mem_opt_t *opt, const bntseq_t *bns, const uint8_t *pac, if (p->secondary >= 0) q->sub = -1; // don't output sub-optimal score if (l && p->secondary < 0) // if supplementary q->flag |= (opt->flag&MEM_F_NO_MULTI)? 0x10000 : 0x800; - if (l && !p->is_alt && q->mapq > aa.a[0].mapq) q->mapq = aa.a[0].mapq; + if (!(opt->flag&MEM_F_PRIMARY5) && l && !p->is_alt && q->mapq > aa.a[0].mapq) + q->mapq = aa.a[0].mapq; // lower mapq for supplementary mappings, unless -5 is applied ++l; } if (aa.n == 0) { // no alignments good enough; then write an unaligned record diff --git a/main.c b/main.c index e2b7cf1..189e723 100644 --- a/main.c +++ b/main.c @@ -4,7 +4,7 @@ #include "utils.h" #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.7.16a-r1181" +#define PACKAGE_VERSION "0.7.16a-r1185-dirty" #endif int bwa_fa2pac(int argc, char *argv[]); From b58281621136a0ce2a66837ba509716c727b9387 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Tue, 26 Sep 2017 09:35:19 -0400 Subject: [PATCH 2/8] r1187: a typo in command line help --- bwamem.c | 4 ++-- bwamem.h | 1 + fastmap.c | 8 +++++--- main.c | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/bwamem.c b/bwamem.c index a4e9068..eeaf4f4 100644 --- a/bwamem.c +++ b/bwamem.c @@ -1026,8 +1026,8 @@ void mem_reg2sam(const mem_opt_t *opt, const bntseq_t *bns, const uint8_t *pac, if (p->secondary >= 0) q->sub = -1; // don't output sub-optimal score if (l && p->secondary < 0) // if supplementary q->flag |= (opt->flag&MEM_F_NO_MULTI)? 0x10000 : 0x800; - if (!(opt->flag&MEM_F_PRIMARY5) && l && !p->is_alt && q->mapq > aa.a[0].mapq) - q->mapq = aa.a[0].mapq; // lower mapq for supplementary mappings, unless -5 is applied + if (!(opt->flag & MEM_F_KEEP_SUPP_MAPQ) && l && !p->is_alt && q->mapq > aa.a[0].mapq) + q->mapq = aa.a[0].mapq; // lower mapq for supplementary mappings, unless -5 or -q is applied ++l; } if (aa.n == 0) { // no alignments good enough; then write an unaligned record diff --git a/bwamem.h b/bwamem.h index 4e2b1d8..fb572b2 100644 --- a/bwamem.h +++ b/bwamem.h @@ -20,6 +20,7 @@ typedef struct __smem_i smem_i; #define MEM_F_SOFTCLIP 0x200 #define MEM_F_SMARTPE 0x400 #define MEM_F_PRIMARY5 0x800 +#define MEM_F_KEEP_SUPP_MAPQ 0x1000 typedef struct { int a, b; // match score and mismatch penalty diff --git a/fastmap.c b/fastmap.c index d89c495..41c29cb 100644 --- a/fastmap.c +++ b/fastmap.c @@ -130,7 +130,7 @@ int main_mem(int argc, char *argv[]) aux.opt = opt = mem_opt_init(); memset(&opt0, 0, sizeof(mem_opt_t)); - while ((c = getopt(argc, argv, "51paMCSPVYjk:c:v:s:r:t:R:A:B:O:E:U:w:L:d:T:Q:D:m:I:N:o:f:W:x:G:h:y:K:X:H:")) >= 0) { + while ((c = getopt(argc, argv, "51qpaMCSPVYjk:c:v:s:r:t:R:A:B:O:E:U:w:L:d:T:Q:D:m:I:N:o:f:W:x:G:h:y:K:X:H:")) >= 0) { if (c == 'k') opt->min_seed_len = atoi(optarg), opt0.min_seed_len = 1; else if (c == '1') no_mt_io = 1; else if (c == 'x') mode = optarg; @@ -147,7 +147,8 @@ int main_mem(int argc, char *argv[]) else if (c == 'S') opt->flag |= MEM_F_NO_RESCUE; else if (c == 'Y') opt->flag |= MEM_F_SOFTCLIP; else if (c == 'V') opt->flag |= MEM_F_REF_HDR; - else if (c == '5') opt->flag |= MEM_F_PRIMARY5; + else if (c == '5') opt->flag |= MEM_F_PRIMARY5 | MEM_F_KEEP_SUPP_MAPQ; // always apply MEM_F_KEEP_SUPP_MAPQ with -5 + else if (c == 'q') opt->flag |= MEM_F_KEEP_SUPP_MAPQ; else if (c == 'c') opt->max_occ = atoi(optarg), opt0.max_occ = 1; else if (c == 'd') opt->zdrop = atoi(optarg), opt0.zdrop = 1; else if (c == 'v') bwa_verbose = atoi(optarg); @@ -268,7 +269,8 @@ int main_mem(int argc, char *argv[]) fprintf(stderr, " -H STR/FILE insert STR to header if it starts with @; or insert lines in FILE [null]\n"); fprintf(stderr, " -o FILE sam file to output results to [stdout]\n"); fprintf(stderr, " -j treat ALT contigs as part of the primary assembly (i.e. ignore .alt file)\n"); - fprintf(stderr, " -5 for split alignment, take the alignment with the smallest coordiate as primary\n"); + fprintf(stderr, " -5 for split alignment, take the alignment with the smallest coordinate as primary\n"); + fprintf(stderr, " -q don't modify mapQ of supplementary alignments\n"); fprintf(stderr, " -K INT process INT input bases in each batch regardless of nThreads (for reproducibility) []\n"); fprintf(stderr, "\n"); fprintf(stderr, " -v INT verbosity level: 1=error, 2=warning, 3=message, 4+=debugging [%d]\n", bwa_verbose); diff --git a/main.c b/main.c index 189e723..063384e 100644 --- a/main.c +++ b/main.c @@ -4,7 +4,7 @@ #include "utils.h" #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.7.16a-r1185-dirty" +#define PACKAGE_VERSION "0.7.16a-r1187-dirty" #endif int bwa_fa2pac(int argc, char *argv[]); From 9f26bfcc7780753129b60717ecab0ebba6f04b7c Mon Sep 17 00:00:00 2001 From: Heng Li Date: Mon, 23 Oct 2017 13:10:17 -0400 Subject: [PATCH 3/8] Released bwa-0.7.17 (r1188) --- NEWS.md | 11 +++++++++++ bwa.1 | 9 +++++++-- main.c | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 02a1c0c..151e024 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,14 @@ +Release 0.7.17 (23 October 2017) +-------------------------------- + +This release adds option -q to preserve the mapping quality of split alignment +with a lower alignment score than the primary alignment. Option -5 +automatically applies -q as well. + +(0.7.17: 23 October 2017, r1188) + + + Release 0.7.16 (30 July 2017) ----------------------------- diff --git a/bwa.1 b/bwa.1 index 94c2c58..d30ac33 100644 --- a/bwa.1 +++ b/bwa.1 @@ -1,4 +1,4 @@ -.TH bwa 1 "30 July 2017" "bwa-0.7.16-r1180" "Bioinformatics tools" +.TH bwa 1 "23 October 2017" "bwa-0.7.17-r1188" "Bioinformatics tools" .SH NAME .PP bwa - Burrows-Wheeler Alignment Tool @@ -303,9 +303,14 @@ For compatibility with other BWA commands, this option may also be given as .IR FILE . [standard ouptut] .TP +.B -q + Don't reduce the mapping quality of split alignment of lower alignment score. +.TP .B -5 For split alignment, mark the segment with the smallest coordinate as the -primary. This option may help some Hi-C pipelines. By default, BWA-MEM marks +primary. It automatically applies option +.B -q +as well. This option may help some Hi-C pipelines. By default, BWA-MEM marks highest scoring segment as primary. .TP .B -K \ INT diff --git a/main.c b/main.c index 063384e..50ae755 100644 --- a/main.c +++ b/main.c @@ -4,7 +4,7 @@ #include "utils.h" #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.7.16a-r1187-dirty" +#define PACKAGE_VERSION "0.7.17-r1188" #endif int bwa_fa2pac(int argc, char *argv[]); From ab64326ae6634ab8561bc207b13938d47fb6238b Mon Sep 17 00:00:00 2001 From: Heng Li Date: Mon, 6 Nov 2017 19:40:42 -0500 Subject: [PATCH 4/8] claim bwa-mem long-read mode deprecated --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 5f673a2..dcb7873 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,12 @@ [![Build Status](https://travis-ci.org/lh3/bwa.svg?branch=dev)](https://travis-ci.org/lh3/bwa) +[![SourceForge Downloads](https://img.shields.io/sourceforge/dt/bio-bwa.svg)](https://sourceforge.net/projects/bio-bwa/files/?source=navbar) +[![GitHub Downloads](https://img.shields.io/github/downloads/lh3/minimap2/total.svg?style=flat)](https://github.com/lh3/bwa/releases) + +**Note: [minimap2][minimap2] has replaced BWA-MEM for PacBio and Nanopore read +alignment.** It is ~50 times as fast, more accurate, produces better base-level +alignment and works with long RNA-seq reads and long-read assemblies. +[minimap2]: https://github.com/lh3/minimap2 + ## Getting started git clone https://github.com/lh3/bwa.git From 824e00e7ac2fd7031c29c6f9a4e6657862487cec Mon Sep 17 00:00:00 2001 From: Heng Li Date: Mon, 6 Nov 2017 19:41:53 -0500 Subject: [PATCH 5/8] formatting change --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index dcb7873..ffe25fc 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ **Note: [minimap2][minimap2] has replaced BWA-MEM for PacBio and Nanopore read alignment.** It is ~50 times as fast, more accurate, produces better base-level alignment and works with long RNA-seq reads and long-read assemblies. + [minimap2]: https://github.com/lh3/minimap2 ## Getting started From 1a2b0c001af4919f2c6c313f3e6d607a1a27c048 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Mon, 6 Nov 2017 19:43:02 -0500 Subject: [PATCH 6/8] fixed a typo in link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ffe25fc..270ddb0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Build Status](https://travis-ci.org/lh3/bwa.svg?branch=dev)](https://travis-ci.org/lh3/bwa) [![SourceForge Downloads](https://img.shields.io/sourceforge/dt/bio-bwa.svg)](https://sourceforge.net/projects/bio-bwa/files/?source=navbar) -[![GitHub Downloads](https://img.shields.io/github/downloads/lh3/minimap2/total.svg?style=flat)](https://github.com/lh3/bwa/releases) +[![GitHub Downloads](https://img.shields.io/github/downloads/lh3/bwa/total.svg?style=flat)](https://github.com/lh3/bwa/releases) **Note: [minimap2][minimap2] has replaced BWA-MEM for PacBio and Nanopore read alignment.** It is ~50 times as fast, more accurate, produces better base-level From eef04271e619f18ae4dd2aaf1cec307b08f1c6cd Mon Sep 17 00:00:00 2001 From: Heng Li Date: Mon, 6 Nov 2017 19:49:19 -0500 Subject: [PATCH 7/8] wording changes --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 270ddb0..34b4903 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ [![GitHub Downloads](https://img.shields.io/github/downloads/lh3/bwa/total.svg?style=flat)](https://github.com/lh3/bwa/releases) **Note: [minimap2][minimap2] has replaced BWA-MEM for PacBio and Nanopore read -alignment.** It is ~50 times as fast, more accurate, produces better base-level -alignment and works with long RNA-seq reads and long-read assemblies. +alignment.** It retains all major BWA-MEM features, but is ~50 times as fast, +more versatile, more accurate and produces better base-level alignment. [minimap2]: https://github.com/lh3/minimap2 From fde1fd7ce3f52e74907169b927922a12a9feb000 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Mon, 6 Nov 2017 19:51:01 -0500 Subject: [PATCH 8/8] emphasize pacbio and nanopore --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 34b4903..23762b8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![SourceForge Downloads](https://img.shields.io/sourceforge/dt/bio-bwa.svg)](https://sourceforge.net/projects/bio-bwa/files/?source=navbar) [![GitHub Downloads](https://img.shields.io/github/downloads/lh3/bwa/total.svg?style=flat)](https://github.com/lh3/bwa/releases) -**Note: [minimap2][minimap2] has replaced BWA-MEM for PacBio and Nanopore read +**Note: [minimap2][minimap2] has replaced BWA-MEM for __PacBio and Nanopore__ read alignment.** It retains all major BWA-MEM features, but is ~50 times as fast, more versatile, more accurate and produces better base-level alignment.