diff --git a/bwamem.c b/bwamem.c index 64c26fa..1699e97 100644 --- a/bwamem.c +++ b/bwamem.c @@ -880,11 +880,13 @@ void mem_aln2sam(const mem_opt_t *opt, const bntseq_t *bns, kstring_t *str, bseq for (i = 0; i < n; ++i) if (i != which && !(list[i].flag&0x100)) break; if (i < n) { // there are other primary hits; output them + int has_pri_alt = 0; kputsn("\tSA:Z:", 6, str); for (i = 0; i < n; ++i) { const mem_aln_t *r = &list[i]; int k; if (i == which || (list[i].flag&0x100)) continue; // proceed if: 1) different from the current; 2) not shadowed multi hit + if (list[i].is_alt) has_pri_alt = 1; kputs(bns->anns[r->rid].name, str); kputc(',', str); kputl(r->pos+1, str); kputc(',', str); kputc("+-"[r->is_rev], str); kputc(',', str); @@ -895,6 +897,7 @@ void mem_aln2sam(const mem_opt_t *opt, const bntseq_t *bns, kstring_t *str, bseq kputc(',', str); kputw(r->NM, str); kputc(';', str); } + if (has_pri_alt) kputsn("\tpa:A:Y", 7, str); } } if (p->XA) { kputsn("\tXA:Z:", 6, str); kputs(p->XA, str); } @@ -1094,6 +1097,7 @@ mem_aln_t mem_reg2aln(const mem_opt_t *opt, const bntseq_t *bns, const uint8_t * assert(a.rid == ar->rid); a.pos = pos - bns->anns[a.rid].offset; a.score = ar->score; a.sub = ar->sub > ar->csub? ar->sub : ar->csub; + a.is_alt = ar->is_alt; free(query); return a; } diff --git a/bwamem.h b/bwamem.h index 8b8ec0d..20e8d05 100644 --- a/bwamem.h +++ b/bwamem.h @@ -85,7 +85,7 @@ typedef struct { // This struct is only used for the convenience of API. int64_t pos; // forward strand 5'-end mapping position int rid; // reference sequence index in bntseq_t; <0 for unmapped int flag; // extra flag - uint32_t is_rev:1, mapq:8, NM:23; // is_rev: whether on the reverse strand; mapq: mapping quality; NM: edit distance + uint32_t is_rev:1, is_alt:1, mapq:8, NM:22; // is_rev: whether on the reverse strand; mapq: mapping quality; NM: edit distance int n_cigar; // number of CIGAR operations uint32_t *cigar; // CIGAR in the BAM encoding: opLen<<4|op; op to integer mapping: MIDSH=>01234 char *XA; // alternative mappings diff --git a/main.c b/main.c index 35e598b..ca71750 100644 --- a/main.c +++ b/main.c @@ -4,7 +4,7 @@ #include "utils.h" #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.7.10-r845-dirty" +#define PACKAGE_VERSION "0.7.10-r848-dirty" #endif int bwa_fa2pac(int argc, char *argv[]);