From 95f2899f0586a8b3415e8ccaab9a5b6373652f5d Mon Sep 17 00:00:00 2001 From: Geraldine Van der Auwera Date: Tue, 2 Jun 2015 00:34:34 -0400 Subject: [PATCH] User (mnw21cam) patch to fix DoC slowdown in 3.4 --- .../tools/walkers/coverage/CoverageUtils.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/coverage/CoverageUtils.java b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/coverage/CoverageUtils.java index e71860794..e027464d4 100644 --- a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/coverage/CoverageUtils.java +++ b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/coverage/CoverageUtils.java @@ -137,6 +137,9 @@ public class CoverageUtils { public static Map getBaseCountsByReadGroup(AlignmentContext context, int minMapQ, int maxMapQ, byte minBaseQ, byte maxBaseQ, CountPileupType countType) { Map countsByRG = new HashMap(); + Map countsByRGName = new HashMap(); + Map RGByName = new HashMap(); + List countPileup = new LinkedList(); FragmentCollection fpile; @@ -202,10 +205,20 @@ public class CoverageUtils { for (PileupElement e : countPileup) { SAMReadGroupRecord readGroup = getReadGroup(e.getRead()); - if (!countsByRG.keySet().contains(readGroup)) - countsByRG.put(readGroup, new int[6]); - updateCounts(countsByRG.get(readGroup), e); + String readGroupId = readGroup.getSample() + "_" + readGroup.getReadGroupId(); + int[] counts = countsByRGName.get(readGroupId); + if (counts == null) { + counts = new int[6]; + countsByRGName.put(readGroupId, counts); + RGByName.put(readGroupId, readGroup); + } + + updateCounts(counts, e); + } + + for (String readGroupId : RGByName.keySet()) { + countsByRG.put(RGByName.get(readGroupId), countsByRGName.get(readGroupId)); } return countsByRG;