From 6207cd59fea84a3dfd317066906cabb3dc454dc2 Mon Sep 17 00:00:00 2001 From: mozack Date: Thu, 14 Sep 2017 16:50:00 -0400 Subject: [PATCH] Further tweaks to read info --- src/main/java/abra/SortedSAMWriter.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/abra/SortedSAMWriter.java b/src/main/java/abra/SortedSAMWriter.java index 8708456..5442d0b 100644 --- a/src/main/java/abra/SortedSAMWriter.java +++ b/src/main/java/abra/SortedSAMWriter.java @@ -229,17 +229,22 @@ private SortingSAMRecordCollection updateReadMatesAndSortByCoordinate(SortingSAM mates.clear(); currReads.clear(); + currReadName = read.getReadName(); } // Cache reads with same read name currReads.add(read); // Cache read by mate info - MateKey mateKey = getOriginalReadInfo(read); - SAMRecord existingMate = mates.get(mateKey); - if (existingMate == null || (existingMate.getFlags() & 0xA00) != 0) { - // Cache read info giving priority to primary alignments - mates.put(mateKey, read); + if (read.getSupplementaryAlignmentFlag() != true && (read.getFlags() & 0x100) == 0) { + MateKey mateKey = getOriginalReadInfo(read); + SAMRecord existingMate = mates.get(mateKey); + + // if (existingMate == null || existingMate.getSupplementaryAlignmentFlag() == true || (existingMate.getFlags() & 0x100) != 0) { + if (existingMate == null) { + // Cache read info giving priority to primary alignments + mates.put(mateKey, read); + } } }