From 8a8d3a566a4851ba7692a3e6f5790543997da8d8 Mon Sep 17 00:00:00 2001 From: Haibao Tang Date: Thu, 5 Jul 2018 19:29:17 -0700 Subject: [PATCH] [extract] Add bam flags --- extract.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/extract.go b/extract.go index 5143f59..f650c52 100644 --- a/extract.go +++ b/extract.go @@ -589,8 +589,21 @@ func (r *Extracter) ExtractInterContigLinks() { } break } + // Filtering: Unmapped | Secondary | QCFail | Duplicate | Supplementary + if rec.MapQ == 0 || rec.Flags&3844 != 0 { + continue + } + + // Make sure we have these contig ids at, bt := rec.Ref.Name(), rec.MateRef.Name() - ai, bi := r.contigToIdx[at], r.contigToIdx[bt] + ai, ok := r.contigToIdx[at] + if !ok { + continue + } + bi, ok := r.contigToIdx[bt] + if !ok { + continue + } // read1 read2 // ---a-- X|----- dist = a2 ----| |--- dist = b ---|X ------ b2 ------