r550: fixed -L issues with secondary and supp aln

This commit is contained in:
Heng Li 2017-11-04 12:13:38 -04:00
parent 52ffbc9e0c
commit a3f0aa1d5b
3 changed files with 8 additions and 7 deletions

View File

@ -212,10 +212,8 @@ To avoid this issue, you can add option `-L` at the minimap2 command line.
This option moves a long CIGAR to the `CG` tag and leaves a fully clipped CIGAR This option moves a long CIGAR to the `CG` tag and leaves a fully clipped CIGAR
at the SAM CIGAR column. Current tools that don't read CIGAR (e.g. merging and at the SAM CIGAR column. Current tools that don't read CIGAR (e.g. merging and
sorting) still work with such BAM records; tools that read CIGAR will sorting) still work with such BAM records; tools that read CIGAR will
effectively ignore these records. I have pull requests to the SAM spec, htslib, effectively ignore these records. It has been decided that future tools will
htsjdk, bedtools2, Rsamtools and igv.js. If they are accepted, future versions will seamlessly recognize long-cigar records generated by option `-L`.
of these tools will seamlessly recognize long-cigar records generated by option
`-L`.
**TD;DR**: if you work with ultra-long reads and use tools that only process **TD;DR**: if you work with ultra-long reads and use tools that only process
BAM files, please add option `-L`. BAM files, please add option `-L`.

View File

@ -346,8 +346,11 @@ void mm_write_sam2(kstring_t *s, const mm_idx_t *mi, const mm_bseq1_t *t, int se
if (n_cigar > max_bam_cigar_op) if (n_cigar > max_bam_cigar_op)
cigar_in_tag = 1; cigar_in_tag = 1;
} }
if (cigar_in_tag) mm_sprintf_lite(s, "%dS", t->l_seq); if (cigar_in_tag) {
else write_sam_cigar(s, flag, 0, t->l_seq, r); if (flag & 0x100) mm_sprintf_lite(s, "0S"); // secondary alignment
else if (flag & 0x800) mm_sprintf_lite(s, "%dS", r->re - r->rs); // supplementary alignment
else mm_sprintf_lite(s, "%dS", t->l_seq);
} else write_sam_cigar(s, flag, 0, t->l_seq, r);
} }
// write mate positions // write mate positions

2
main.c
View File

@ -6,7 +6,7 @@
#include "mmpriv.h" #include "mmpriv.h"
#include "getopt.h" #include "getopt.h"
#define MM_VERSION "2.3-r546-dirty" #define MM_VERSION "2.3-r550-dirty"
#ifdef __linux__ #ifdef __linux__
#include <sys/resource.h> #include <sys/resource.h>