From 2b87a263cbd4781da87041be84b0c6d89a41efc2 Mon Sep 17 00:00:00 2001 From: Charles Haynes <33608920+haynescd@users.noreply.github.com> Date: Tue, 25 Jun 2024 09:59:52 -0400 Subject: [PATCH] :bug: Fix totalCount calculation when WES not available (#10858) --- .../service/impl/AlterationCountServiceImpl.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/cbioportal/service/impl/AlterationCountServiceImpl.java b/src/main/java/org/cbioportal/service/impl/AlterationCountServiceImpl.java index 67079dc5b63..29f94f0fd0f 100644 --- a/src/main/java/org/cbioportal/service/impl/AlterationCountServiceImpl.java +++ b/src/main/java/org/cbioportal/service/impl/AlterationCountServiceImpl.java @@ -19,7 +19,6 @@ import org.cbioportal.web.parameter.StudyViewFilter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.lang.NonNull; -import org.springframework.lang.Nullable; import org.springframework.stereotype.Service; import java.util.ArrayList; @@ -286,7 +285,7 @@ private < T extends AlterationCountByGene> List populateAlterationCounts(@Non Set matchingGenePanelIds = matchingGenePanelIdsMap.get(hugoGeneSymbol) != null ? matchingGenePanelIdsMap.get(hugoGeneSymbol) : Collections.emptySet(); - int totalProfiledCount = getTotalProfiledCount(alterationCountByGene.getHugoGeneSymbol(), + int totalProfiledCount = getTotalProfiledCount(hugoGeneSymbol, profiledCountsMap, profiledCountWithoutGenePanelData, matchingGenePanelIds); alterationCountByGene.setNumberOfProfiledCases(totalProfiledCount); @@ -297,7 +296,7 @@ private < T extends AlterationCountByGene> List populateAlterationCounts(@Non } private int getTotalProfiledCount(@NonNull String hugoGeneSymbol, @NonNull Map profiledCountsMap, - int profiledCountWithoutGenePanelData, @Nullable Set matchingGenePanelIds) { + int profiledCountWithoutGenePanelData, @NonNull Set matchingGenePanelIds) { int totalProfiledCount = profiledCountWithoutGenePanelData; if (hasGenePanelData(matchingGenePanelIds) && profiledCountsMap.containsKey(hugoGeneSymbol)) { @@ -306,9 +305,9 @@ private int getTotalProfiledCount(@NonNull String hugoGeneSymbol, @NonNull Map matchingGenePanelIds) { - return matchingGenePanelIds != null && matchingGenePanelIds.contains(WHOLE_EXOME_SEQUENCING) - && matchingGenePanelIds.size() > 1; + private boolean hasGenePanelData(@NonNull Set matchingGenePanelIds) { + return matchingGenePanelIds.contains(WHOLE_EXOME_SEQUENCING) + && matchingGenePanelIds.size() > 1 || !matchingGenePanelIds.contains(WHOLE_EXOME_SEQUENCING) && !matchingGenePanelIds.isEmpty(); } private Pair, Long> getAlterationGeneCounts(