r848: tag alignments with primary ALT
This commit is contained in:
parent
a458442b24
commit
6f37c14f26
4
bwamem.c
4
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;
|
||||
}
|
||||
|
|
|
|||
2
bwamem.h
2
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
|
||||
|
|
|
|||
Loading…
Reference in New Issue