Skip to content

Commit

Permalink
🐛 Fix totalCount calculation when WES not available (#10858)
Browse files Browse the repository at this point in the history
  • Loading branch information
haynescd authored Jun 25, 2024
1 parent 14b7105 commit 2b87a26
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -286,7 +285,7 @@ private < T extends AlterationCountByGene> List<T> populateAlterationCounts(@Non
Set<String> 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);
Expand All @@ -297,7 +296,7 @@ private < T extends AlterationCountByGene> List<T> populateAlterationCounts(@Non
}

private int getTotalProfiledCount(@NonNull String hugoGeneSymbol, @NonNull Map<String, AlterationCountByGene> profiledCountsMap,
int profiledCountWithoutGenePanelData, @Nullable Set<String> matchingGenePanelIds) {
int profiledCountWithoutGenePanelData, @NonNull Set<String> matchingGenePanelIds) {
int totalProfiledCount = profiledCountWithoutGenePanelData;

if (hasGenePanelData(matchingGenePanelIds) && profiledCountsMap.containsKey(hugoGeneSymbol)) {
Expand All @@ -306,9 +305,9 @@ private int getTotalProfiledCount(@NonNull String hugoGeneSymbol, @NonNull Map<S
return totalProfiledCount;
}

private boolean hasGenePanelData(@Nullable Set<String> matchingGenePanelIds) {
return matchingGenePanelIds != null && matchingGenePanelIds.contains(WHOLE_EXOME_SEQUENCING)
&& matchingGenePanelIds.size() > 1;
private boolean hasGenePanelData(@NonNull Set<String> matchingGenePanelIds) {
return matchingGenePanelIds.contains(WHOLE_EXOME_SEQUENCING)
&& matchingGenePanelIds.size() > 1 || !matchingGenePanelIds.contains(WHOLE_EXOME_SEQUENCING) && !matchingGenePanelIds.isEmpty();
}

private <S extends AlterationCountBase> Pair<List<S>, Long> getAlterationGeneCounts(
Expand Down

0 comments on commit 2b87a26

Please sign in to comment.