Merge branch 'dev' into XB

This commit is contained in:
Heng Li 2018-04-02 10:47:45 -04:00
commit 11d53b06fb
7 changed files with 37 additions and 8 deletions

11
NEWS.md
View File

@ -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) Release 0.7.16 (30 July 2017)
----------------------------- -----------------------------

View File

@ -1,4 +1,13 @@
[![Build Status](https://travis-ci.org/lh3/bwa.svg?branch=dev)](https://travis-ci.org/lh3/bwa) [![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/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 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
## Getting started ## Getting started
git clone https://github.com/lh3/bwa.git git clone https://github.com/lh3/bwa.git

9
bwa.1
View File

@ -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 .SH NAME
.PP .PP
bwa - Burrows-Wheeler Alignment Tool bwa - Burrows-Wheeler Alignment Tool
@ -303,9 +303,14 @@ For compatibility with other BWA commands, this option may also be given as
.IR FILE . .IR FILE .
[standard ouptut] [standard ouptut]
.TP .TP
.B -q
Don't reduce the mapping quality of split alignment of lower alignment score.
.TP
.B -5 .B -5
For split alignment, mark the segment with the smallest coordinate as the 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. highest scoring segment as primary.
.TP .TP
.B -K \ INT .B -K \ INT

View File

@ -1029,7 +1029,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 (p->secondary >= 0) q->sub = -1; // don't output sub-optimal score
if (l && p->secondary < 0) // if supplementary if (l && p->secondary < 0) // if supplementary
q->flag |= (opt->flag&MEM_F_NO_MULTI)? 0x10000 : 0x800; 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_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; ++l;
} }
if (aa.n == 0) { // no alignments good enough; then write an unaligned record if (aa.n == 0) { // no alignments good enough; then write an unaligned record

View File

@ -20,7 +20,8 @@ typedef struct __smem_i smem_i;
#define MEM_F_SOFTCLIP 0x200 #define MEM_F_SOFTCLIP 0x200
#define MEM_F_SMARTPE 0x400 #define MEM_F_SMARTPE 0x400
#define MEM_F_PRIMARY5 0x800 #define MEM_F_PRIMARY5 0x800
#define MEM_F_XB 0x1000 #define MEM_F_KEEP_SUPP_MAPQ 0x1000
#define MEM_F_XB 0x2000
typedef struct { typedef struct {
int a, b; // match score and mismatch penalty int a, b; // match score and mismatch penalty

View File

@ -130,7 +130,7 @@ int main_mem(int argc, char *argv[])
aux.opt = opt = mem_opt_init(); aux.opt = opt = mem_opt_init();
memset(&opt0, 0, sizeof(mem_opt_t)); memset(&opt0, 0, sizeof(mem_opt_t));
while ((c = getopt(argc, argv, "51paMCSPVYjuk: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, "51qpaMCSPVYjuk: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; 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 == '1') no_mt_io = 1;
else if (c == 'x') mode = optarg; 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 == 'S') opt->flag |= MEM_F_NO_RESCUE;
else if (c == 'Y') opt->flag |= MEM_F_SOFTCLIP; else if (c == 'Y') opt->flag |= MEM_F_SOFTCLIP;
else if (c == 'V') opt->flag |= MEM_F_REF_HDR; 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 == 'u') opt->flag |= MEM_F_XB; else if (c == 'u') opt->flag |= MEM_F_XB;
else if (c == 'c') opt->max_occ = atoi(optarg), opt0.max_occ = 1; 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 == 'd') opt->zdrop = atoi(optarg), opt0.zdrop = 1;
@ -269,7 +270,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, " -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, " -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 <idxbase>.alt file)\n"); fprintf(stderr, " -j treat ALT contigs as part of the primary assembly (i.e. ignore <idxbase>.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, " -K INT process INT input bases in each batch regardless of nThreads (for reproducibility) []\n");
fprintf(stderr, "\n"); fprintf(stderr, "\n");
fprintf(stderr, " -v INT verbosity level: 1=error, 2=warning, 3=message, 4+=debugging [%d]\n", bwa_verbose); fprintf(stderr, " -v INT verbosity level: 1=error, 2=warning, 3=message, 4+=debugging [%d]\n", bwa_verbose);

2
main.c
View File

@ -4,7 +4,7 @@
#include "utils.h" #include "utils.h"
#ifndef PACKAGE_VERSION #ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "0.7.16a-r1181" #define PACKAGE_VERSION "0.7.17-r1194-dirty"
#endif #endif
int bwa_fa2pac(int argc, char *argv[]); int bwa_fa2pac(int argc, char *argv[]);