From f08430abc931869daa29e4ad714ae418886f8ebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20F=C3=B6rstner?= Date: Tue, 17 Apr 2018 22:29:19 +0200 Subject: [PATCH] Fix issue with supplementary read in paired-end mappings --- covernantlib/coveragecalculator.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/covernantlib/coveragecalculator.py b/covernantlib/coveragecalculator.py index 44659a5..c65ff63 100644 --- a/covernantlib/coveragecalculator.py +++ b/covernantlib/coveragecalculator.py @@ -57,10 +57,15 @@ def _calc_coverage_paired_end(self, ref_seq, bam): if not alignment.is_proper_pair: self._add_coverage_of_single_end_reads(alignment) else: + # some paired-end mapping have a third supplementary + # read that should be discarded + if alignment.is_supplementary: + continue # Collect all read pairs - this might be memory intensive! index = 0 if alignment.is_read2: index = 1 + read_pairs_by_qname.setdefault( alignment.qname, [None, None]) read_pairs_by_qname[alignment.qname][index] = alignment